Skip to main content

Python interface for eSpeak NG

Project description

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

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.

Author

Guenter Bartsch <<guenter@zamia.org>>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-espeak-ng-0.1.7.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

py_espeak_ng-0.1.7-py2.py3-none-any.whl (6.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file py-espeak-ng-0.1.7.tar.gz.

File metadata

  • Download URL: py-espeak-ng-0.1.7.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for py-espeak-ng-0.1.7.tar.gz
Algorithm Hash digest
SHA256 53f320112dbb513a2b4e5936252893f3a8743f4b9389af4980de686ec8074f1c
MD5 e5a099a4f2a12271972270e2f3ef8f91
BLAKE2b-256 c30bc53bed143a7b04d19e3c85f937ebf97ae552bb668b2d6690567752ee52e6

See more details on using hashes here.

File details

Details for the file py_espeak_ng-0.1.7-py2.py3-none-any.whl.

File metadata

  • Download URL: py_espeak_ng-0.1.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for py_espeak_ng-0.1.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 46215edad0e1de0c2e865ef528c746d0c8e9d6671e9093c9c39b5077dc18b7a4
MD5 a772c3f017cd07d82b21f5e718b8fba4
BLAKE2b-256 b382b30fd97d8044f54b8244c6b5b968a4d641b624a970192cdef48afccd43d5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page