espeak-english
English text to IPA, with libespeak-ng bundled. No apt install espeak-ng, no
brew install, no system dependency of any kind.
pip install espeak-english
import espeak_english
espeak_english.phonemes("Good morning and welcome to the news.")
# 'ɡˈʊd mˈɔːɹnɪŋ ænd wˈɛlkʌm tə ðə nˈuːz'
espeak-english "The Bank of Ghana raised the policy rate."
# ðə bˈæŋk ʌv ɡˈɑːnɚ ɹˈeɪzd ðə pˈɑːlɪsi ɹˈeɪt
660 KB installed: a stripped libespeak-ng plus the eight data files English needs, out of the
~31 MB a full espeak-ng install carries for 130 languages.
Why this exists
TTS and ASR models trained on espeak's phonemes need exactly the phonemes they were trained on at inference time. A front-end that disagrees with training does not raise an error — it produces fluent, confident, wrong output. The project this was built for measured that once: a front-end differing from its training targets on 51% of units scored 68.6% phoneme error where the matching one scored 25.6%.
That makes espeak a reproducibility problem, and apt install espeak-ng an unreliable answer to
it, because which espeak you get depends on your distribution and when you installed it.
Two things this gets right, both measured
The version is pinned to espeak-ng 1.51. espeak's English output is not stable across releases. Over 1,505 words and sentences from a real corpus:
| against 1.51 | differs on | example |
|---|---|---|
| espeak-ng 1.52 | 7.1% | biara → biʲˈɑːɹə (a palatalisation mark 1.51 does not emit) |
| espeak-ng 1.53 | 2.4% | before → bᵻfˈɔːɹ instead of bᵻfˈoːɹ |
Neither is a bug upstream. Both are wrong here. If your model was trained against a different
version, build from that tag instead — ESPEAK_VERSION=1.52 bash tools/build_espeak.sh — and
regenerate the golden file. Do not mix.
The output matches the CLI exactly, which the obvious API call does not. espeak_TextToPhonemes
looks like the right function and agrees with espeak-ng -q --ipa on every multi-word input, but
disagrees on isolated function words — the CLI gives the → ðˈə where it gives ðə, differing
on 3.6% of 2,000 single words. The CLI does not use it; it calls espeak_SetPhonemeTrace then
espeak_Synth, so that is what this does. Measured at 5,023/5,023 identical to the CLI,
including punctuation, numbers, and empty input.
Verified per platform, not per release
tests/golden_en_us_1.51.tsv is the output of espeak-ng -q --ipa -v en-us at 1.51 on the machine
that produced a real model's training targets. It is external ground truth, not a snapshot of this
package — if a test fails, the build is wrong, never the fixture.
Every platform compiles espeak separately, so CI installs each wheel and runs the suite against that file from outside the source tree. Nothing else would catch a build whose optimisation or locale handling shifted a vowel.
Wheels: Linux x86_64/aarch64, macOS x86_64/arm64, Windows x86_64. Python 3.9+, one wheel per
platform — there is no extension module here, only ctypes.
Two traps this avoids
Only en and not en-US. They are separate data files, and shipping just en makes
SetVoiceByName("en-us") fail. The tempting recovery — fall back to en — is British English:
measured 52.4% different from en-us across 2,000 words (nˈəʊ/nˈoʊ, ˈand/ˈænd,
fˈɔː/fˈɔːɹ). Both files ship, and a test asserts the two voices still disagree, because if they
ever agree the en-US data was not loaded.
Assuming the data path is discoverable. espeak has a path compiled in at build time and also
reads ESPEAK_DATA_PATH. A relocated bundle can honour neither: the library reports the build
machine's path and calls exit(1), killing the host process with no traceback. (This is exactly
how espeakng-loader fails.) The path is passed explicitly to espeak_Initialize.
API
espeak_english.phonemes(text, voice="en-us") # -> str, IPA
espeak_english.library_path() # -> Path to the bundled .so/.dylib/.dll
espeak_english.data_path() # -> Path to the bundled espeak-ng-data
espeak_english.ESPEAK_VERSION # "1.51"
voice accepts en-us and en. Calls are serialised behind a lock: espeak keeps voice and
translator state in file-scope globals, so concurrent callers would interleave into each other's
output rather than fail. Phonemising is microseconds, so this costs nothing.
Licence
GPL-3.0-or-later, because the wheel contains espeak-ng, which is GPL-3.0.
That is the entire reason this is a separate package rather than code inside the library that needs it: a project can depend on it optionally and decide the licensing question for itself, instead of having the obligation arrive attached to something MIT.
espeak-ng is © Reece Dunn and contributors — https://github.com/espeak-ng/espeak-ng
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file espeak_english-0.1.0.tar.gz.
File metadata
- Download URL: espeak_english-0.1.0.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f25fe7b6a5e5f254ad55751ab17e15ca5b009c0a17227fe049b7a2507ae09669
|
|
| MD5 |
d2c599b30c31d0ec6e03cbc16ad49a1d
|
|
| BLAKE2b-256 |
76d2c9ab778cd08a8b0bacead9d2cfc9733690815abcbd8cc142cc292f954ff9
|
File details
Details for the file espeak_english-0.1.0-py3-none-win_amd64.whl.
File metadata
- Download URL: espeak_english-0.1.0-py3-none-win_amd64.whl
- Upload date:
- Size: 736.9 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f557a5c6fec6b8c411f95a9fcb77233082bd708febde82ccb03fe9a3ba3fe86
|
|
| MD5 |
a316c092feda34df78147a154721e5dc
|
|
| BLAKE2b-256 |
92941a13ecd565ac82d35f5cf0de79d33819559e57b060d55cb19a75ae35c4ef
|
File details
Details for the file espeak_english-0.1.0-py3-none-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: espeak_english-0.1.0-py3-none-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 675.8 kB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40034d3514ec36630b7c12438878599de03dccfd9b0375f0b94b523fc58dcc0c
|
|
| MD5 |
530ed6856bc7676606fb8f20c9511db6
|
|
| BLAKE2b-256 |
8b4242a1c12bc17df5ebefbafe3f3caa864579a8df3fa54462fc4acc50ab8c02
|
File details
Details for the file espeak_english-0.1.0-py3-none-manylinux_2_17_aarch64.whl.
File metadata
- Download URL: espeak_english-0.1.0-py3-none-manylinux_2_17_aarch64.whl
- Upload date:
- Size: 673.2 kB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5dc9442776544e8d2172a6ed10a6e1ff61e8a95d5dd283c3fbb0b38a8fe9917
|
|
| MD5 |
f73c4e527495e7c9b1f219dd24be36cf
|
|
| BLAKE2b-256 |
58964ae956fd10af6dde243b5d0af47f66acafb3bc287484cdbafb20ce0a63ce
|
File details
Details for the file espeak_english-0.1.0-py3-none-macosx_13_0_x86_64.whl.
File metadata
- Download URL: espeak_english-0.1.0-py3-none-macosx_13_0_x86_64.whl
- Upload date:
- Size: 687.6 kB
- Tags: Python 3, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f79547041e54f6a628f5a187cd15fcb87dc62b081e8ecef469c3491c0d8cc9ea
|
|
| MD5 |
3725d06a45c3e97aa9959d1f4fe3577b
|
|
| BLAKE2b-256 |
b0c4e6c52ca3092ff26ace5970184b933a1d8f978cf4150180696c8e329aca97
|
File details
Details for the file espeak_english-0.1.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: espeak_english-0.1.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 681.4 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8d4a978d2c044530eefd1acc9f0336037259f2a9da08ff27f78251583026b9e
|
|
| MD5 |
13ef649659cc76cfa917130c63959536
|
|
| BLAKE2b-256 |
d15355f61c213ecf761c39f240ee1c46c2c5cfc66650ad66b2d74502c8952231
|