StevenHickson / PiAUISuite

Raspberry PI AUI Suite
Other
695 stars 210 forks source link

Google stopped the TTS service, the PiAUISuite won't work #56

Open r-hassan-zz opened 8 years ago

r-hassan-zz commented 8 years ago

Hello Steve,

It took 3 days to figure out tts script is not working.

Seems like google has blocked that service when its used by automated scripts. https://support.google.com/websearch/answer/86640

Can you please update like Jasper?

Thanks.

Raqueeb Hassan Bangladesh

HangLoooose commented 8 years ago

I followed all instructions given by @krist-jin Now speech-recog.sh kann translate my voice into the correct text and tts says whatever you want it to say. But as soon as I start voicecommand and say my keyword the following lines appear:

Found audio Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 32000 Hz, Mono % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 25258 0 14 100 25244 9 16760 0:00:01 0:00:01 --:--:-- 16762 No translation

I changed the sample rate as @saikrishna321 suggested but it still says "No translation".

Can anyone help me to fix this issue?

irsx02 commented 8 years ago

@saikrishna321 - Ok, your issue is a unique one that I haven't seen before. I'm wondering, after it says "yes sir" and waits for command, does it take a new command?

@SweeneyToddTheDemonBarber - Just as SaiKristna321 states, what was the result when you run speech-recog.sh? What is the one letter you mention? And does the "who made you?" command work in your situation? (does it respond with "I was created by Steven Hickson?")

@HangLoooose - I'm betting on the "No translation" issue is coming somewhere in the VoiceCommand.cpp file. Did you make changes to the code? Spaces can affect what is sent to google. And, if all else fails, you can try reinstalling the whole thing. (see instructions to saikristna321 on what to do after re-installing)

saikrishna321 commented 8 years ago

@irsx02 ya it does take new command.. it was just the first time i called the keyword. Post that any sound like hand clap also it responds as Yes Sir!, has this got something to do with threshold

voicecommand -c
Opening config file...
running in continuous mode
keyword duration is 2 and duration is 2
Found audio
Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 32000 Hz, Mono
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 62769    0   189  100 62580    113  37609  0:00:01  0:00:01 --:--:-- 37608
command: tts "I was created by Steven Hickson" 2>/dev/null
Found audio
Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 32000 Hz, Mono
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 57452    0    14  100 57438      9  38577  0:00:01  0:00:01 --:--:-- 38574
No translation
Found audio
Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 32000 Hz, Mono
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 58153    0    14  100 58139      9  40092  0:00:01  0:00:01 --:--:-- 40123
No translation
Found audio
Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 32000 Hz, Mono
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Jrodseth commented 8 years ago

@saikrishna321 Make sure your config file has verify set to 1 and it isn't commented out. !verify==1 This insures the keyword is found before asking for a command. When you start voicecommand, you should see the line verifying command as well

That being said, I haven't been able to get it to recognize any keyword when it's verifying. speech-recong.sh shows it's recording, but I never get a Found audio trigger.

Edit: Fixed the trigger word not being recognized. I had forgotten to run make after editing the .cpp file. Ran make and reinstalled, works like a charm now!

saikrishna321 commented 8 years ago

@Bokaj707 when i have the !verify==1 i dont hear the command Yes Sir!, once that is commented i hear it back ..

SweeneyToddTheDemonBarber commented 8 years ago

Hey guys @saikrishna321 @irsx02 , thanks for your responses. I got everything working with pico2wave, having changed tts. ./speechrecognition.sh works perfectly. The problem I have is that any sound triggers the keyword. I've used words with different syllables (current one: Hello Perkins) and yet if I clap it stills triggers the keyword. :(

As for the One letter, I'm trying to add my Spotify music (through mpd) and when I search for an artist it only looks for the first letter of their names. I started looking into it so I made a new command: repeat $1==tts $1 This only says the first letter of the word/phrase. I started adding more variables ($2...$5) and they keep spelling the word I''ve said. Example: repeat $1==tts $1 I say: Repeat What day is it the program answers: W repeat $1$2$3==tts $1$2$3 I say: Repeat What day is it the program answers: W H A

But my main concern is the first one, where anything triggers the keyword. Thanks!

SweeneyToddTheDemonBarber commented 8 years ago

Guys we DID IT!!!! After many tries we finally did it. The trick was that I had to make the file after editing voicecommand.cpp. It's been working great. As for my second problem I found a solution. you have to put the $1 before a command and it works. Thanks

saikrishna321 commented 8 years ago

@SweeneyToddTheDemonBarber can you please post your tts file and how does your command look when its $1 ? Does this solve the trigger of voicecommand for any keyword?

scoobyd00 commented 8 years ago

Its taken me all day but i finally got voicecommand compiled and 99% working on my PI 2.

It responds to my voice, finds my keyword and performs the command succesfully. If i say pi and then who made you it responds and speaks :)

The only issue i have is after ive said my keyword 'pi' it doesnt respond with 'Yes Sir', ive checked my config file and its correct in there. Voicecommand does wait after my keyword and then accepts my command but i just dont get the spoken 'Yes Sir' through the speakers.

Any ideas?

do i need to run voicecommand with the -l en parameter?

Not at my pi at the moment to test for a few days.

irsx02 commented 8 years ago

@scoobyd00 Just wanted to see if you could check on a few things. First, at the command prompt, if you run

tts "hello world"

Can you hear your Pi talk?

Next, if you edit .command.conf in your root directory, do you see

!response==Yes Sir?

Or exactly what is located after the = sign?

scoobyd00 commented 8 years ago

@irsx02

Thanks for your help.

tts commands work fine and i can hear speech output through the speakers. If I ask voicecommand 'who made you' it replies with the correct speech output.

I've got response set to ==Yes Sir?

I just don't hear when I've spoke my keyword. For some reason tts is working but it's not responding with yes sir

Ive tried voicecommand -r Yes but i get no output with that either.

scoobyd00 commented 8 years ago

@irsx02

Fixed the issue!.

My own silly fault, had a slight coding error in the script you provided. I had eu-US instead of en-US.

Works perfectly now, thanks :)

wildbi111 commented 8 years ago

My problem is as follows: 1 - First, confirm your mic works (arecord/aplay) <-- It Works 2 - run tts "your message here" - Speaker should say "your message here" <-- This Works 3 - run ./speech-recog.sh <-- This Works 4 - run voicecommand -c - speak your response word, then after VoiceCommand says "yes sir" say "who made you" VoiceCommand should reply with Steven Hickson <-- This is where it fails

I have reinstalled several times, I've added picotts and it works fine. I've modified voicecommand.ccp as recommended and done the same for speech-recog.sh. I've replace tts with the the script that uses pico2wave and that works. So I'm at my wit's end - never hear any response (i.e. "Yes Sir"). Any suggestions would be appreciated. TIA

irsx02 commented 8 years ago

@wildbi111 From your description, having done steps 1,2,3 correctly, i would expect step four to work.

First thing I can think of, is for Step 3, did you use your response word? And did speech-recog.sh identify your response word correctly?

Next, did you ever get step 4, run voicecommand -c, to recognize your resopnse word and replay at any point? One annoying thing I have found is that voicecommand really listens for ~3 seconds, and uploads your voice for ~1 second. If you speak during that 1 second, nothing happens. (This is done on a raspberry pi 3)

I've found that when you see the "Received %" go from 0%-100% , VoiceCommand is not listening at that moment. Its uploading sound to Google's servers. If you can time it right, I've noticed that you have to speak after seeing 100 finish and when a new line appear.

I'm hoping that is it. give it a try

scoobyd00 commented 8 years ago

@wildbi111

If your not getting the 'Yes Sir' reply, double check the 2nd script that @irsx02 made.

This one;-

!/bin/bash

since google ended TTS, this wrapper-script replaces tts with pico2wave.

version 0.2 -now rudimentarily handles language -l param.

etc etc

I had a typing error in mine and this is what stopped my system from saying 'Yes Sir'.

wildbi111 commented 8 years ago

@scoobyd00 I checked and I was using the version 0.2 of the tts script.

@irsx02 Ok, I'm much further along and can get it to speak the response "I was created by Steven Hickson" but when I say the keyword I get: Attempting to answer: Pi Could not find answer. Try again.

I can get responses to the ~ lines in the .commands.conf file but the keyword always fails. I've tried several other keywords but no joy.

This is the default config file

These are the special options you can set (remove the #)

!keyword==pi !verify==1 !com_dur==3

!filler==0

!thresh==0.7 !continuous==0 !response==Yes Sir? !quiet==0

!ignore==0

!filler==0

!duration==3 !com_dur==3 !hardware==plughw:1,0

Here are the commands

~weather==/home/pi/AUI/Misc/sayweather.sh

~made you==tts "I was created by Steven Hickson" 2>/dev/null ~hello==/bin/echo "Hello" ~wall-e==/usr/bin/mpg123 /home/wildbill/walle_tada.mp3 ~date==/usr/bin/tts /bin/date '+%A %d %B %Y'

irsx02 commented 8 years ago

@wildbi111 this one is a bit of a far fetched answer; but see if you could change your keyword from Pi to something like "Computer" or "Raspberry" The reason I can think of is that sometimes "Pi" can be intrepreted as Hi. . . which then gets ignored by VoiceCommand.

wildbi111 commented 8 years ago

@irsx02 - I did change the keyword and it still does not recognize the keyword but it does recognize the ~ commands so I'm still troubleshooting that.

Also, is there any documentation on the various ~ commands?

irsx02 commented 8 years ago

@wildbi111 The closest documention to the ~ command can be found at http://stevenhickson.blogspot.com/2013/06/voice-command-v30-for-raspberry-pi.html

This is the creator's personal website, with a bit of help on how to use his program.

lowdev commented 8 years ago

https://github.com/lowdev/PiAUISuite/tree/fixTts

siddharthksuri commented 8 years ago

Hello All, I read through the entire conversation to figure out how to get my setup working. I initially had both issues 55 & 56. After a long day, I managed to resolve Issue 55.

Now I can record my voice, and execute commands based on speech recognition. What I want to get now, is the talkback (TTS). From the conversation, it appears there are multiple solutions to this- one of which is to replace Google TTS with Pico2Wav.

Could someone succinctly explain if using Pico2Wav is common to all solutions? Or is there anyway to get Google TTS working? or perhaps another third party TTS (Festival/Espeak) that is easier to install?

Which file(s) should I modify?

I'm mainly interested in the verify feature, with the following use case: Me; "Adam" R-Pi: "Hello" Me: "play a song" R-Pi: plays song

I'm using Raspberry Pi 3 Model B, with Raspbian Jessie. I'm planning to use this for an audio project, without a display. So getting the confirmation is important. Many thanks in advance.

siddharthksuri commented 8 years ago

UPDATE:

The branch by @lowdev did the trick for me. I'm getting some limited functionality. I have been able to get both TTS, and STT working, by just using his .cpp file to make VoiceCommand and reinstall PiAUISuite. I did not install Pico2Wav.

No running into some trouble with the google and youtube commands.

Colin1964 commented 7 years ago

@lowdev @irsx02 Thanks to you two I have got both Pico2Wav and Google API versions of TTS working sweet as a nut and "Gladys" is all linked up to Wolfram Alpha and chatting away nicely. At the risk of sounding ungrateful though I was hoping you could help me tweak the TTS code so that it recognises a " | " {Vertical Bar} and replaces this with a null character. I presume because of the format of the response from Wolfram and google they use " | " as a separator however this means Gladys responds with "Vertical Bar" nearly every other word!!! I am trying to improve my bash skills but this is a bit beyond me at the moment.

irsx02 commented 7 years ago

@Colin1964 - Its not ungrateful if its an improvment. And improvements are always welcomed.

Unfortunately, I've been rather busy as of late and can't help too much. If you look here http://stackoverflow.com/questions/13210880/replace-one-substring-for-another-string-in-shell-script it'll describe how to change a string.

Look for example with three lines of code, and a mention of first/second You'll want to find instances of | and replace it with just a space " "

good luck hunting.

Colin1964 commented 7 years ago

@irsx02 Much appreciated. I'll take a look - probably just the prod I need to stop being lazy and trawling forums and instead get my coding skills improved. I'll let you know how I get on! Also. thanks for confirming the lang en-us issue for @mathijsvandenhurk over on #76

Colin1964 commented 7 years ago

@irsx02 Not sure if I made this more difficult than I needed to but I ended up adding a line to voicecommand.cpp to stop Gladys saying "Vertical Bar". The line I added is the "replace_all" line shown in the extract below for anyone interested. All working and can now put another notch on my C++ coding stick!

   if (result.empty()) {
                    BOOST_FOREACH( ptree::value_type const& v, pt.get_child("queryresult") ) {
                            if (v.first == "didyoumeans") {
                                result = v.second.get<string>("didyoumean");
                                printf("No luck, will try with %s\n", result.c_str());
                                return Search(result.c_str());
                            }
                }
                    printf(" Using Boost_Foreach Could not find answer. Try again.\n");
                Speak("Using Boost_Foreach Could not find answer. Try again");
                } else {
                result = from_html_entities(result);
                replace_all(result, string("|"), string(" "));
                printf("%s \n", result.c_str());
                Speak(result);
                return 0;

`

tr1plus commented 7 years ago

I have been trying to get this thing to work and I am running into the same issues mentioned in this chain. I have attempted to implement the changes required and got the individual parts working:

sudo ./speech-recog.sh Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 43391 0 156 100 43235 72 20131 0:00:02 0:00:02 --:--:-- 20146 "hello world" Speech recog is working by changing the file... CHECK

tts "hello world" Outputs the text to my speakers, also done by making the mentioned changes to the file... CHECK

Now I understood I have to make changes to the voicecommand.cpp file. However making ANY change to this file (adding space and putting it back) then compiling (and installing) breaks everything. Voicecommand returns me either nothing (when running it with sudo) or "illegal instruction" when running it without sudo. This means I cannot make the required changes to this file... NO CHECK

Has anyone come accross this issue? Is my compiler broken? I find it very weird that making no changes to the file would break it after running "make".

I honestly have no idea anymore what to do as I think I have tried all the things mentioned in this chain. I would appreciate if anyone could shed some light on the situation...

Thanks in advance

Colin1964 commented 7 years ago

@tr1plus I think you're problem is that you are doing a full re-install after making changes to voicecommand.cpp. Unfortunately this will re-install the original versions of speech_recog.sh and tts and overwrite the changes you have just made!!! Go back and redo the changes to speech_recog and tts. Then update voicecommand.cpp following the instructions and run sudo make. After the make completes succesfully copy the new file to the \usr\bin folder. Do not run the full PiAUIInstall. sudo cp \usr\bin voicecommand Now just run voicecommand and you should be in business!

tr1plus commented 7 years ago

@Colin1964

Okay guys... I have figured out the issue... 20 minutes after posting this. Due to my previous post I realized the compiler must be different as I am compiling on a pi zero (ARM6) Changing the makefile to the following fixed that issue at least. Now 1 more issue remaining :)

CC := g++-4.8 -march=native -mfpu=neon-vfpv4 -mfloat-abi=hard instead of CC := g++-4.8 -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard

Maybe you can also help with that (haven't look into it, will do that in the meantime too) I get no reply after I speak the code word. But it works when I see console and it is able to answer my commands

Final edit: Changes made to tts (second script provided). Everything is working now. Sorry for posting here but this helped me think it seems. Solved everything. Biggest issue was the ARM6 compile :)

Colin1964 commented 7 years ago

@tr1plus A lot of people seem to struggle to get the keyword and response working (verify mode). Have you looked through suggestion in #76, especially if you are not running in continuous mode. Also check your mic threshold value in .commands.conf (see #63). I found that minor changes in threshold value would either result in Pi detecting audio all the time but (audio is distorted??) So not registering as keyword (threshold too low) or Pi just sits there waiting for you because it can't 'hear you' (threshold too high)

tr1plus commented 7 years ago

@Colin1964 I have resolved the issue (see post above). I accidentally skipped one step for the tts changes. Biggest lesson learned is the compilation tho. ARM6 devices require a different make file :)

Thanks for looking into it tho :)

diegodeodati commented 7 years ago

Hi everyone i have no audio from my raspberry pizero... aplay and arecord works fine but no audio when i use voicecommand... can anyone help me?

gymolnargabor commented 7 years ago

Hi guys, Could someone write a step-by-step tutorial about the installation? Sorry, I'm not really an expert on linux, I didn't have time last year to check what changed, but as I see it is not so simple anymore (like about 3 years ago). It would be really nice see everything on 1 site, if it is possible.

Zylvian commented 5 years ago

@Colin1964 I have resolved the issue (see post above). I accidentally skipped one step for the tts changes. Biggest lesson learned is the compilation tho. ARM6 devices require a different make file :)

Thanks for looking into it tho :)

I replaced the TTS script and still get nothing, any idea what I might have skipped?