Skip to content

Allow using the system espeak-ng instead of the bundled one#150

Open
Amithtraj wants to merge 1 commit into
KittenML:mainfrom
Amithtraj:system-espeak-ng
Open

Allow using the system espeak-ng instead of the bundled one#150
Amithtraj wants to merge 1 commit into
KittenML:mainfrom
Amithtraj:system-espeak-ng

Conversation

@Amithtraj

Copy link
Copy Markdown

Fixes #149

KittenTTS currently hardwires phonemizer to the espeak-ng library bundled with espeakng_loader at import time, and overwrites any user-set ESPEAK_DATA_PATH. Users who already have espeak-ng installed (e.g. a locally optimized build) have no way to use it.

Changes

  • Respect the standard PHONEMIZER_ESPEAK_LIBRARY environment variable: when set, phonemizer is pointed at that library and the bundled one is not loaded.
  • Preserve a user-provided ESPEAK_DATA_PATH (setdefault instead of unconditional overwrite).
  • Tolerate espeakng_loader import failure, so the package is not required when a system espeak-ng is configured via the env var.
  • Document the new option in the README.

Default behavior is unchanged: with no env vars set, the bundled library is used exactly as before. No API changes.

Testing

  • Existing test suite passes (6 passed, 10 subtests).
  • Verified with no env vars set that the vendored library is still selected.
  • Verified with PHONEMIZER_ESPEAK_LIBRARY/ESPEAK_DATA_PATH pointing at a system espeak-ng (Homebrew, macOS) that phonemization and full KittenTTS(...).generate() synthesis run through the system library.
  • Verified import and synthesis still work with espeakng_loader uninstalled and the env vars set.

Respect the standard PHONEMIZER_ESPEAK_LIBRARY environment variable:
when set, phonemizer is pointed at that library and the one bundled
with espeakng_loader is not loaded. A user-provided ESPEAK_DATA_PATH
is no longer overwritten. espeakng_loader import failure is tolerated
so the package is not required when a system espeak-ng is configured.

Fixes KittenML#149

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@CVFA1

CVFA1 commented Jul 6, 2026

Copy link
Copy Markdown

Your trial has ended. Reactivate Greptile to resume code reviews.

LMAO!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FEATURE: Enable the use of the system's native espeak-ng.

2 participants