How to send audio between two Linux computers using netcat

Apparently there is no dead simple way to send audio from one computer to another in a low(er) latency way.

Can’t beat this, works for any ALSA app that you can change the output for (or just change your default in .asoundrc).

On source computer:
modprobe snd-aloop
arecord -f cd -D hw:Loopback,1,0 | netcat dest 1234
mplayer -ao alsa:device=hw=Loopback.0.0 something.mp3

On destination computer:
netcat -k -l -p 1234 | aplay

Update: Oh, and apparently you can do this in Windows, too.

Written by
Open Source software architect and technologist. He's just this guy, you know? Follow him him on Google+.
Published in
Transmissions from the Little Blue Marble

Published August 15th, 2011

Comments

3 Responses

Is it possible to do something like this with aplaymidi and arecordmidi?

Possibly!

And if it can’t, there are alternatives, like QmidiNet.

However, it has been a long time since I bothered with Linux audio, so I can’t really help you.

There is a minor error in your destination computer’s netcat command.

The -p option is to set the source port when SENDING data. According to the man pages “-p It is an error to use this option in conjunction with the -l option.”

Just take out the -p and the command is correct (netcat -k -l 1234 | aplay).

Leave a Reply to Robert