Skip to content

[Linux] talker_mic cannot open any input device — "Invalid sample rate" (16 kHz hardcoded, no resampling) #50

Description

@DaVinci-Merlin

Environment:

  • TALKER-Mic-Linux build: feature/mic-multilingual-providers/build-20260820-1-4c491d5
  • OS: Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-30-generic, x86_64
  • Audio: USB PnP Audio Device (CM108-type, 48 kHz only) + onboard ALC1220 (44.1 kHz only)
  • PipeWire audio server (standard on Mint 22)

Symptoms (all reproducible):

  1. Radio check shows 0 level on every selectable input device, even while
    PipeWire itself shows the mic with healthy signal (verified via parec:
    RMS ~1000-7000).
  2. Recording starts ("Recording started" in log) but NEVER auto-stops —
    silence detection never triggers, in-game "Listening" indicator stays
    forever regardless of hold-to-talk key release.
  3. Changing the input device during radio check crashes the app
    (uncaught PortAudioError).

Root cause (verified with the same PortAudio stack):

  • The binary opens input streams hard-coded at 16000 Hz (recorder.py:
    self._rate = 16000).
  • PortAudio's device list shows every capture-capable device on this
    system rejects 16 kHz: opening ALC1220 Analog / Alt Analog at 16000 Hz
    throws PaErrorCode -9997 "Invalid sample rate" (devices support
    44100/48000 only).
  • The bundled PortAudio has no Pulse/PipeWire backend, so there is no
    resampling layer. The USB mic (48 kHz) is even enumerated as
    output-only (max_input_channels = 0).
  • Because the stream yields no frames, audio_level stays None and the
    silence monitor (which checks "if audio_level is not None") never
    arms → recording runs forever.

Proposed fix:

  • Open the InputStream at the device's native default_samplerate and
    resample in software (or use libsamplerate), OR
  • Ship the Linux binary with PortAudio built against Pulse/PipeWire so
    the server handles rate conversion, OR
  • Read the samplerate from sd.query_devices() instead of hard-coding
    16000.

Workaround for users: none available from config — the rate is baked
into the binary.

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