Skip to content

Instantly share code, notes, and snippets.

@timsonner
Created June 1, 2026 08:12
Show Gist options
  • Select an option

  • Save timsonner/2f493f8d91b7dc1cc50955940ffb201a to your computer and use it in GitHub Desktop.

Select an option

Save timsonner/2f493f8d91b7dc1cc50955940ffb201a to your computer and use it in GitHub Desktop.
How to get voice recording working for Hermes agent over SSH from Windows PowerShell session to remote Linux host

Audio Setup Guide: Remote Sound Routing (Windows & Linux)

This guide shows you how to route sound from your Windows client to your remote Linux server using PulseAudio and SSH tunneling. This enables your CLI agent or remote application (like Hermes) to record and play sound directly.


1. Client-Side Setup (Windows)

  1. Download PulseAudio for Windows:

    • Download the latest community-maintained build (e.g., pulseaudio-win32 by pgaskin).
    • Extract the files to a local directory (e.g., C:\pulseaudio).
  2. Configure PulseAudio (C:\pulseaudio\etc\pulse\default.pa):

    • Open default.pa in a text editor.
    • Disable Unix domain sockets (they are not supported on Windows and cause crashes).
    • Enable TCP loopback with anonymous authorization:
      # Comment out or delete this line:
      # load-module module-native-protocol-unix
      
      # Add/Modify this line:
      load-module module-native-protocol-tcp auth-anonymous=1 listen=127.0.0.1
  3. Configure the Daemon (C:\pulseaudio\etc\pulse\daemon.conf):

    • Open daemon.conf and ensure PulseAudio does not exit when idle:
      exit-idle-time = -1
  4. Launch PulseAudio:

    • Open PowerShell and start the daemon:
      & "C:\pulseaudio\bin\pulseaudio.exe" -n -F "C:\pulseaudio\etc\pulse\default.pa"
    • To verify it is running and listening locally:
      Get-NetTCPConnection -LocalPort 4713

2. Remote Port Forwarding (SSH)

To securely tunnel the sound data back to your local machine, establish an SSH connection with a remote reverse port forward. Run this on your Windows machine:

ssh -R 4713:127.0.0.1:4713 <user>@your-server-ip

This maps port 4713 on the server back to your Windows client's local PulseAudio server on 127.0.0.1. Keep this terminal window open to preserve the tunnel.


3. Server-Side Setup (Linux)

  1. Install Dependencies:

    apt-get update && apt-get install -y libasound2-plugins pulseaudio-utils
  2. Configure ALSA Routing (~/.asoundrc):

    • Create or edit ~/.asoundrc on the remote server to route default audio through Pulse:
      pcm.!default {
          type pulse
      }
      ctl.!default {
          type pulse
      }
  3. Configure Environment Variables:

    • Shell Session: Explicitly point applications to the forwarded TCP port on localhost:
      export PULSE_SERVER=tcp:127.0.0.1:4713
    • Shell Persistence: Add it to your shell startup script (~/.bashrc):
      echo 'export PULSE_SERVER=tcp:127.0.0.1:4713' >> ~/.bashrc
    • Tmux Session (If applicable): Update the tmux environment:
      tmux set-environment PULSE_SERVER tcp:127.0.0.1:4713
  4. Configure for Services (Systemd / Hermes): If you run Hermes or other audio-dependent services under systemd, you must set the environment variable for the systemd manager:

    • For User Services (systemctl --user):
      systemctl --user set-environment PULSE_SERVER=tcp:127.0.0.1:4713
      systemctl --user restart hermes-gateway
    • For System Services (systemctl):
      systemctl set-environment PULSE_SERVER=tcp:127.0.0.1:4713
      systemctl restart hermes-gateway

4. Verification

To verify that the server can communicate with your local Windows PulseAudio server over the tunnel, run:

export PULSE_SERVER=tcp:127.0.0.1:4713
pactl info

Expected Output:

If the connection is successful, it should return details about the PulseAudio server running on your Windows machine:

Server String: tcp:127.0.0.1:4713
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: no
Host Name: DESKTOP-GK4FH6H
Server Name: pulseaudio
Server Version: 15.0-paw32-5
Default Sink: waveout
Default Source: wavein
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment