Skip to content

Comments

fix:Wire resample 16khz into AudioRecorder stop recording#4

Open
Bhup-GitHUB wants to merge 1 commit intomofa-org:mainfrom
Bhup-GitHUB:fix-##3
Open

fix:Wire resample 16khz into AudioRecorder stop recording#4
Bhup-GitHUB wants to merge 1 commit intomofa-org:mainfrom
Bhup-GitHUB:fix-##3

Conversation

@Bhup-GitHUB
Copy link
Contributor

Closes #3

Problem

AudioRecorder::stop_recording() claims to return "16kHz, mono, f32" audio
samples but never actually performs resampling. On Apple Silicon Macs, the
default microphone records at 48kHz. Feeding these raw samples to Whisper
(which expects exactly 16kHz) causes: incorrect transcriptions, garbled
output, or silent failures.

The resample_to_16khz() function already existed in the same file
(lines 92–114) but was never called.

Changes

File: third_party/mofa-input/src/asr/audio.rs

  • Added sample_rate: u32 field to AudioRecorder struct
  • Store device sample rate from cpal config in start_recording()
  • Call resample_to_16khz() in stop_recording() before returning samples
  • Removed empty placeholder if block and TODO comment

@Bhup-GitHUB
Copy link
Contributor Author

@BH3GEI can you review it once?

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.

bug: AudioRecorder.stop_recording() never resamples to 16kHz — causes garbage Whisper transcriptions

1 participant