Skip to content

[🐞 BUG] AirPods/Bluetooth dictation degraded: capture uses stale stream format and reports ready before the Bluetooth mic is live #592

Description

@rohithgoud30

Describe the bug
When AirPods (or another Bluetooth headset) are the active input device, dictation is noticeably worse than with the built-in microphone: transcriptions come out garbled or time-stretched, the first words of a dictation are often missing, and overall accuracy drops. The built-in microphone works correctly on the same machine.

Root causes (verified in the code)

  1. The direct Core Audio capture backend (enabled by default) reads the input stream's virtual format once in fv_core_audio_capture_create and never revalidates it. When the AirPods Bluetooth route switches from A2DP to HFP as input IO starts, the cached sample rate and byte layout go stale, and every packet is decoded and resampled with the wrong parameters, producing stretched/garbled audio that wrecks transcription.
  2. There are no listeners for kAudioStreamPropertyVirtualFormat or kAudioDevicePropertyNominalSampleRate, so a mid-session format change is never detected and capture is never rebuilt.
  3. onCaptureStarted fires immediately after AudioDeviceStart returns, but a Bluetooth mic can take 1 to 2 seconds to deliver its first packet, and audio timestamped before recording start is trimmed, so words spoken during HFP negotiation are silently lost. The UI tells the user to speak before the mic is actually live.
  4. The 16 kHz conversion for ASR uses stateful linear interpolation with no anti-alias filter, folding content above 8 kHz into the speech band.

To Reproduce

  1. Connect AirPods and let macOS make them the default input device.
  2. Start dictation and begin speaking immediately.
  3. Compare the transcript with the same sentence dictated via the built-in MacBook microphone.

Expected behavior
Dictation through AirPods should be reliable: no garbled/stretched audio, no missing first words, and accuracy close to the built-in microphone (within the physical limits of the Bluetooth HFP microphone route).

Environment:

  • macOS Version: 26.5.2 (25F84)
  • App Version: built from main @ 690b26c
  • Architecture: Apple Silicon (arm64)
  • Audio devices observed: AirPods (Bluetooth) input/output; MacBook Pro Microphone built-in

Additional context

Crash Logs
No crash occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions