Registry / ai-ml / espeakng-loader

espeakng-loader

JSON →
library0.2.4pypypi✓ verified 86d ago

eSpeak NG Loader is a Python package (version 0.2.4, released January 16, 2025) designed to dynamically load the eSpeak NG shared library, making it available for other Python libraries or applications that require eSpeak NG functionality. It simplifies the process of interacting with the underlying C library, abstracting away platform-specific loading mechanisms. The project demonstrates an active release cadence with recent updates.

pip install espeakng-loader
INSTALL
IMPORT
SIG · ESPEAKNG-LOADER
E
espeakng-loader
ai-mlpythonv0.2.4
Install
1.8s avg
Import
31ms
Disk
36MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.51.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.027s · 37.7MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.8s · import 0.035s · 39MB
36MB installed
● package 36MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

get_library_path
from espeakng_loader import get_library_path
load_library
from espeakng_loader import load_library
make_library_available
from espeakng_loader import make_library_available

This quickstart demonstrates how to retrieve the path to the eSpeak NG shared library using `get_library_path()` and how to load it directly into your Python process with `load_library()`. It also includes guidance on the essential prerequisite of having the eSpeak NG library installed on the system.

import os from espeakng_loader import get_library_path, load_library, make_library_available try: # Get the path to the loaded eSpeak NG shared library library_path = get_library_path() print(f"eSpeak NG library path: {library_path}") # Example: Directly load the library (returns a ctypes.CDLL object) # This is useful if you're writing a direct binding or need the CDLL object. espeak_ng_cdll = load_library() print(f"eSpeak NG library loaded directly: {espeak_ng_cdll}") # Example: Make the library available for other systems (e.g., via PATH on Windows/LD_LIBRARY_PATH on Linux) # This is typically handled implicitly or by other Python bindings. # make_library_available() # print("eSpeak NG library made available to system.") # Note: To actually use eSpeak NG to speak text, you would typically # use another Python package that provides bindings to the C library, # like 'espeakng' (pip install espeakng). except RuntimeError as e: print(f"Error: {e}") print("Please ensure the eSpeak NG shared library is installed on your system.") print("On Ubuntu/Debian: sudo apt-get install espeak-ng") print("On Windows, download installer from https://github.com/espeak-ng/espeak-ng/releases")
Debug
Known issues
breakingThe `espeakng-loader` package *does not install* the eSpeak NG text-to-speech engine itself. Users *must* manually install the `espeak-ng` shared library and its data files on their operating system for this Python package to function. Failure to do so will result in `RuntimeError: espeak-ng library not found`.
fix
Install `espeak-ng` system-wide. For Debian/Ubuntu, `sudo apt-get install espeak-ng`. For Windows, download and run the installer from the official eSpeak NG GitHub releases page (https://github.com/espeak-ng/espeak-ng/releases). For macOS, you might need to build from source or use a package manager like Homebrew.
affects: All versions
gotchaThe eSpeak NG library requires access to its data directory (e.g., containing `phontab` files). If `espeak-ng-data` is not found in a standard location, you might encounter errors like "Error processing file '/usr/local/share/espeak-ng-data/phontab': No such file or directory".
fix
Ensure the `espeak-ng-data` directory is in a location where the eSpeak NG library can find it. This might involve setting the `ESPEAK_DATA_PATH` environment variable to point to the correct directory or ensuring a proper system-wide installation.
affects: All versions
gotchaWhen integrating `espeakng-loader` with the `phonemizer` package, use `phonemizer-fork` instead of the official `phonemizer` package due to an unresolved issue (#191).
fix
Install `phonemizer-fork` instead of `phonemizer` if you plan to use it with `espeakng-loader`.
affects: All versions up to 0.2.4 when used with `phonemizer`
gotchaOn Linux, audio output issues (e.g., no sound) can occur if the underlying `espeak-ng` library has problems with `pcaudiolib` or `pulseaudio`.
fix
Ensure `libpulse-dev` is installed before compiling `espeak-ng` (if building from source), or troubleshoot `pulseaudio` configuration. Testing `espeak-ng` from the command line directly can help diagnose if the issue is with the Python loader or the underlying `espeak-ng` installation.
affects: All versions
Errors
Common errors & fixes
OSError: libespeak-ng.so.1: cannot open shared object file: No such file or directory
The `espeak-ng` shared library (libespeak-ng.so.1 on Linux/macOS) is not found by the system's dynamic linker, typically because the `espeak-ng` software is not installed or its library path is not correctly configured.
fix
Install the `espeak-ng` development package system-wide (e.g., `sudo apt install espeak-ng` on Debian/Ubuntu, `brew install espeak-ng` on macOS) or ensure the directory containing `libespeak-ng.so.1` is in your `LD_LIBRARY_PATH` (Linux) or `DYLD_LIBRARY_PATH` (macOS) environment variable.
ImportError: DLL load failed while importing ... (e.g., specific espeak-ng component)
On Windows, this error indicates that the `espeak-ng` Dynamic Link Library (`libespeak-ng.dll`) is either missing, cannot be found in the system's PATH, or there is a 32-bit/64-bit architecture mismatch between your Python environment and the installed `espeak-ng` version.
fix
Install the correct 32-bit or 64-bit version of `espeak-ng` for your Windows system and ensure its installation directory (containing `libespeak-ng.dll`) is added to the system's PATH environment variable. Restart your terminal or IDE after modifying PATH.
FileNotFoundError: [Errno 2] No such file or directory: 'espeak-ng'
This error occurs when a Python script or an underlying library tries to execute the `espeak-ng` command, but the `espeak-ng` executable is not found in the system's PATH environment variable.
fix
Install the `espeak-ng` software system-wide (e.g., download the installer for Windows, use a package manager for Linux/macOS) and ensure its executable's directory is added to your operating system's PATH environment variable. Restart your command prompt or terminal.
ModuleNotFoundError: No module named 'espeakng_loader'
The `espeakng-loader` Python package has not been installed in your current Python environment, or the environment where it was installed is not currently active.
fix
Install the package using pip: `pip install espeakng-loader`.
Upgrade
Version history
0.2.4latest on PyPI · released Jan 17, 2025
Audit
Dependencies
eSpeak NG shared libraryrequiredThis Python package is a *loader* for the eSpeak NG shared library, not the library itself. The eSpeak NG binaries and data must be installed separately on the operating system (Linux, Windows, macOS) for this package to function.
Python >=3.6requiredRuntime requirement.
pcaudiolib (for eSpeak-NG audio output)optionalWhile not a direct Python dependency, the underlying eSpeak NG library often relies on `pcaudiolib` for audio output, especially on Linux. Issues with `pcaudiolib` can prevent sound generation.
Agent activity
62 hits · last 30 days
node
56
OpenAI (training)
1
Resources
espeakng-loader — pip install espeakng-loader · libregistry