Python Speech Libraries
Python Speech Libraries
sudo pip install pyttsx
Create the code speech1.py
import pyttsx
engine = pyttsx.init()
engine.say('The quick brown fox jumped over the lazy dog.')
engine.runAndWait()
And execute it with python.
Espeak
eSpeak is a compact open source software speech synthesizer for English and other languages, for Linux and Windows. We can install using:
sudo apt-get install espeak
Create the code speech2.py:
import os
os.system("espeak 'The quick brown fox'")
It is very easy to use, but like pyttsx it sounds very robotic.
GoogleTTS
I found a script on Github that uses the Google speech engine. The script comes with many options and does not speak, instead it saves to an mp3. We added a command to play the mp3 automatically:
os.system("mpg321 out.mp3 -quiet")
Run with:
python gtts.py -s 'Python programming example'
The voice is extremely natural. The only disadvantage is that you need to be connected with the Internet when running this script.
Conclusion
GoogleTTS is the most natural speech synthesis engine that we found. While other TTS engines are simple to use they simply do not match the sound quality. Sadly the number of available voices is limited.
Create the code speech1.py
import pyttsx
engine = pyttsx.init()
engine.say('The quick brown fox jumped over the lazy dog.')
engine.runAndWait()
1 2 3 4 | import pyttsx engine = pyttsx.init() engine.say('The quick brown fox jumped over the lazy dog.') engine.runAndWait() |
And execute it with python.
Espeak
eSpeak is a compact open source software speech synthesizer for English and other languages, for Linux and Windows. We can install using:
sudo apt-get install espeak
1 | sudo apt-get install espeak |
Create the code speech2.py:
import os
os.system("espeak 'The quick brown fox'")
1 2 | import os os.system("espeak 'The quick brown fox'") |
It is very easy to use, but like pyttsx it sounds very robotic.
GoogleTTS
I found a script on Github that uses the Google speech engine. The script comes with many options and does not speak, instead it saves to an mp3. We added a command to play the mp3 automatically:
os.system("mpg321 out.mp3 -quiet")
1 | os.system("mpg321 out.mp3 -quiet") |
Run with:
python gtts.py -s 'Python programming example'
1 | python gtts.py -s 'Python programming example' |
The voice is extremely natural. The only disadvantage is that you need to be connected with the Internet when running this script.
Conclusion
GoogleTTS is the most natural speech synthesis engine that we found. While other TTS engines are simple to use they simply do not match the sound quality. Sadly the number of available voices is limited.
Similar topics
» Python Reverse Speech
» Calculating Pi With Python
» Securing a Python Menu With Python Encrypted Password File
» Python Bootstrap
» how to setup julius voice control / speech engine on linux
» Calculating Pi With Python
» Securing a Python Menu With Python Encrypted Password File
» Python Bootstrap
» how to setup julius voice control / speech engine on linux
Permissions in this forum:
You cannot reply to topics in this forum
|
|