Repository navigation
fix: isolate and clean up resampled audio files - #557
Open
abaichuan1017 wants to merge 3 commits into
Open
abaichuan1017 wants to merge 3 commits into
abaichuan1017 wants to merge 3 commits into
Conversation
boxerab
requested changes
Oct 29, 2026
boxerab
left a comment
Collaborator
There was a problem hiding this comment.
thanks, this looks good. one gap: load_audio in whisper_live/transcriber/tensorrt_utils.py also calls resample and never removes the file. before this change it overwrote the same <stem>_resampled.wav each time, now every call leaves a new file in the temp dir. could you wrap the read in try/finally and os.remove(resampled_file) there too, like examples/manual_audio_chunking.py does?
optional: the completed flag could be except BaseException: unlink, raise instead.
This branch has not been deployed
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.
File transcription currently writes
<stem>_resampled.wavinto the working directory, overwriting an existing file or another conversion with the same name. It also leaves the converted file behind after playback.Create a unique temporary WAV, close both PyAV containers on every path, remove failed conversions, and let the file-transcription client remove its owned temporary file after playback, including errors. Document the cleanup responsibility for direct
resamplecallers.Validation: 71 client/utility tests passed, including native PyAV conversion at 16 kHz, preserving an existing output, distinct conversion paths, conversion-failure cleanup, and cleanup after successful/failed playback. Three regression cases fail on the original implementation.
git diff --checkpassed. No microphone, model, or server integration was needed for these file-lifecycle checks.