/voice fails on Windows: no SoX fallback when native audio module missing

Resolved 💬 4 comments Opened Mar 13, 2026 by leopalladino Closed Apr 11, 2026

Bug Description

/voice fails on Windows with:

"Voice recording requires the native audio module, which could not be loaded."

The audio-capture.node native binary is not bundled in the npm package. On macOS/Linux, Claude Code falls back to rec (SoX) or arecord (ALSA). On Windows, there is no fallback — the code immediately returns an error.

Environment

  • OS: Windows 10 Pro (10.0.19045)
  • Claude Code: v2.1.74 (npm global install)
  • Node: v22.x
  • SoX: v14.4.2 installed, waveaudio audio driver available

Steps to Reproduce

  1. Install Claude Code globally on Windows: npm i -g @anthropic-ai/claude-code
  2. Run claude
  3. Run /voice
  4. Get error: "Voice recording requires the native audio module, which could not be loaded."

Root Cause

In cli.js, three functions have early returns for win32 that block voice mode entirely instead of falling back to SoX:

  1. checkRecordingAvailability — returns {available: false} immediately on win32
  2. checkVoiceDependencies — returns {available: false} immediately on win32
  3. startRecording — logs "Windows native recording unavailable, no fallback" and returns false
  4. getInstallCommand — has no win32 branch (only darwin/linux)

Proposed Fix

Add a SoX fallback for Windows, identical to the macOS rec fallback but using sox -t waveaudio default as the input source (since rec is not available as a standalone command on Windows SoX installations):

// In startRecording, instead of returning false on win32:
if (process.platform === "win32") {
  // Use SoX with waveaudio driver (Windows equivalent of `rec -d`)
  spawn("sox", ["-t", "waveaudio", "default", "-q", "--buffer", "1024",
    "-t", "raw", "-r", "16000", "-e", "signed", "-b", "16", "-c", "1", "-",
    "silence", "1", "0.1", "3%", "1", "2.0", "3%"]);
}

Similarly, checkRecordingAvailability and checkVoiceDependencies should check for sox in PATH before returning unavailable, and getInstallCommand should suggest winget install ChrisBagwell.SoX.

Workaround

I manually patched cli.js with the above changes and confirmed:

  • /voice enables successfully ("Voice mode enabled. Hold Space to record.")
  • SoX captures audio via waveaudio driver without issues

Additional Note

Even after patching the local recording, the voice WebSocket connection (wss://claude.ai/.../voice_stream) fails with "Voice connection failed. Check your network." — curl -I https://claude.ai returns 403 Forbidden with cf-mitigated: challenge (Cloudflare bot protection). This may be a separate issue affecting certain regions (tested from Argentina/EZE).

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗