fix: bundle espeak-ng-data inside binary (fixes #59)#60
Merged
Conversation
Piper TTS failed on fresh installs with "No such file or directory" because the espeak-ng C library statically linked into vox has the build-machine data path hard-coded, and the release tarball never shipped the espeak-ng-data files. Embed the espeak-ng-data directory at build time via include_dir! (staged from espeak-rs-sys's OUT_DIR by a new build.rs), extract it once to ~/.config/vox/piper/espeak-ng-data on first piper call, and set PIPER_ESPEAKNG_DATA_DIRECTORY so espeak-rs can locate it.
This was referenced May 14, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Piper TTS failed on fresh installs (
vox setup→ test piper backend) withNo such file or directory, as reported in #59.Root cause
The
espeak-ngC library that piper-rs links statically has its data directory path baked in at compile time — the path of the CI runner that built the release binary. On end-user machines that path does not exist, soespeak_Initializeaborts withNo such file or directoryfor every language.Confirmed by
stringson the releasedvox-aarch64-apple-darwinbinary:espeak-rsdoes provide a fallback search path (env varPIPER_ESPEAKNG_DATA_DIRECTORY, then CWD, then exe dir), but the release tarball only contains thevoxbinary — no data files — so none of those resolve.Fix
Embed the compiled
espeak-ng-datainto the binary and extract it on first piper use:build.rs— locatesespeak-ng-datainespeak-rs-sys'sOUT_DIR(cargo guarantees dep build scripts have already run) and stages it into vox'sOUT_DIR.piper.rs— embeds the staged directory viainclude_dir!("$OUT_DIR/espeak-ng-data"), extracts it once to~/.config/vox/piper/espeak-ng-data(with a sentinel file), then setsPIPER_ESPEAKNG_DATA_DIRECTORYbefore anyPiper::new/model.create()call.Binary size grows by ~15 MB (the size of
espeak-ng-data). No network access required, no install-script changes needed — fresh installs just work.Test plan
vox setup→ test piper (en) → audio plays