[SOLVED] Speech to Text Error in speak_text.py file

There is something wrong with the speak_text.py file.

It doesn’t work. It merely takes in the input and prints the output.
It does not speak. The speak_count.py file works perfectly. I suspect its something wrong with cmd-end or cmd_out. If someone could fix this that’d be great. I’m still trying to figure it out

1 Like

Hi @amkhan,

Here is my version of speak_text.py and speak_count.py that fix the problems, allow use without sudo, provide greater protection from quotes and apostrophes, and enables using espeak options to set speed and voice.

I made a speak.py module to generalize using TTS in my robot code as:

import speak

text = "I am a vociferous talker, but I can't hear myself speaking"
speak.say( text )

Hello @amkhan

What type of tests have you done so far?
Have you tried :
aplay /usr/share/sounds/alsa/* to see if you can hear anything from the speaker?

And does this work?
espeak "Hello World"

Cleo

Hi Cleoqc,
I am a bit late in the game but I also have the same problem as amkhan. I ran the Speak_text.py which did not output my text word. It did write the sound file to the desktop but did not play it. If I type aplay /usr/share/sounds/alsa/* that will play the word ‘front center’. If I write espeak “Hello World” it does not say anything but writes a lot of errors related to the Unknown PCM card and many other errors. Can you help ?

try:

sudo apt-get remove -y espeak
sudo apt install -y espeak espeak-ng python3-espeak speech-dispatcher-espeak

and use espeak-ng instead of espeak

Cleo

1 Like

Hi Cleoqc,

Works like a charm.

Would be nice if the old program on Github had a comment to inform that the espeak-ng is the latest or maybe I did not see it since relatively new user on Github.

Thanks

2 Likes