Skip to main content

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 exits, killing the host process with no traceback. (This is exactly how espeakng-loader fails.) The path is passed explicitly to espeak_Initialize.

Assuming a long install path works. espeak copies <path>/espeak-ng-data into a fixed 160-byte buffer without checking whether it fit, so a path over ~144 characters is truncated — measured: 135 works, 145 does not. The truncated path then fails espeak's own existence check, so it falls back to the build-time path and reports that as missing. You get Error processing file '/tmp/tmp.XXXX/install/share/espeak-ng-data/phontab' — a directory on a machine you have never used — with nothing suggesting the real cause is the length of your own install path. A virtualenv inside a project inside a home directory hits 168 characters easily; the one this was found in did. When the path is too long, the data is exposed through a short symlink; short paths are used directly and create nothing.

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

Metadata

Release files for espeak-english 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for espeak-english 0.1.1
File Size Uploaded Provenance
espeak_english-0.1.1.tar.gz 25.5 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for espeak-english 0.1.1
File
espeak_english-0.1.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
espeak_english-0.1.1-py3-none-manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
espeak_english-0.1.1-py3-none-manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
espeak_english-0.1.1-py3-none-macosx_13_0_x86_64.whl Python 3 none macOS 13.0+ x86-64 Details
espeak_english-0.1.1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details

Total release size: 3.5 MB

Release files / espeak_english-0.1.1.tar.gz

Download URL espeak_english-0.1.1.tar.gz
Size 25.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7a5bbeb0cf1f50dec2cdfdb2f05e7382acfdde491d96046fc40374573b37a52c
BLAKE2b-256 checksum
How to use checksums
dcd20db4ebecbd3525ec482999d1a71b3bf4efcf74f4ccf0e3f745b6275b203a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / espeak_english-0.1.1-py3-none-win_amd64.whl

Download URL espeak_english-0.1.1-py3-none-win_amd64.whl
Size 738.1 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
e118a0e4a9865c91e62a13c5dc3e69ed3a2335573292fdad2fbda99964a03e67
BLAKE2b-256 checksum
How to use checksums
61d54fc3bacf83b3fcd86c0c1e5f2912cea533164d20280ff5e55249cf3e4887
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / espeak_english-0.1.1-py3-none-manylinux_2_17_x86_64.whl

Download URL espeak_english-0.1.1-py3-none-manylinux_2_17_x86_64.whl
Size 676.9 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
9405be636e582ebb95382fd7c2be203d67a914031f8a365cb121cbf1d5650d64
BLAKE2b-256 checksum
How to use checksums
3d7d9268ce4b5524fd210f68aae311d9c20d73f9e6b1dc016d6a19edfe464cd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / espeak_english-0.1.1-py3-none-manylinux_2_17_aarch64.whl

Download URL espeak_english-0.1.1-py3-none-manylinux_2_17_aarch64.whl
Size 674.4 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
d30073a4b9a96bfed29a2e167d61123999065c3ec5f014818eadc300a85e2365
BLAKE2b-256 checksum
How to use checksums
e0a77b85c8d0e66592cda3b673e35102b9f8fe4b73f16fb51462638fd85716ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / espeak_english-0.1.1-py3-none-macosx_13_0_x86_64.whl

Download URL espeak_english-0.1.1-py3-none-macosx_13_0_x86_64.whl
Size 688.8 kB
Tags Python 3 macOS 13.0+ x86-64
SHA-256 checksum
How to use checksums
526607f7d8058a9e341b1ed37d0fe39c5981413b21afcf07b8132577b857bd14
BLAKE2b-256 checksum
How to use checksums
84e43753fb650648bf6a6816417d7bde668223ed3721b6ad39056870102a8350
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / espeak_english-0.1.1-py3-none-macosx_11_0_arm64.whl

Download URL espeak_english-0.1.1-py3-none-macosx_11_0_arm64.whl
Size 682.5 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
28e71ada7fe479aa918e6387cd54ef4ce492310ff2e3a90a9ecf4992c4b2f4f7
BLAKE2b-256 checksum
How to use checksums
14c5d3da979b64533dd2d556a06e662e9b4b9b7283fac2538959cd1a49ae8efb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Security for espeak-english 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

6 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page