The `frames_after_eos` parameter in `generate_audio_stream()` and
`generate_audio()` was accepted but never used - the code always used
the auto-calculated guess.
**Before:** User passes `frames_after_eos=0` → ignored, uses guess (3+
frames of silence)
**After:** User passes `frames_after_eos=0` → respected, minimal
trailing silence
Default behavior preserved when `frames_after_eos=None`.
I *think* this is the intention of that argument.
Thank you @Arihant25, re-integrating the changes from your PR because
Gabriel is not here to do his fix.
The plan was to get rid of the temporary file altogether and pass a
file-like object, but in the meantime let's at least have something that
works.
## Summary
- Adds support for MP3, FLAC, OGG, and other audio formats when
uploading reference voices for cloning
- Replace WAV-only `audio_read()` with a `soundfile`-based
implementation
- Update web UI file picker to accept multiple audio formats
## Changes
- `pocket_tts/data/audio.py`: Use `soundfile` library instead of
Python's `wave` module
- `pocket_tts/main.py`: Preserve original file extension in temp files
for format detection
- `pocket_tts/main.py`: Add missing `truncate=True` to CLI generate
command
- `pocket_tts/static/index.html`: Update file input to accept
`.wav,.mp3,.flac,.ogg,.m4a,audio/*`
- `pyproject.toml`: Add `soundfile>=0.12.0` dependency
## Tested
- [x] Upload a WAV file as reference voice and generate speech
- [x] Upload an MP3 file as reference voice and generate speech
- [x] Upload a FLAC file as reference voice and generate speech
- [x] Verify CLI `--voice` option works with MP3 files
---------
Co-authored-by: Gabriel de Marmiesse <gabrieldemarmiesse@gmail.com>
Co-authored-by: Václav Volhejn <8401624+vvolhejn@users.noreply.github.com>
After reading #39 I wanted to showcase my quick little project
[pocket-reader](https://github.com/lukasmwerner/pocket-reader) and
followed the suggestion in that issue to make a section for 'Projects
Using'
Without a specific commit, huggingface cannot be sure that the file has
not changed, so it needs to do a quick query to hf hub to check that
there were no new commits. This adds some latency to the CLI and
function calls, but it also prevents offline use, even if the files are
already present locally. This PRs fixes this. Now with the commit hash,
hf has the guarantee that the local files are the right ones and thus
doesn't need to query the hub every time.
Fix https://github.com/kyutai-labs/pocket-tts/pull/21
`torch.no_grad` is thread local, I now run the autoregressive generation
in a separate thread, in addition of the thread running mimi, and forgot
to add `torch.no_grad` to the function inside this thread.