LinHES Forums http://forums.linhes.org/ |
|
Command KnoppMyth with your voice HOWTO http://forums.linhes.org/viewtopic.php?f=6&t=18163 |
Page 1 of 1 |
Author: | Gnarl [ Fri Apr 11, 2008 10:45 am ] |
Post subject: | Command KnoppMyth with your voice HOWTO |
This was actually a lot easier then I thought it would be when I got the idea from watching Star Trek. I found this to work about 70%, but this could be just because I'm using a $5 computer mic. It works best when using simple words and speaking in a monotone voice. There are 3 main components required. 1. sphinx-2 - speech recognition engine 2. perlbox - front end for configuring voice commands 3. festival - text to speech engine, not required but I use it for the system to tell me the time. Other programs required are: telnet - used to connect to mythfrontend and send commands to it expect - a way to script those telnet commands perl-tk - graphical library for perlbox's gui configuration festvox-kallpc16k - a voice for festival Installation apt-get install expect festival festvox-kallpc16k telnet sphinx2-bin wget http://prdownloads.sourceforge.net/perl ... noarch.deb or you can get it from http://perlbox.org. I recommend going there to read up on how it works. You will also need to enable the telnet control in Myth through Setup > Setup > General > 3rd page > Enable network remote control To begin you can start perlbox-voice and use the gui to play around. From here you can start the listener and add custom commands. To control myth I wrote a script to control a bunch of sub scripts by feeding an argument in to it. This way I only had to make a shortcut for on script in the path. Configuration My configuration is as follows: /home/mythtv/.perlbox-voice/Listener.conf #This is my config for perlbox. it contains all the voice to command codes I use. Code: # Maintained by Config::Simple/3.7 # ----------------------------------- [path_section] task=/home/mythtv/.perlbox-voice/commands agent_bin=/usr/lib/perlbox-voice/PerlboxListener.pl dict=/home/mythtv/.perlbox-voice/commands/current.dic language_model=/home/mythtv/.perlbox-voice/commands/current.lm hmm=/usr/share/sphinx2/model/hmm/6k perlbox_lib=/usr/lib/perlbox-voice/Perlbox/ sent=/home/mythtv/.perlbox-voice/commands/current.sent s2continuous=/usr/bin/sphinx2-continuous [option_section] magic=listen verbosity_level=3 playsound=1 perlbox-voice-version=.09 use_magic=0 magic_interval=5 help_browser=mozilla desktop_plugin=none [command_section] left=voice-control.sh left remove=voice-control.sh delete main menu=voice-control.sh mainmenu exit=pkill mythfrontend forward=voice-control.sh ff save=voice-control.sh save real time=voice-control.sh realtime down=voice-control.sh down unpause=voice-control.sh unpause show=voice-control.sh recordings video=voice-control.sh videos night=say sleep well paws=voice-control.sh pause guide=voice-conrtol.sh livetvguide console=xterm stat=voice-control.sh status enter=voice-control.sh select morning=say and good morning to you cancel=voice-control.sh cancel display recordings=voice-control.sh recordings time=voice-control.sh time confirm delete=voice-control.sh confirmdelete up=voice-control.sh up terminal=xterm start myth=mythfrontend myth=mythfrontend stop=voice-control.sh stop right=voice-control.sh right videos=voice-control.sh videos skip=voice-control.sh skip rewind=voicecontrol.sh rw replay=voice-control.sh replay Below are the scripts that I call to control myth voice-control.sh ###This is the min script that is use to call the command for myth. Code: #!/bin/bash #This script controls which expect scripts to run when the switch is given SCRIPTHOME="/myth/backup/scripts/voice" ##Change this to your scripts dir case $1 in start) perlbox-voice --nogui & >> /dev/null;; recordings) $SCRIPTHOME/voice-recordings.sh;; mainmenu) $SCRIPTHOME/voice-mainmenu.sh >> /dev/null;; down) $SCRIPTHOME/voice-down.sh >> /dev/null;; ff) $SCRIPTHOME/voice-ff.sh >> /dev/null;; left) $SCRIPTHOME/voice-left.sh >> /dev/null;; livetv) $SCRIPTHOME/voice-livetv.sh >> /dev/null;; livetvguide) $SCRIPTHOME/voice-livetvguide.sh >> /dev/null;; status) $SCRIPTHOME/voice-mythstatus.sh >> /dev/null;; pause) $SCRIPTHOME/voice-pause.sh >> /dev/null;; unpause) $SCRIPTHOME/voice-unpause.sh >> /dev/null;; right) $SCRIPTHOME/voice-right-.sh >> /dev/null;; rw) $SCRIPTHOME/voice-rw.sh >> /dev/null;; select) $SCRIPTHOME/voice-select.sh >> /dev/null;; realtime) $SCRIPTHOME/voice-speed-realtime.sh >> /dev/null;; stop) $SCRIPTHOME/voice-stop.sh >> /dev/null;; up) $SCRIPTHOME/voice-up.sh >> /dev/null;; videos) $SCRIPTHOME/voice-videos.sh >> /dev/null;; delete) $SCRIPTHOME/voice-delete.sh >> /dev/null;; confirmdelete) $SCRIPTHOME/voice-confirm-delete.sh >> /dev/null;; time) $SCRIPTHOME/voice-time.sh >> /dev/null;; skip) $SCRIPTHOME/voice-skip.sh >> /dev/null;; replay) $SCRIPTHOME/voice-replay.sh >> /dev/null;; save) $SCRIPTHOME/voice-save.sh >> /dev/null;; cancel) $SCRIPTHOME/voice-cancel.sh >> /dev/null;; # ) $SCRIPTHOME/voice-.sh >> /dev/null;; # ) $SCRIPTHOME/voice-.sh >> /dev/null;; help) echo " Available arguments: start, recordings, mainmenu, down, ff, left, livetv...";; *) echo " usage: voice-control.sh [arg]";; esac Below here are the sub-scripts. voice-cancel.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "key escape\r" expect "OK" send "exit\r" # end of expect script. voice-confirm-delete.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "key d\r" expect "OK" send "key up\r" expect "OK" send "key enter\r" expect "OK" send "exit\r" # end of expect script. voice-delete.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "key d\r" expect "OK" send "key up\r" expect "OK" send "exit\r" # end of expect script. voice-down.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "key down\r" expect "OK" send "exit\r" # end of expect script. voice-ff.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "play seek forward\r" expect "OK" send "exit\r" # end of expect script. voice-left.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "key left\r" expect "OK" send "exit\r" # end of expect script. voice-livetv.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "jump livetv\r" expect "OK" send "exit\r" # end of expect script. voice-livetvguide.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "jump livetvguide\r" expect "OK" send "exit\r" # end of expect script. voice-mainmenu.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "jump mainmenu\r" expect "OK" send "exit\r" # end of expect script. voice-mythstatus.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "jump statusbox\r" expect "OK" send "exit\r" # end of expect script. voice-pause.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "play speed pause\r" expect "OK" send "exit\r" # end of expect script. voice-recordings.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "jump playbackrecordings\r" expect "OK" send "exit\r" # end of expect script. voice-replay.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "key q\r" expect "OK" send "exit\r" # end of expect script. voice-right.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "key right\r" expect "OK" send "exit\r" # end of expect script. voice-rw.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "play seek backward\r" expect "OK" send "exit\r" # end of expect script. voice-save.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "key escape\r" expect "OK" send "key enter\r" expect "OK" send "exit\r" # end of expect script. voice-select.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "key enter\r" expect "OK" send "exit\r" # end of expect script. voice-skip.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "key z\r" expect "OK" send "exit\r" # end of expect script. voice-speed-realtime.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "play speed 1x\r" expect "OK" send "exit\r" # end of expect script. voice-stop.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "play stop\r" expect "OK" send "exit\r" # end of expect script. voice-time.sh Code: #!/bin/bash #echo "The time is $(date +%I" "%M" "%p)" > /tmp/currenttime echo "The time is $(date +%H" "%M" "hours)" > /tmp/currenttime festival --tts /tmp/currenttime rm -f /tmp/currenttime voice-unpause.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "key p\r" expect "OK" send "exit\r" # end of expect script. voice-up.sh Code: #!/usr/bin/expect -- # Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "key up\r" expect "OK" send "exit\r" # end of expect script. voice-videos.sh Code: #!/usr/bin/expect --
# Test expect script to telnet. spawn telnet localhost 6546 expect "#" send "jump mythvideo\r" expect "OK" send "exit\r" # end of expect script. Enjoy! |
Author: | cecil [ Sat Apr 12, 2008 6:10 pm ] |
Post subject: | |
![]() |
Author: | RacerX [ Sat Apr 12, 2008 11:50 pm ] |
Post subject: | |
Very interesting...thanks ![]() |
Author: | thornsoft [ Sun Apr 13, 2008 1:00 pm ] |
Post subject: | |
Seems like a cool idea, but is it practical? Isn't it a matter of time before you're watching a show and somebody (in the show) says something that deletes your shows or otherwise causes unintended behavior? There were concerns and jokes when Vista included voice navigation - someone made a proof-of-concept .mp3 that would do things to your PC. |
Author: | Gnarl [ Sun Apr 13, 2008 2:58 pm ] |
Post subject: | |
thornsoft wrote: Seems like a cool idea, but is it practical? Isn't it a matter of time before you're watching a show and somebody (in the show) says something that deletes your shows or otherwise causes unintended behavior? I basically just did this for the cool factor and to see if i could. Pearlbox can be setup to use a key word that must be spoken to activate the listener before an action word and all major impact functions have a second prompt in the UI to confirm. To have it recognize the action I have to be about 8-10" away from the mic which I know doesn't make it practical at all, but that also depend on mic placement and quality.
|
Author: | mjl [ Tue Apr 15, 2008 10:43 pm ] |
Post subject: | |
Hi Gnarl, For what it is worth, I like it also ![]() sphinx-2-bin typo should be sphinx2-bin Could you throw in some of the lower level stuff, like how to activate what is required to run to make it work from a boot? I have a friend who is totally blind and something like this could just be awesome for him! Km is not just a "toaster", it rocks ![]() Thanks Mike |
Author: | Gnarl [ Tue Apr 22, 2008 12:39 pm ] |
Post subject: | |
I fixed the above typo and here is a startup script that I altered from something else. Copy and past it into /etc/init.d/perlbox. Code: #! /bin/bash Make it executable with# # motion Start the motion detection . # NAME=perlbox PATH=/bin:/usr/bin:/sbin:/usr/sbin DAEMON=/usr/bin/perlbox-voice PIDFILE_1=/var/run/perlbox-voice.pid LOGFILE="/var/log/perlbox_$(date +%Y%m)" trap "" 1 export LANG=C export PATH test -f $DAEMON || exit 0 case "$1" in start) echo "Starting voice detection : $NAME" echo "-----------------------------------------------------------------------------------" >> $LOGFILE perlbox-voice --nogui >> $LOGFILE 2>&1 & sleep 5 echo `ps axf | grep -v grep | grep pbox | head -n1 | awk '{print $1}'` > $PIDFILE_1 ;; stop) echo "Stopping motion detection : $NAME" kill $(cat $PIDFILE_1) kill $(ps axf | grep -v grep | grep sphinx2-continuous | head -n1 | awk '{print $1}') rm -rf $PIDFILE_1 2> /dev/null ;; status) echo "Status motion detection : $NAME" if (test -f $PIDFILE_1); then echo -n "Running process for $NAME : " cat $PIDFILE_1 else echo "Stopped" fi ;; *) echo "Usage: /etc/init.d/$NAME {start|stop|status}" exit 1 ;; esac if [ $? == 0 ]; then echo . exit 0 else echo failed exit 1 fi Code: chmod 755 /etc/init.d/perlbox One thing I didn't mention before was that you will have to make the above scripts executable also with Code: chmod 755 <scriptname> To add it to startup runCode: update-rc.d perlbox defaults 99
|
Author: | Gnarl [ Tue Apr 22, 2008 2:02 pm ] |
Post subject: | |
Because the above startup script runs the application as root you will need to make a shortcut in roots folder to the config file for perlbox-voice Code: ln -s /home/mythtv/.perlbox-voice /root/
|
Author: | tjc [ Tue Apr 22, 2008 5:21 pm ] |
Post subject: | |
Gnarl wrote: Make it executable with Code: chmod 777 /etc/init.d/perlbox One thing I didn't mention before was that you will have to make the above scripts executable also with Code: chmod 777 No, don't do that. Please use the appropriate permissions rather than the "'cleaning' the car windows by knocking them out with a sledgehammer" approach. Code: chmod 755 /etc/init.d/perlbox Or better still use the symbolic form: Code: chmod u=rwx,go=rx /etc/init.d/perlbox
Every time I hear someone spreading this bit of evil misinformation it makes me want to knock them to the ground and tattoo the appropriate version of the command on the inside of their eyelids with glow in the dark ink. ![]() |
Author: | Gnarl [ Wed Apr 23, 2008 11:02 am ] |
Post subject: | |
tjc wrote: Every time I hear someone spreading this bit of evil misinformation it makes me want to knock them to the ground and tattoo the appropriate version of the command on the inside of their eyelids with glow in the dark ink.
![]() Point taken... my eyelids are still in pain |
Author: | mjl [ Wed Apr 23, 2008 7:40 pm ] |
Post subject: | |
Hi, typo I think: Code: right) $SCRIPTHOME/voiceright-.sh >> /dev/null;;
voice-right Mike |
Author: | Gnarl [ Thu Apr 24, 2008 9:56 am ] |
Post subject: | |
mjl wrote: Hi, Fixed.
typo I think: Code: right) $SCRIPTHOME/voiceright-.sh >> /dev/null;; voice-right Mike I should probably check my script also ![]() |
Author: | mjl [ Thu Apr 24, 2008 10:22 am ] |
Post subject: | |
Hi Gnarl, At least you know someone is at least looking at your scripts ![]() Just for reference, it listens about as well as my kids with about the same responses,"I Don't Understand" get that one a lot, along with "You Didn't Tell Me...." ![]() Thanks Mike |
Author: | Gnarl [ Tue May 20, 2008 12:28 pm ] |
Post subject: | |
Update startup script. |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |