Skip to content

Enable Voice Input on Linux - #574

Open
exbald wants to merge 1 commit into
andrewyng:mainfrom
exbald:linux-voice-input
Open

Enable Voice Input on Linux#574
exbald wants to merge 1 commit into
andrewyng:mainfrom
exbald:linux-voice-input

Conversation

@exbald

@exbald exbald commented Aug 27, 2026

Copy link
Copy Markdown

The engine was already cross-platform — cpal + whisper-rs, no per-target code anywhere in stt/ — so nothing had to be ported. Linux simply reported itself incompatible and the mic button stayed dead. Verified working end to end on an arm64 Chromebook (ChromeOS Crostini, Debian 12): whisper.cpp builds on aarch64, cpal opens the device, and whisper transcribes locally.

Three changes:

  1. Linux compatibility now asks the machine instead of returning a constant. macOS gates on Apple Silicon + 12 and Windows on x64 + build 19045; Linux has no equivalent version gate, so the real question is whether a capture device exists. Without this a machine with no microphone passes setup, downloads the 141 MB model, and fails only when the user presses record.

    Note the obvious probe is NOT enough: default_input_device() returns Some on a box with no capture hardware at all, because ALSA always presents a default PCM — observed on a container that still reported "compatible". default_input_config() is what touches the device, and it is the same call start_recording() makes, so a passing probe means a working stream.

  2. whisper.cpp and GGML log to stderr by default, including per-token decoder output — a running transcript of what was just spoken. The Settings panel promises recordings and transcripts stay on the device, so letting them reach a terminal or the session journal contradicts the feature's own claim. install_logging_hooks() routes them into whisper-rs, where with neither the log_backend nor tracing_backend feature enabled they go nowhere. The FullParams print_* flags already set here never covered this: they gate whisper's result printing, not the library's internal logging. print_timestamps(false) added too — the one print_* flag that was missed.

  3. The no-device error said "Check your Mac sound settings", which is reachable from Linux and Windows.

Building the shell on Linux with voice additionally needs libasound2-dev, cmake and libclang-dev (cpal's headers; whisper-rs compiles whisper.cpp and generates bindings).

Known limitation: when the probe finds no usable device, ALSA prints its own diagnostics to stderr. Silencing them needs snd_lib_error_set_handler through FFI, which cpal does not expose — unsafe code and a new dependency for cosmetic noise on machines that cannot use Voice Input anyway.

Prior art: hughsheehy demonstrated Linux voice input first, in a fork release built from their linux-port branch.

Claude-Session: https://claude.ai/code/session_019b8eay3F9BvB2emcd19GvF

The engine was already cross-platform — cpal + whisper-rs, no per-target code
anywhere in stt/ — so nothing had to be ported. Linux simply reported itself
incompatible and the mic button stayed dead. Verified working end to end on an
arm64 Chromebook (ChromeOS Crostini, Debian 12): whisper.cpp builds on aarch64,
cpal opens the device, and whisper transcribes locally.

Three changes:

1. Linux compatibility now asks the machine instead of returning a constant.
   macOS gates on Apple Silicon + 12 and Windows on x64 + build 19045; Linux has
   no equivalent version gate, so the real question is whether a capture device
   exists. Without this a machine with no microphone passes setup, downloads the
   141 MB model, and fails only when the user presses record.

   Note the obvious probe is NOT enough: `default_input_device()` returns Some on
   a box with no capture hardware at all, because ALSA always presents a
   `default` PCM — observed on a container that still reported "compatible".
   `default_input_config()` is what touches the device, and it is the same call
   `start_recording()` makes, so a passing probe means a working stream.

2. whisper.cpp and GGML log to stderr by default, including per-token decoder
   output — a running transcript of what was just spoken. The Settings panel
   promises recordings and transcripts stay on the device, so letting them reach
   a terminal or the session journal contradicts the feature's own claim.
   `install_logging_hooks()` routes them into whisper-rs, where with neither the
   log_backend nor tracing_backend feature enabled they go nowhere. The
   FullParams print_* flags already set here never covered this: they gate
   whisper's result printing, not the library's internal logging.
   print_timestamps(false) added too — the one print_* flag that was missed.

3. The no-device error said "Check your Mac sound settings", which is reachable
   from Linux and Windows.

Building the shell on Linux with voice additionally needs libasound2-dev, cmake
and libclang-dev (cpal's headers; whisper-rs compiles whisper.cpp and generates
bindings).

Known limitation: when the probe finds no usable device, ALSA prints its own
diagnostics to stderr. Silencing them needs snd_lib_error_set_handler through
FFI, which cpal does not expose — unsafe code and a new dependency for cosmetic
noise on machines that cannot use Voice Input anyway.

Prior art: hughsheehy demonstrated Linux voice input first, in a fork release
built from their linux-port branch.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019b8eay3F9BvB2emcd19GvF
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.

2 participants