Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 03 Sep 2014, 00:45
All times are UTC - 4
 Forum index » Advanced Topics » Puppy Projects
Chatterbox - STT / TTS / TTA project. Part 2
Moderators: Flash, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 5 of 6 [89 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6 Next
Author Message
greengeek

Joined: 20 Jul 2010
Posts: 2512
Location: New Zealand

PostPosted: Fri 18 Oct 2013, 01:57    Post subject:  

Yes, I think the next step involves extending the functionality. I do have some issues I want to look at more closely before I continue - for example I found that if I manually cleared the chatdump.txt file it stopped sphinx from doing any further updating to that file so I want to resolve why that is.

I also want to fine tune the code so that the script that reads the extracted command also clears the extracted_command.txt file (or "voice_prompt" or whatever we want to call it...) ready for the next extraction. (I think that step is pretty easy using sed)

One of the things on my list is to flesh out the first few posts in each of these chatterbox threads so that the important info is viewable without searching too far.

I also want to find ways to improve the integrity of word / phrase recognition so that it is possible to offer this as a pet which is reliable enough to make it pretty easy for new users to set up their own preferred command set/function at boot time, even if it is only for a single function.

In terms of what to do next I am keen to keep a similar informal format as this simple project but do two main things:
1) Produce a number of vocab files that are tailored for more reliable word recognition and with a word set that is appropriate to various specific functions (eg: a post-boot/main menu command set and/or vocab list, a browsing-specific set, and maybe a dictation set. Probably also a FileManager set.

2) I want to create scripts that allow a more interactive and multilevelled menu./protocol system eg: after boot I feel the computer should ask something like the following:
"Please choose between Music, Browsing, File Manager or Puppy menu" Once the user chooses their preference the main menu would hand control to the next menu and so on.

I have a few experiments in mind to test out what is possible so I hope to launch into those in the coming days. Feel free to suggest your own suggestions or preferences. The more thoughts the better...

EDIT: decided to start part 4 here:
http://murga-linux.com/puppy/viewtopic.php?t=89360
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4348

PostPosted: Fri 18 Oct 2013, 20:09    Post subject:  

My sound doesn't work in Linux on 1 computer without a lot of manual setup and the other has a really crappy mic, but I think I can program it blind.

To make it a bit trekky, I will call my generic command "computer" so that it only "does stuff" when you begin your sentence with "Computer ..."

Code:
computer(){
    case $1 in
        open)shift; which $1 && $@ || text2speech "I can't find that program.";;
        disregard)exit;;
        *)text2speech "I can't handle the $@ command yet.";;
    esac
}

pocketsphinx_continuous $SOMERANDOMOPTIONS |while read ROW COMMAND ARGS; do
case "$ROW$COMMAND" in
    [0-9]*:computer)$COMMAND $ARGS;;
    [0-9]*:dictate)[ "$DICTATE" ] && DICTATE="" || DICTATE=true ;;
    [0-9]*:*)[ "$DICTATE" ] && echo $COMMAND $ARGS >>$HOME/dictations
esac
done

for the text2speech try one of these:
http://www.murga-linux.com/puppy/viewtopic.php?p=573601#573601

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Ted Dog


Joined: 13 Sep 2005
Posts: 2316
Location: Heart of Texas

PostPosted: Fri 18 Oct 2013, 20:39    Post subject:  

what about puppy in place of computer...

Puppy speak

Puppy fetch email

Puppy empty trash.. Wink
Back to top
View user's profile Send private message 
starhawk

Joined: 22 Nov 2010
Posts: 2845
Location: Everybody knows this is nowhere...

PostPosted: Fri 18 Oct 2013, 20:53    Post subject:  

"Puppy empty trash"...

...makes me think of this scene from Family Guy --> http://www.youtube.com/watch?v=17K6izfGMn0

LOL.

_________________
Loving X-Slacko 2.1!
Custom Build: HP MOCA-AR + Core2Duo T7200 + 4gb RAM + 256gb SSD
...just needs a pretty case Wink
Back to top
View user's profile Send private message 
H4LF82


Joined: 02 Oct 2012
Posts: 124

PostPosted: Fri 18 Oct 2013, 21:37    Post subject:  

Quote:
what about puppy in place of computer...
the only problem i have with that is that "puppy" sounds like all sorts of other words ending with the long E sound, and that could lead to problems.

the star trek computer is a good model to follow...and it has the advantage of being a four syllable word ending in a short R (uncommon) versus a two syllable word ending with the long E (very common). i see why you would suggest it though ted dog.

there are star trek computer sounds here...

http://www.starbase51.co.uk/starbase51/wav/wav.asp

andd technosaurus...we are using espeak, not text2speech. its already part of the package...

and a question....does the code you have there do this...

Code:
#!/bin/bash

#This is just a "proof_of_concept" to show that the user can provide verbal feedback to control an action
# Establish loop
condition_to_check="False"
while [[ ${condition_to_check} == "False" ]]; do

#allow time after boot:
sleep 5

#Ask the question:
espeak -f /root/Qplay.txt &

#Allow time for user to reply
sleep 7
#play a noise to indicate the user is finifhed recording
/usr/share/chatterbox/sounds/c811.wav

#Use sed to extract last 3 lines of chatdump.txt, pipe the result to awk which extracts the single word command
#and writes it to sed2awk_extract_command.txt
sed -e :a -e '$q;N;4,$D;ba' /root/chatdump.txt | awk '/^0000/  { print $2 }' > /root/extracted_command.txt

#use sed to extract the command word from the sed2awk_extract_command.txt file
#and call it the "command" variable
command=$(sed '$!d' /root/extracted_command.txt)

#Test if the command word equals the word we want to hear
#if [ $command=yes ]
if test "$command" = "computer"

then
condition_to_check="True"
#If there is a match then  make a noise to confirm:
mplayer /usr/share/chatterbox/sounds/c810.wav &
# espeak -f /root/Music.txt &
# delete the contents of the two text files
sed '/-Start/,/-End/d' /root/extracted_command.txt &
sed '/-Start/,/-End/d' /root/chatdump.txt &
# run the menu program
# ARGUEMENT to run menu program MISSING HERE!!

else
condition_to_check="False"
#     echo "Failed to process chat_command."
espeak -f /root/CommandFail.txt &   
fi


..i think we were doing the same thin at the same time and came up with 2 different ways to do it Very Happy i was going to add a second script for the menu of options beyond the word computer...

I also added the 'computer' sounds from the site above and put them in /usr/share/chatterbox/sounds

_________________
"The wise know their weakness too well to assume infallibility; and he who knows most, knows best how little he knows." - Thomas Jefferson
Back to top
View user's profile Send private message 
Ted Dog


Joined: 13 Sep 2005
Posts: 2316
Location: Heart of Texas

PostPosted: Fri 18 Oct 2013, 22:00    Post subject:  

When I see long case switch like this is becoming, I long for the old IBM REXX program.. It just was so GOOD at stuff like this.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4348

PostPosted: Fri 18 Oct 2013, 22:48    Post subject:  

H4LF82 wrote:
andd technosaurus...we are using espeak, not text2speech. its already part of the package...

and a question....does the code you have there do this...
....
..i think we were doing the same thin at the same time and came up with 2 different ways to do it Very Happy i was going to add a second script for the menu of options beyond the word computer...

I also added the 'computer' sounds from the site above and put them in /usr/share/chatterbox/sounds

I meant for text2speech to be shell function wrapper like the ones in my link. The ultralight espeak version I built only uses standard puppy libs (no portaudio, ...), so the wav output option can be sent to stdout and piped through aplay (I like the unix philosophy)
There are quite a few other examples in that post, reading html docs by stripping the tag, getting text from the clipboard (it gets filled every time you highlight something, so can be annoying unless you _need_ it) and a few more.
btw, I wonder if espeak's -f option would work like echo "my text" |espeak -f /dev/stdin

I'm sure my code is duplicated effort, but all the code I was seeing was becoming overly complex.

I bet it wouldn't be too difficult to use my .desktop file parsing code from jwm_tools (its in jwm_menu_create) to create a voice menu... and probably parse the PuppyPin or combine with wget to google stuff

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
H4LF82


Joined: 02 Oct 2012
Posts: 124

PostPosted: Fri 18 Oct 2013, 22:59    Post subject:  

Quote:
I meant for text2speech to be shell function wrapper like the ones in my link. The ultralight espeak version I built only uses standard puppy libs (no portaudio, ...), so the wav output option can be sent to stdout and piped through aplay (I like the unix philosophy)


...ooooh. i see now!...
Quote:

I wonder if espeak's -f option would work like echo "my text" |espeak -f /dev/stdin


...i dont know, but it says...

Quote:
If neither -f nor --stdin, then <words> are spoken, or if none then text
is spoken from stdin, each line separately.
in the helpfile, so id think it would.

Quote:

I'm sure my code is duplicated effort, but all the code I was seeing was becoming overly complex.


im still having trouble following along. were all going in the same direction tho i think...

Very Happy

_________________
"The wise know their weakness too well to assume infallibility; and he who knows most, knows best how little he knows." - Thomas Jefferson
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 2512
Location: New Zealand

PostPosted: Sat 19 Oct 2013, 02:48    Post subject:  

technosaurus wrote:
for the text2speech try one of these:
http://www.murga-linux.com/puppy/viewtopic.php?p=573601#573601

Hi technosaurus, I have just tried "speak" and wondered if the problem I experienced is normal - I have a text file called /root/Qplay.txt and it contains the following sentence:
"Welcome to puppy. Please say the word Music if you want me to play music"

If I use the syntax:
Code:
speak_files /root/Qplay.txt
it speaks the sentence as I would expect. However, if I use the following syntax:
Code:
speak /root/Qplay.txt
I get an error message telling me to use the -w option "because the program was built without a sound interface"

If I then use the following syntax:
Code:
speak -w /root/Qplay.txt
the txt file gets emptied and has no contents.

Is that what you would expect?
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4348

PostPosted: Sat 19 Oct 2013, 12:09    Post subject:  

greengeek wrote:
However, if I use the following syntax:
Code:
speak /root/Qplay.txt
I get an error message telling me to use the -w option "because the program was built without a sound interface"

If I then use the following syntax:
Code:
speak -w /root/Qplay.txt
the txt file gets emptied and has no contents.

Is that what you would expect?
IIRC the -w flag indicates the name for the output wav file.
The reason speak_* work differently is that I wrote my own puppy helper scripts to use stdout as the output file and piped them through aplay. You can still use speak -w /root/Qplay.wav -f /root/Qplay.txt && aplay /root/Qplay.wav, but it will take unecessary disk space and have additional delay compared to using stdout.

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 2512
Location: New Zealand

PostPosted: Sat 19 Oct 2013, 13:08    Post subject:  

H4LF82 wrote:

Code:
#!/bin/bash

#This is just a "proof_of_concept" to show that the user can provide verbal feedback to control an action
# Establish loop
condition_to_check="False"
while [[ ${condition_to_check} == "False" ]]; do
Hi H4LF82, does this addition mean that the "TEST FOR KEYWORD" is now going on continuously, or have I misunderstood.? (The one most important step I want to achieve at the moment is to get the keyword testing running continuously rather than just a single test/single action event)

Quote:
sleep 7
#play a noise to indicate the user is finifhed recording
/usr/share/chatterbox/sounds/c811.wav
"mplayer" has been inadvertently left off here right? Or are you using a different function somehow?

Quote:

# delete the contents of the two text files
sed '/-Start/,/-End/d' /root/extracted_command.txt &
sed '/-Start/,/-End/d' /root/chatdump.txt &
Nice touch. Have you been testing this script live or are you still in process of writing? I'm keen to know if the programmatic clearing of the file works correctly. When I manually clear the chatdump.txt I usually seem to get the outcome that sphinx stops writing to the file...

Quote:
I also added the 'computer' sounds from the site above and put them in /usr/share/chatterbox/sounds
We have a chatterbox directory in /usr/share? Oooooh, that sounds great! Almost like a REAL program now... Smile
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 2512
Location: New Zealand

PostPosted: Sat 19 Oct 2013, 13:13    Post subject:  

technosaurus wrote:
IIRC the -w flag indicates the name for the output wav file.
Just a heads-up for anyone else using "speak" then - don't do what I did and launch into reading your text file with the 'speak -w' syntax - in my case this WROTE to the textfile and I lost the contents. A minor problem in this case, but a different matter if it was an eBook... Smile

Use 'speak_files" to do the reading.
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 2512
Location: New Zealand

PostPosted: Sat 19 Oct 2013, 13:32    Post subject:  

technosaurus wrote:
To make it a bit trekky, I will call my generic command "computer" so that it only "does stuff" when you begin your sentence with "Computer ..."

Code:
computer(){
    case $1 in
        open)shift; which $1 && $@ || text2speech "I can't find that program.";;
        disregard)exit;;
        *)text2speech "I can't handle the $@ command yet.";;
    esac
}

pocketsphinx_continuous $SOMERANDOMOPTIONS |while read ROW COMMAND ARGS; do
case "$ROW$COMMAND" in
    [0-9]*:computer)$COMMAND $ARGS;;
    [0-9]*:dictate)[ "$DICTATE" ] && DICTATE="" || DICTATE=true ;;
    [0-9]*:*)[ "$DICTATE" ] && echo $COMMAND $ARGS >>$HOME/dictations
esac
done
Hi technosaurus - are you able to explain to my untrained brain a bit about what this is doing please? Is this MONITORING for the output from sphinx, or is this about PROCESSING the previously detected output? or maybe both?
(I'm still struggling with trying to get continuous sampling of the sphinx output...)
Back to top
View user's profile Send private message 
H4LF82


Joined: 02 Oct 2012
Posts: 124

PostPosted: Sat 19 Oct 2013, 13:56    Post subject:  

Quote:
H4LF82 wrote:

Code:
#!/bin/bash

#This is just a "proof_of_concept" to show that the user can provide verbal feedback to control an action
# Establish loop
condition_to_check="False"
while [[ ${condition_to_check} == "False" ]]; do
Hi H4LF82, does this addition mean that the "TEST FOR KEYWORD" is now going on continuously, or have I misunderstood.? (The one most important step I want to achieve at the moment is to get the keyword testing running continuously rather than just a single test/single action event)


yes. its wrapped up in a loop checking for condition-to-check to equal true; provided i dont include any syntax errors ... :/

Quote:
Quote:
sleep 7
#play a noise to indicate the user is finifhed recording
/usr/share/chatterbox/sounds/c811.wav
"mplayer" has been inadvertently left off here right? Or are you using a different function somehow?


not a different function. THIS IS MY PROBLEM. THIS is why I cannot program....its not that i cant program. i cannot see...so my code is chock full of errors and hangs up in the stupidest mistakes. im glad i gave you this code example now--it illustrates my point perfectly.

Quote:
Quote:

# delete the contents of the two text files
sed '/-Start/,/-End/d' /root/extracted_command.txt &
sed '/-Start/,/-End/d' /root/chatdump.txt &
Nice touch. Have you been testing this script live or are you still in process of writing? I'm keen to know if the programmatic clearing of the file works correctly. When I manually clear the chatdump.txt I usually seem to get the outcome that sphinx stops writing to the file...


you SHOULD not have to manually clear it now....but agaain i add the caviat that i cannot see, and i can guarantee there are errors in my code. triple checkmy code....

im glaad you like it tho Smile

_________________
"The wise know their weakness too well to assume infallibility; and he who knows most, knows best how little he knows." - Thomas Jefferson
Back to top
View user's profile Send private message 
H4LF82


Joined: 02 Oct 2012
Posts: 124

PostPosted: Sat 19 Oct 2013, 14:08    Post subject:  

Quote:
Quote:
I also added the 'computer' sounds from the site above and put them in /usr/share/chatterbox/sounds
We have a chatterbox directory in /usr/share? Oooooh, that sounds great! Almost like a REAL program now... Smile


...yeah, that was getting necessary. i have a sscript running somewhere in all of this tat is filling my root folder with blank directories every hour...ive rebooted from the live cd and started a new savefile just for this project, and since it now has its own sfs, it might as well be structured correctly too.

/ussr/share/chatterbox/ is now the directory for it, if there are no objections?

cheers!

_________________
"The wise know their weakness too well to assume infallibility; and he who knows most, knows best how little he knows." - Thomas Jefferson
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 5 of 6 [89 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Puppy Projects
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1252s ][ Queries: 13 (0.0057s) ][ GZIP on ]