MiMo-Code icon indicating copy to clipboard operation
MiMo-Code copied to clipboard

Bug: Voice input records audio but ASR transcription never fires on Windows

Open NMDX0721 opened this issue 3 months ago • 0 comments

Bug: Voice input records audio but ASR transcription never fires on Windows

Description

The /voice feature on Windows successfully records audio via sox (confirmed by log entries showing real durations like 4-11 seconds), but the ASR transcription (mimo-v2.5-asr) is never called after recording completes. No transcription text appears, and no ASR-related log entries are produced.

This is related to #1640, #1197, and the open PR #1384.

Environment

Item Value
MiMo Code version 0.1.13 (latest npm)
OS Windows 10/11
SoX version v14.4.2
Terminal PowerShell / Windows Terminal
MiMo account Active (UID: 2862102042)
Audio device Realtek(R) Audio - Microphone Array

Configuration

~/.config/mimocode/mimocode.jsonc:

{
  "provider": {
    "xiaomi": {
      "options": {
        "baseURL": "https://token-plan-cn.xiaomimimo.com/v1"
      },
      "models": {
        "mimo-v2.5": { "name": "mimo-v2.5" },
        "mimo-v2.5-pro": { "name": "mimo-v2.5-pro" }
      }
    }
  },
  "voice": {
    "asr_model": "xiaomi/mimo-v2.5-asr",
    "control_model": "xiaomi/mimo-v2.5"
  }
}

Environment variable set: AUDIODRIVER=waveaudio (User-level, persistent).

Steps to Reproduce

  1. Install SoX v14.4.2 on Windows
  2. Set AUDIODRIVER=waveaudio environment variable
  3. Configure voice.asr_model and voice.control_model in mimocode.jsonc
  4. Start MiMoCode TUI
  5. Press /voice to start recording
  6. Speak for a few seconds
  7. Press /voice again to stop

Expected Behavior

  • After recording stops, audio is sent to mimo-v2.5-asr for transcription
  • Transcribed text appears in the chat input
  • Log entries show transcribe request and transcribe result

Actual Behavior

  • Recording starts and stops successfully (logs show real durations)
  • No ASR API call is made — zero transcribe request or transcribe failed log entries
  • No transcription text appears
  • The timer display may not update during recording

Investigation Results

I performed extensive testing and confirmed the following:

1. SoX Recording Works ✓

SoX successfully records audio and outputs data to stdout:

# Command: sox -d -r 16000 -c 1 -b 16 -t raw -
# Result: 73,728 bytes output (~2.3s), 54,611 non-zero bytes (real audio)

With AUDIODRIVER=waveaudio, sox -d no longer reports "no default audio device configured".

2. ASR API Works ✓

Direct API call to mimo-v2.5-asr succeeds:

POST https://token-plan-cn.xiaomimimo.com/v1/chat/completions
Headers: Authorization: Bearer <api-key>, X-Mimo-Source: mimocode-cli
Body: { model: "mimo-v2.5-asr", messages: [...], asr_options: { language: "auto" } }
Result: 200 OK, transcription returned

Both api-key and Authorization: Bearer auth methods work.

3. Voice Module Logs

INFO  service=tui.voice recorder=sox recording started
INFO  service=tui.voice duration=4548 recording stopped
INFO  service=tui.voice recorder=sox recording started
INFO  service=tui.voice duration=4749 recording stopped
INFO  service=tui.voice recorder=sox recording started
INFO  service=tui.voice duration=11466 recording stopped

No entries for: transcribe request, transcribe result, transcribe failed, voice control request, or any credential resolution.

4. Source Code Analysis

Examined packages/opencode/src/cli/cmd/tui/util/voice.ts:

  • startStreaming() spawns sox and pipes audio to VAD
  • stopStreaming() stops recording and flushes VAD
  • transcribeAudio() calls the ASR API

The issue is that transcribeAudio() is never called after stopStreaming(). The calling code in the TUI (which orchestrates the voice flow) appears to have a Windows-specific bug where the VAD segments are not properly processed, or the code path that triggers transcription is not reached.

5. PR #1384 Relevance

PR #1384 changes sox arguments from -d to -t waveaudio default on Windows. While this fixes the sox device detection issue, issue #1640 reports that even after applying this fix, ASR still doesn't trigger. The root cause appears to be deeper in the TUI voice orchestration code.

Suggested Fix

The issue is likely in the TUI code that calls transcribeAudio() after stopStreaming(). On Windows, the VAD may not be producing segments (even though audio data is present), or the transcription trigger logic may have a platform-specific code path issue.

Key areas to investigate:

  1. The VAD (RealtimeVAD) segment production on Windows
  2. The TUI voice toggle handler that calls transcribeAudio()
  3. Whether proc.stdout is properly captured on Windows (Node.js child process handling)

Workaround

Currently no workaround within MiMoCode. The voice feature is non-functional on Windows as of v0.1.13.

Additional Context

  • This issue has been reported multiple times: #1640, #1197, #2136, #614
  • PR #1384 is open but doesn't fully resolve the ASR triggering issue
  • The voice feature works on macOS and Linux where sox -d properly detects the default device

NMDX0721 avatar Aug 23 '26 15:08 NMDX0721