Skip to content

Instantly share code, notes, and snippets.

@aptdnfapt
Created December 28, 2025 02:24
Show Gist options
  • Select an option

  • Save aptdnfapt/deb27f051af135684f3226577594c479 to your computer and use it in GitHub Desktop.

Select an option

Save aptdnfapt/deb27f051af135684f3226577594c479 to your computer and use it in GitHub Desktop.
how to use a local mic on a remote device (linux) uses netcat and pulseaudio . (local use or over a vpn like tailscale)

input device

parec -d alsa_input.pci-0000_00_0e.0.analog-stereo --format=s16le --rate=48000 --channels=2 --latency-msec=20 | nc 192.168.1.106 9999

192.168.1.106 9999 is the output device ip and port

output device

nc -l -p 9999 | pacat --format=s16le --rate=48000 --channels=2 --latency-msec=20 -d VirtualMic

here -p is port

thing to look for .

check pactl list sources short and get yout input device name put that after the input device -d .

How This Works

This setup streams audio from one computer to another using PulseAudio and netcat:

Input Device (Source Computer)

  1. parec - PulseAudio record command that captures audio from a source device
  2. -d alsa_input.pci-0000_00_0e.0.analog-stereo - Specifies the input device (your microphone or audio source)
  3. --format=s16le --rate=48000 --channels=2 --latency-msec=20 - Audio configuration:
    • s16le: 16-bit little-endian signed PCM format
    • rate=48000: Sample rate of 48kHz
    • channels=2: Stereo audio
    • latency-msec=20: Low latency of 20ms for near real-time streaming
  4. | nc 192.168.1.106 9999 - Pipes the audio stream to netcat, which sends it to the destination IP and port

Output Device (Destination Computer)

  1. nc -l -p 9999 - Netcat listens on port 9999 for incoming data
  2. | pacat - Pipes the received audio data to PulseAudio play command
  3. --format=s16le --rate=48000 --channels=2 --latency-msec=20 - Same audio configuration as input
  4. -d VirtualMic - Specifies the destination device (sink) where audio will be played

Getting Your Input Device Name

Run pactl list sources short to see all available audio input devices. The output will show something like:

0 alsa_input.pci-0000_00_0e.0.analog-stereo module-alsa-card.c s16le 2ch 48000 [RUNNING]

Use the device name (second column) after the -d flag in the parec command.

Requirements

  • Both computers must be on the same network
  • Ensure port 9999 is not blocked by firewall on the destination computer
  • Install PulseAudio (usually pre-installed on Linux)
  • Install netcat (nc) command if not available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment