Skip to content

Voice: transcribe locally without a Soniox key #337

Open

Description

@Lumea-art

Problem

Linger's core promise is that it runs fully on your PC, but voice transcription is the one core feature that always needs a cloud provider. docs/voice.md says recording and dictation need a Soniox key, and apps/voice-runtime/src/agent.ts throws Voice transcription requires SONIOX_API_KEY before the ASR worker can start. Someone who is offline, wants audio to stay on the device, or does not want a Soniox account cannot dictate or get a meeting transcript, even though the model-heavy parts of the product already run locally.

Proposal

Let transcription run on the computer, without changing what the user sees:

  • With no Soniox key, dictation and meeting transcripts use a local engine, so voice works offline and audio never leaves the machine.
  • With a Soniox key, Soniox stays the default for cloud quality and speaker diarization, or the user picks the source in Settings.
  • The engine and its weights install the same way the voice VAD packages already do (apps/node-services/src/model-packages.ts, models.json, first-use download with SRI and region ordering), CPU-only, no GPU requirement.

Technical shape (paths verified on main):

  • apps/voice-runtime/src/asr.ts already defines the seam: ASRProvider.open() returns an ASRStream with partial / final / utterance_end / turn_finalized events, word offsets, and optional speaker IDs.
  • Add LocalASRProvider implements ASRProvider next to soniox.ts, wrapping a streaming CPU engine (sherpa-onnx streaming zipformer is the natural fit; whisper.cpp is the batch alternative), and reuse RecoveringASRStream for worker-restart replay.
  • agent.ts currently constructs new SonioxASRProvider(...) directly; add a small factory that picks local or Soniox from config.
  • apps/node-services/src/voice/service.ts starts the asr and recorder workers only when a Soniox key exists (workerKeys); local mode must start them without a key. TeamHub's provider-keys response (or a capability field) tells node-services that local transcription is available.
  • Add the engine and model to the voice model package group so desktop and image installs fetch it on first use.

Phasing

  1. Dictation only, CPU, one streaming model that covers Chinese and English, no settings UI; prove it with synthetic PCM through the existing voice test harness.
  2. Meeting recording and transcript through recorder-agent; local diarization is a follow-up, so speaker labels are absent or single-speaker at first.
  3. Settings: "Transcription: On this computer / Soniox", language hints, automatic fallback, and the package download in the desktop installer.

Alternatives

  • Keep Soniox-only and document voice as cloud. This leaves the local-first promise incomplete and keeps on-device audio impossible.
  • Batch whisper.cpp on recorded chunks: simpler and stronger on long meetings, but it has no partial transcripts and adds latency to dictation.
  • Bundle a local ASR service as a separate sidecar (for example a Python/localmodels server) instead of a Node provider: more moving parts, while the existing worker and health model already provides process isolation.

Open questions

Activity

  1. Lumea-art commented on Nov 20, 2026

    @Lumea-art
    ContributorAuthor

    Spike results: local streaming ASR is feasible on CPU, with one packaging caveat. Everything below ran on Ubuntu 22.04 (WSL), CPU only, no GPU, with two threads, using the official bilingual streaming zipformer model (sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20, Apache-2.0) and the 25 MB Chinese model (zh-14M), fed in 100 ms chunks at 16 kHz.

    Model (int8) Size on disk Load RTF (2 threads) First partial
    Bilingual zh-en 174 MB encoder + 13 MB decoder + 3.1 MB joiner (190 MB) 0.98 s 0.039-0.040 13-52 ms
    Chinese 14M 21 MB encoder + 1.9 MB decoder + 1.8 MB joiner (25 MB) 0.38 s 0.014-0.015 11-13 ms
    • RTF is decode time over audio time for one stream: 0.04 is about 25x realtime.
    • Four concurrent streams on one recognizer: aggregate RTF 0.043, so the worker's multi-session model scales almost linearly.
    • Peak RSS was 355 MB for the Node process with both models loaded; the bilingual model dominates.
    • Transcripts match the expected bilingual content of the models' own test_wavs, including code-switched sentences. Real meeting audio is still unproven, and the test files are short.

    Packaging finding. sherpa-onnx-node@2.0.2 ships a prebuilt addon built against GCC 14's libstdc++, so on Ubuntu 22.04 (glibc 2.35, CXXABI_1.3.13) it fails with CXXABI_1.3.15 not found, and the target machine has no sudo to upgrade. What works today:

    1. Pin sherpa-onnx-node@1.12.14: it loads on 22.04 and produced identical results to the numbers above. Downside: an older release.
    2. Build the addon in the release pipeline against the oldest supported distro toolchain.
    3. Sidecar: the official linux-x64-shared-no-tts CLI (22 MB) runs on 22.04, and the Python wheel (44 MB, bundles onnxruntime) fits the localmodels kit, which already ships Python 3.12.

    Gaps to plan for, not blockers for dictation:

    • No speaker diarization in the streaming transducer, so a local meeting transcript loses the speaker labels the Soniox path has.
    • No punctuation or casing; a punctuation model is a follow-up, or the transcript stays unpunctuated at first.
    • The bilingual int8 model is 190 MB (25 MB for Chinese-only), which is the right shape for the first-use download in models.json.

    Suggested first milestone, updated: dictation only, bilingual int8 (or the 25 MB Chinese model), sherpa-onnx-node@1.12.14 or a sidecar, no settings UI. That proves the ASRProvider seam without touching the recorder or diarization behavior.

    Happy to turn this into a draft PR behind a VOICE_LOCAL_ASR flag once you confirm the packaging route (addon vs sidecar) and the model licence and size budget.

  2. Lumea-art commented on Nov 21, 2026

    @Lumea-art
    ContributorAuthor

    A draft implementation is up for review: #432.

    It keeps the first milestone from the proposal: dictation only, off by default behind
    VOICE_LOCAL_ASR + VOICE_LOCAL_ASR_MODEL_DIR, with LocalASRProvider behind the
    existing ASRProvider seam, the ASR worker started without a Soniox key, and a
    dictation_supported policy field so the client offers dictation without offering
    recording. Recording, archive recovery and speaker labels stay on Soniox.

    It is a draft because this issue has not had a maintainer reply yet; the packaging
    route (optional sherpa-onnx-node 1.12.14, externalized in the desktop bundle) and
    the descriptor change are the parts most worth a direction check before marking it ready.

  3. Lumea-art commented on Nov 26, 2026

    @Lumea-art
    ContributorAuthor

    PR #432 now addresses the two P1 review findings (local chat_dictation without a Soniox key; the supervisor, not inherited env, choosing the engine) plus the recognizer-cache retry. Before it merges, could a maintainer confirm the packaging direction for the local engine?

    Current shape in #432:

    • sherpa-onnx-node is an optionalDependencies pin at 1.12.14 in @linger/voice-runtime (2.x needs a newer libstdc++ than Ubuntu 22.04).
    • It is marked external in the desktop node-services bundle, so the desktop runtime does not ship the addon yet.
    • The model directory is supplied by VOICE_LOCAL_ASR_MODEL_DIR; there is no UI or models.json download path in this PR.

    Is that acceptable for the first milestone, or would you rather see the addon/model packaging included in #432 before it lands? I am happy to extend it either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions