Repository navigation
Conversation
With a zero base trim, audio[0:-0] slices every chunk down to an empty array, so the whole response is silent. Skip the base trim when there is nothing to trim. Signed-off-by: Lucas Barros <lucasbarros.kam@gmail.com>
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.
GAP_TRIM_MSis documented as the base trim from each chunk end, so0reads as "no base trim". Instead it empties every chunk:samples_to_trimis 0 andaudio[0:-0]is an empty slice, and thelen > 2 * samples_to_trimguard is always true. Every request then returns silence, streamed or not.The base trim is now skipped when there is nothing to trim. The dynamic silence trim after it is unchanged.
Testing
uv run pytestpasses locally (API changes)npm run test:webpasses locally (web player changes)npm run cpu:up/gpu:up), for inference or docker changesCHANGELOG.mdentry, if users will notice the changetest_zero_gap_trim_keeps_audiosetsgap_trim_ms = 0and checks the chunk keeps its samples, for both last and non-last chunks. It fails on master (0 == 2400) and passes with the fix.test_audio_service.pypasses andruff check/ruff format --checkare clean. I didn't tick the fulluv run pytestbox: on my Mac (Python 3.12, no model weights) the run stops attest_tts_service.py::test_split_multi_voice_resolves_each_speaker_once, the same on master, so it's my environment and not this change.AI disclosure: written with the help of Claude Code, reviewed and tested by me.