2

Beginner here.

The Goal:

Send audio source from one Pi to another over the same network.

Both Pi's will have a static IP and will be locked onto each other.

I've attached a diagram for reference.

Thank You guys in advance!

enter image description here

4
  • Have a look at Pulse Audio, an audio server for Linux. It can send audio over the network to another device. Jan 11, 2018 at 14:13
  • Thanks for the suggestion! Does this server allow me to stream in realtime from one device to another & set up multiple links? Jan 11, 2018 at 21:43
  • Look at this pogo.org.uk/~mark/trx It is simple to compile on the Raspberry and has very low latency.
    – user97974
    Apr 21, 2019 at 19:17
  • @user97974 I've been trying to get this going for a week on and off and am having no luck even compiling on my raspberry pis. Can you share some instructions?
    – ahackney
    Jun 21, 2019 at 16:37

1 Answer 1

3

Possibly the simplest way is to use sox:

Install sox on both Pis:

apt-get install sox

Lets assume the Pi with the audio source is 198.51.100.2, and the Pi attached to the amplifier is 198.51.100.3

On the source pi (198.51.100.2), make sure you can run ssh without needing a password:

ssh-copy-id 198.51.100.3

That's all the set-up done. Now to actually do the record/playing:

rec -c 1 -t wav - | ssh 198.51.100.3 play -

How does this work?

The rec command records audio from the default input device (which will be fine unless you have more than one). The audio is then sent down a unix pipe to the ssh command, which sends it over the network to the other Pi and executes the play command.

The -c 1 argument to the rec command says to record only one channel; if you want stereo then use -c 2.

(Note the IP addresses used are from RFC5737 and are for documentation only).

3
  • Nick- Thanks a ton for all the info, I will try it & follow up.... Does this method allow me to listen in real time? ( I understand there will be some delay due to size & activity of network. Also, would I run into any issues if i set up multiple links (Pi-1 stream to Pi-2 Pi-3 stream to Pi-4 Pi-5 stream to Pi-6) Jan 11, 2018 at 21:39
  • Thank You so much, this is exactly what I was looking for. Implemented it today & it worked like a charm. Jan 13, 2018 at 6:45
  • Could you mark the answer as accepted in that case please? Jan 13, 2018 at 10:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.