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% biarabiʲˈɑːɹə (a palatalisation mark 1.51 does not emit)
espeak-ng 1.53 2.4% beforebᵻ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

Download files

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

Source Distribution

espeak_english-0.1.1.tar.gz (25.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

espeak_english-0.1.1-py3-none-win_amd64.whl (738.1 kB view details)

Uploaded Python 3Windows x86-64

espeak_english-0.1.1-py3-none-manylinux_2_17_x86_64.whl (676.9 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

espeak_english-0.1.1-py3-none-manylinux_2_17_aarch64.whl (674.4 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

espeak_english-0.1.1-py3-none-macosx_13_0_x86_64.whl (688.8 kB view details)

Uploaded Python 3macOS 13.0+ x86-64

espeak_english-0.1.1-py3-none-macosx_11_0_arm64.whl (682.5 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file espeak_english-0.1.1.tar.gz.

File metadata

  • Download URL: espeak_english-0.1.1.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.12

File hashes

Hashes for espeak_english-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7a5bbeb0cf1f50dec2cdfdb2f05e7382acfdde491d96046fc40374573b37a52c
MD5 17712a4ea7d9683d8ccd5d25d7db486b
BLAKE2b-256 dcd20db4ebecbd3525ec482999d1a71b3bf4efcf74f4ccf0e3f745b6275b203a

See more details on using hashes here.

File details

Details for the file espeak_english-0.1.1-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for espeak_english-0.1.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 e118a0e4a9865c91e62a13c5dc3e69ed3a2335573292fdad2fbda99964a03e67
MD5 6d2344b3485605f15c972cc58c5a3b9a
BLAKE2b-256 61d54fc3bacf83b3fcd86c0c1e5f2912cea533164d20280ff5e55249cf3e4887

See more details on using hashes here.

File details

Details for the file espeak_english-0.1.1-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for espeak_english-0.1.1-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9405be636e582ebb95382fd7c2be203d67a914031f8a365cb121cbf1d5650d64
MD5 0ccf2811ae2c0be716c2a09d8e9bdaea
BLAKE2b-256 3d7d9268ce4b5524fd210f68aae311d9c20d73f9e6b1dc016d6a19edfe464cd0

See more details on using hashes here.

File details

Details for the file espeak_english-0.1.1-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for espeak_english-0.1.1-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 d30073a4b9a96bfed29a2e167d61123999065c3ec5f014818eadc300a85e2365
MD5 3f84248ca067770397acd8f9e5394db1
BLAKE2b-256 e0a77b85c8d0e66592cda3b673e35102b9f8fe4b73f16fb51462638fd85716ad

See more details on using hashes here.

File details

Details for the file espeak_english-0.1.1-py3-none-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for espeak_english-0.1.1-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 526607f7d8058a9e341b1ed37d0fe39c5981413b21afcf07b8132577b857bd14
MD5 a633951fe212449f9a53e46779dd42d4
BLAKE2b-256 84e43753fb650648bf6a6816417d7bde668223ed3721b6ad39056870102a8350

See more details on using hashes here.

File details

Details for the file espeak_english-0.1.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for espeak_english-0.1.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 28e71ada7fe479aa918e6387cd54ef4ce492310ff2e3a90a9ecf4992c4b2f4f7
MD5 9fb89824a1aac5974e531c4825c71801
BLAKE2b-256 14c5d3da979b64533dd2d556a06e662e9b4b9b7283fac2538959cd1a49ae8efb

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

6 files

0.1.0

6 files

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