I was suspecting a receive issue on our club’s mountain top APRS digipeater. To spare me the 1 hour drive to listen to the radio’s audio I came up with the idea to remotely stream the audio through the internet connection.
No fancy heavyweight software is involved, we will just use plain command line tools on both side. The device you want to listen to will be the server and the one you will use to monitor the audio will be the client.
First make sure you have socat installed on both server
sudo apt install socatCode language: Shell Session (shell)
On the server start the audio server using following command, replace plughw:Device,0 with your actual sound card alsa name or leave it off to use default sound card.
arecord -D plughw:Device,0 -t raw -f S16_LE -r 22050 | socat - TCP4-LISTEN:12345,fork
This command will start arecord
On the client start the audio client using the following command. Replace server-ip-address with the actual IP address of your audio server.
socat TCP4:server-ip-address:12345 - | aplay -t raw -f S16_LE -r22050
That’s it, you should hear the remote audio on your local computer!
A short explanation of what is happening:
On the server, we start arecord and tell it to record as raw audio using 16 bits Low Endian samples at a sample rate of 22050Hz. The output i.e. the audio samples is then piped through stdin to socat which is waiting for incoming connections on TCP port 12345
On the client we start socat, telling him to connect on port 12345 on the server and forward the data (i.e. the audio samples) to stdout. aplay takes the audio samples from there and, since we tell it exactly how the audio is formatted it is able to play it through your speakers.