Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Add WSL and Linux support to VoiceServer

Open selfscrum opened this issue 10 months ago • 1 comments

Summary

  • Add platform detection (macos, wsl, linux)
  • WSL: Play audio via Windows PowerShell MediaPlayer (bypasses WSLg crackling)
  • Linux: Play audio via mpv
  • macOS: Keep existing afplay behavior
  • Use PAI_DIR environment variable for all paths (with ~/.claude fallback)
  • Load .env from both ~/.env and $PAI_DIR/.env
  • Add platform info to /health endpoint

Test plan

  • [x] Tested on WSL2 - voice plays correctly through Windows MediaPlayer
  • [ ] Test on macOS (existing behavior should be unchanged)
  • [ ] Test on native Linux with mpv installed

🤖 Generated with Claude Code

selfscrum avatar Jan 16 '26 22:01 selfscrum

Great work on the Linux/WSL audio support! I tested a similar approach locally and can confirm mpv works well.

Observation: While testing on Ubuntu 24.04/WSL2, I noticed two additional macOS-specific dependencies that still cause errors on Linux:

1. Notification Display (osascript)

ENOENT: no such file or directory, posix_spawn '/usr/bin/osascript'
spawnargs: [ "-e", "display notification \"...\" with title \"PAI Notification\"" ]

Suggested fix: Use notify-send on Linux:

if (isMac) {
  spawn('/usr/bin/osascript', ['-e', `display notification "${message}" with title "${title}"`]);
} else {
  spawn('notify-send', [title, message]);
}

2. Fallback TTS (say)

The fallback speakWithSay() function uses /usr/bin/say which doesn't exist on Linux.

Suggested fix: Use espeak or spd-say on Linux:

if (isMac) {
  spawn('/usr/bin/say', [text]);
} else {
  spawn('espeak', [text]); // or 'spd-say'
}

These are non-blocking errors (the server continues to work), but addressing them would complete the cross-platform support. Happy to submit a follow-up PR if helpful!

fayerman-source avatar Jan 17 '26 04:01 fayerman-source

Thank you for the WSL/Linux VoiceServer support, @selfscrum! Cross-platform voice is important.

The target paths span Packs/ and Releases/v2.3/ which have been superseded by v3.0. Closing as the paths no longer match. If you'd like to adapt this for v3.0's VoiceServer structure, we'd welcome it!

kaimagnus avatar Feb 15 '26 19:02 kaimagnus