Enable Voice Input on Linux - #574
Open
exbald wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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 adefaultPCM — observed on a container that still reported "compatible".default_input_config()is what touches the device, and it is the same callstart_recording()makes, so a passing probe means a working stream.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.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