espeak-ng
A Python bindings library for the eSpeak NG utility, which is a compact open source software text-to-speech synthesizer with distributions for all major operating systems.
Platform support:
| Support | Platform | Architecture | Notes |
|---|---|---|---|
| ✅ | MacOS | arm64 | Tested with M1 |
| ✅ | Linux | arm64 | Tested with Debian (Ubuntu) |
Dependencies
This library provides Python bindings for the underlying espeak-ng
(or espeak), so obviously, you must have this library
installed. Follow instructions below for platform-specific
instructions.
MacOS (using brew)
$ brew tap justinokamoto/espeak-ng
$ brew install espeak-ng
Debian (Ubuntu)
# Install espeak library and headers, along with Python's C API headers
$ apt install libespeak-ng-dev python3-dev
Installation
Provided you have installed the required dependencies described from the previous section, you can download this Python package from the Pythin Package Index:
$ pip install espeak-ng-python
Usage
For all functions that this library wraps, it provides a near 1-to-1 wrapper interface, where all parameters are provided with identical names. Only difference being that wrapper functions throw exceptions rather than returning error codes (which is the more 'Pythonic' way of error handling).
For more in-depth documentation you can read the comments within the extension source code here: src/espeak_ng/extension/_espeakngmodule.c
Quick Start
Synchronous Mode
import espeak_ng
# Initialize the espeak library
espeak_ng.initialize()
# This function will return after synthesis is complete
espeak_ng.synth("Hello, world.")
Asynchronous Mode
espeak offers a async interface. Below is an example snippet using
this interface:
import espeak_ng
# NOTE: It's important to return 0 on success, otherwise synthesis will stop
def my_callback_func(wav: bytes, num_samples: int, event: espeak_ng.Event) -> int:
# ... my code here
return 0
# Initialize the espeak library in an asynchronous output mode
espeak_ng.initialize(output=espeak_AUDIO_OUTPUT.AUDIO_OUTPUT_PLAYBACK)
# This function will return immediately and the callback will be triggered as the synthesis
progresses
espeak_ng.set_synth_callback(my_callback_func)
Configuration
espeak supports various languages. To see all available options, you can list all voices:
import espeak_ng
espeak_ng.list_voices()
To configure the voice, you can use the set_voice_by_properties function. Examples below:
import espeak_ng
espeak_ng.set_voice_by_properties(name="en-us")
espeak_ng.set_voice_by_properties(gender=1)
espeak_ng.set_voice_by_properties(age=30)
Building Locally
Install dependencies from the above "Dependencies" section. Then build this package using pip:
# Use pip to build in development (`-e` is for 'editable install')
$ pip install -e .
To run tests, use the helper runtests script:
$ python3 -m runtests
To build a local distribution archive, run:
$ pip wheel .
Metadata
Release files for espeak-ng-python 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| espeak-ng-python-1.0.5.tar.gz | 23.0 kB | Without provenance | Details for espeak-ng-python-1.0.5.tar.gz |
Release files / espeak-ng-python-1.0.5.tar.gz
| Download URL | espeak-ng-python-1.0.5.tar.gz |
|---|---|
| Size | 23.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb4953b632eb112e03d1d0c5230f74eb4c251824ec882e1f231521dd03f7af9c
|
|
BLAKE2b-256 checksum How to use checksums |
3ce919ef02251746f2cff22f1e6a93af6a90ac9c2bd5ec7da5cad37ee9175708
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.1
|
Security for espeak-ng-python 1.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.