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
nc -l -p 9999 | pacat --format=s16le --rate=48000 --channels=2 --latency-msec=20 -d VirtualMic
here -p is port
check pactl list sources short and get yout input device name put that after the input device -d .
This setup streams audio from one computer to another using PulseAudio and netcat:
- parec - PulseAudio record command that captures audio from a source device
- -d alsa_input.pci-0000_00_0e.0.analog-stereo - Specifies the input device (your microphone or audio source)
- --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
- | nc 192.168.1.106 9999 - Pipes the audio stream to netcat, which sends it to the destination IP and port
- nc -l -p 9999 - Netcat listens on port 9999 for incoming data
- | pacat - Pipes the received audio data to PulseAudio play command
- --format=s16le --rate=48000 --channels=2 --latency-msec=20 - Same audio configuration as input
- -d VirtualMic - Specifies the destination device (sink) where audio will be played
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.
- 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