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.
Examples
### Direct TTS Audio Output
First, import the ESpeakNG engine wrapper:
from espeakng import ESpeakNG
now 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 = ‘english-us’ esng.say(“[[h@l’oU w’3:ld]]”)
### Synthesize Wave File without Playing It
>From Text:
import wave import StringIO
esng.voice = ‘english-us’ wavs = esng.synth_wav(‘Hello World!’) wav = wave.open(StringIO.StringIO(wavs)) print wav.getnchannels(), wav.getframerate(), wav.getnframes()
result:
1 22050 24210
### List Available Voices
l = esng.voices
result:
>>> 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'}
...
### Grapheme to Phoneme (G2P) Conversion
ipa = esng.g2p (‘Hello World!’, ipa=2)
result:
>>> print ipa həlˈo͡ʊ wˈɜːld
Links
<https://github.com/espeak-ng/espeak-ng> [eSpeak NG]
Requirements
Python 2 or 3
espeak-ng binary installed and in PATH
License
My own code is Apache-2.0 licensed unless otherwise noted in the script’s copyright headers.
Release files for py-espeak-ng 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py-espeak-ng-0.1.8.tar.gz | 11.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_espeak_ng-0.1.8-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 17.7 kB
Release files / py-espeak-ng-0.1.8.tar.gz
| Download URL | py-espeak-ng-0.1.8.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
749f7c802caf2d314e0091552c689325da31ded738bfdfef4c1ae0cb5ecfbddd
|
|
BLAKE2b-256 checksum How to use checksums |
5abf24720747e9cba86b971a4d47383ab162d5e9c27dccbae7730f728a64edac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.6.0 setuptools/2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.5
|
Release files / py_espeak_ng-0.1.8-py2.py3-none-any.whl
| Download URL | py_espeak_ng-0.1.8-py2.py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
f50bfdbfaf4f54a24019e7ef7d36bffe76d99e25875fc33d90912b394936c94b
|
|
BLAKE2b-256 checksum How to use checksums |
de84cef855b15184bfcc3666ece53399373d4dc02585b5206d8a4ab62ae1ad83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.6.0 setuptools/2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.5
|