Some simple wrappers around eSpeak NG intended to make using this excellent TTS for waveform and IPA generation as convenient as possible.
Target audience are developers who would like to use eSpeak NG as-is for speech synthesis in their Python application on GNU/Linux operating systems.
Constructive comments, patches and pull-requests are very welcome.
First, import the ESpeakNG engine wrapper:
from espeakng import ESpeakNGnow for some simple direct TTS output:
esng = ESpeakNG()
esng.say('Hello World!')lower pitch and speed:
esng.pitch = 32
esng.speed = 150
esng.say('Hello World!')try a different language:
esng.voice = 'german'
esng.say('Hallo Welt!')specify phonemes instead of words:
esng.voice = 'en-us'
esng.say("[[h@l'oU w'3:ld]]")From Text:
import wave
import StringIO
esng.voice = 'en-us'
wavs = esng.synth_wav('Hello World!')
wav = wave.open(StringIO.StringIO(wavs))
print wav.getnchannels(), wav.getframerate(), wav.getnframes()result:
1 22050 24210
l = esng.voicesresult:
>>> l[0]
{'pty': '5', 'language': 'af', 'gender': 'M', 'age': '--', 'voice_name': 'afrikaans', 'file': 'gmw/af'}
>>> l[1]
{'pty': '5', 'language': 'am', 'gender': '-', 'age': '--', 'voice_name': 'amharic', 'file': 'sem/am'}
>>> l[2]
{'pty': '5', 'language': 'an', 'gender': 'M', 'age': '--', 'voice_name': 'aragonese', 'file': 'roa/an'}
...
ipa = esng.g2p ('Hello World!', ipa=2)result:
>>> print ipa həlˈo͡ʊ wˈɜːld
https://github.com/espeak-ng/espeak-ng [eSpeak NG]
Python 2 or 3
espeak-ng binary installed and in PATH
My own code is Apache-2.0 licensed unless otherwise noted in the script’s copyright headers.
Guenter Bartsch <[email protected]>