Skip to content

Fix live recording stop before queued audio is transcribed#1560

Open
honma89 wants to merge 1 commit into
chidiwilliams:mainfrom
honma89:fix-live-transcription-stop
Open

Fix live recording stop before queued audio is transcribed#1560
honma89 wants to merge 1 commit into
chidiwilliams:mainfrom
honma89:fix-live-transcription-stop

Conversation

@honma89

@honma89 honma89 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes an issue where stopping a live recording caused Buzz to stop transcription immediately, leaving any remaining audio samples in the queue unprocessed.

Previously, when the recording was stopped, the transcription loop could exit before processing the audio that was already captured. This resulted in the final part of the recording being lost.

Changes Made

  • Updated the recording transcription loop to continue processing queued audio after recording is stopped.
  • Changed the queue handling logic to safely process the remaining buffered samples before exiting.
  • Added a local samples_to_process variable to ensure the current batch is processed consistently.
  • Improved the silence cut processing by applying the cut point to the batch being transcribed instead of directly modifying the queue before processing.
  • Preserved the existing APPEND_AND_CORRECT behavior by continuing to keep the required overlap samples.

Bug Fix

Before:

  • Pressing the stop button immediately stopped the transcription loop.
  • Audio already captured in the queue could be discarded.
  • The final spoken words before stopping were sometimes missing.

After:

  • Stopping a recording allows the transcription loop to drain the remaining queued audio.
  • Previously captured audio is transcribed before the process finishes.
  • No audio is lost when stopping a live recording.

Code Changes

The main change was made in buzz/transcriber/recording_transcriber.py inside the RecordingTranscriber.start() method.

Before

The code directly modified the queue while calculating the silence cut point:

cut = self.find_silence_cut_point(
    self.queue[:self.n_batch_samples],
    self.sample_rate,
)

samples = self.queue[:cut]

if self.transcriber_mode == RecordingTranscriberMode.APPEND_AND_CORRECT:
    self.queue = self.queue[cut - keep_samples:]
else:
    self.queue = self.queue[cut:]

## Testing

Tested locally by:
- Starting a live recording.
- Speaking continuously.
- Stopping the recording while audio was still pending in the queue.
- Confirming that the remaining audio was transcribed before completion.

@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.73%. Comparing base (d1b11c4) to head (d02a54b).

Files with missing lines Patch % Lines
buzz/transcriber/recording_transcriber.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1560      +/-   ##
==========================================
- Coverage   82.95%   81.73%   -1.22%     
==========================================
  Files         108      108              
  Lines       11697    11697              
==========================================
- Hits         9703     9561     -142     
- Misses       1994     2136     +142     
Flag Coverage Δ
Linux 81.73% <88.88%> (+<0.01%) ⬆️
macOS ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant