Python bindings for a narrow subset of espeak
Project description
espeak_py
Native espeak bindings for Python.
This package provides performance-optimized bindings to the espeak library. Currently, this only provides text phonemization functions, not invoking full TTS.
On Linux, espeak is statically linked into the built wheel, but there is a runtime dependency on espeak-ng-data.
This can be satisfied by sudo apt install espeak-ng-data
(or the equivalent for your distro).
On Mac the data and necessary shared library can be installed with brew tap bplevin36/espeak-ng && brew install bplevin36/espeak-ng/espeak-ng --without-pcaudiolib --without-waywardgeek-sonic
. You will need to have XCode tools and GNU autotools installed (if they aren't already).
On macOS under ARM you will need to set export DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib
for the example to work, due to a failure at import to find the dynamic link as ARM homebrew lib directories aren't in the standard search path.
Usage Example
>>> from espeak_py import list_languages, text_to_phonemes
>>> list_languages()
['af', 'am', 'an', 'ar', 'as', 'az', 'ba', 'bg', 'bn', 'bpy', 'bs', 'ca', 'cmn', 'cs', 'cy', 'da', 'de', 'el', 'en-029', 'en-gb', 'en-gb-scotland', 'en-gb-x-gbclan', 'en-gb-x-gbcwmd', 'en-gb-x-rp', 'en-us', 'eo', 'es', 'es-419', 'et', 'eu', 'fa', 'fa-latn', 'fi', 'fr-be', 'fr-ch', 'fr-fr', 'ga', 'gd', 'gn', 'grc', 'gu', 'hak', 'hi', 'hr', 'ht', 'hu', 'hy', 'hyw', 'ia', 'id', 'is', 'it', 'ja', 'jbo', 'ka', 'kk', 'kl', 'kn', 'ko', 'kok', 'ku', 'ky', 'la', 'lfn', 'lt', 'lv', 'mi', 'mk', 'ml', 'mr', 'ms', 'mt', 'my', 'nb', 'nci', 'ne', 'nl', 'om', 'or', 'pa', 'pap', 'pl', 'pt', 'pt-br', 'py', 'quc', 'ro', 'ru', 'ru-lv', 'sd', 'shn', 'si', 'sk', 'sl', 'sq', 'sr', 'sv', 'sw', 'ta', 'te', 'tn', 'tr', 'tt', 'ur', 'uz', 'vi', 'vi-vn-x-central', 'vi-vn-x-south', 'yue']
>>> text_to_phonemes("The quick brown fox", language="en-gb")
'ðə kwˈɪk bɹˈaʊn fˈɒks'
>>> text_to_phonemes("Dale a tu cuerpo alegria, Macarena", language="es")
'dˈale a tu kwˈeɾpo alˈeɣɾia\nmˌakaɾˈena'
>>> text_to_phonemes("There's been a murder", voice_name="English (Scotland)")
'ðerz bˌiːn ɐ mˈʌɹdɜ'
Building
Requires Rust (and cargo) as well as GNU autotools and python packages maturin
and twine
On Mac GNU autotools can be installed with brew install libtool automake autoconf
- Clone (including submodules)
- Build espeak-ng in-tree with:
cd espeak-ng
./autogen.sh # First-time setup
./configure --without-klatt --without-speechplayer --without-mbrola --without-sonic --without-async
make
cd ..
- Build wheels with
RUSTFLAGS='-L espeak-ng/src/.libs' maturin build --release
(on Linux this requires the maturin docker container) - Install to local python with
pip install target/wheels/<generated_wheel_name>.whl
- Publish to PyPi using
twine
tools/build.sh will automate 1-3 for you if you have the correct tools configured, it is designed to work in a GitHub Action.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file espeak_py-0.1.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: espeak_py-0.1.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 410.1 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5624f4fc768344433c390ba2c607737425e823f4716ab107df72671f345b1208 |
|
MD5 | 5702ba0d2bc9df85de894b8a79f162cc |
|
BLAKE2b-256 | 638267bba71f2f0c7bbf7b3e7cb4732ce539fd34f381ec95cab4a0f5432fee3a |
File details
Details for the file espeak_py-0.1.8-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: espeak_py-0.1.8-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 204.8 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94f699d39cf0d79f7206c3708f532c3870bbf4cc13e29a5427320bb64440a879 |
|
MD5 | 581aedcea6dc04db042bc68571a89110 |
|
BLAKE2b-256 | cb4d6b5c2949205493042687e433e86013d149ffcf4f9799b5bc19908d198fa3 |
File details
Details for the file espeak_py-0.1.8-cp311-cp311-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: espeak_py-0.1.8-cp311-cp311-macosx_10_12_x86_64.whl
- Upload date:
- Size: 209.5 kB
- Tags: CPython 3.11, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 835c0092434641962ce1b5bbe3145836e534d48d483d2f933c7a6813bdabd5f1 |
|
MD5 | 0447576286894fcff30795089adaff31 |
|
BLAKE2b-256 | 384adfbacbc95be0123a82a69316c2646456941415e504c7808dcc13d1d6c70d |
File details
Details for the file espeak_py-0.1.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: espeak_py-0.1.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 410.1 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 634f6f9ce3f84c32909464328ee2bc1af6a861ba4114e9fb040e3c7613addb18 |
|
MD5 | 2ad826b34e614c6590493a9e56100e77 |
|
BLAKE2b-256 | 515b50ac7544033f4a528ef79dd68dc7c84536c976c958daaad5301ae156eb8e |
File details
Details for the file espeak_py-0.1.8-cp39-cp39-macosx_11_0_arm64.whl
.
File metadata
- Download URL: espeak_py-0.1.8-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 204.8 kB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c9a72b6d1922a6d7a12021d076d7a06bba5971b3107cd5d99832e87abdd62dc |
|
MD5 | 6e7cae0ed0605f80d6b87665ccff5463 |
|
BLAKE2b-256 | 1b65eba86800a0fb4d484821afe255fcf279e4eca511c9886a15047305ddce89 |
File details
Details for the file espeak_py-0.1.8-cp39-cp39-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: espeak_py-0.1.8-cp39-cp39-macosx_10_12_x86_64.whl
- Upload date:
- Size: 209.5 kB
- Tags: CPython 3.9, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 934e55357512e2ca85f23871a1c991bc1d2fa6b1119133542384ddd33e525938 |
|
MD5 | 9aa2ec2471ec2b36a664b94114ac180c |
|
BLAKE2b-256 | 93c77b1eb6eab3073344b75ca343c05b17b1f81b21f7863282b126aa50276706 |