balena-io-experimental / balena-sound

Build a single or multi-room streamer for an existing audio device using a Raspberry Pi! Supports Bluetooth, Airplay and Spotify Connect
https://balena.io/blog/turn-your-old-speakers-or-hi-fi-into-bluetooth-receivers-using-only-a-raspberry-pi/
MIT License
2.44k stars 431 forks source link

Pulseaudio Network Sink #422

Open rrrnld opened 3 years ago

rrrnld commented 3 years ago

I am on Arch Linux and I'm using Pulseaudio 14.2. Balena sound is running on a Rapberry Pi 3b+ that's equipped with a Hifiberry Amp+. I tried setting up Airplay on my Arch Linux laptop but was unsuccessful. When reading around I saw that Pulseaudio has the option to be used as a network-wide sink.

I think exposing the Pi as a Pulseaudio as a network sink could be benefitial because it uses free protocols native to both my laptop and balena sound, since from what I understand it heavily uses Pulseaudio already. This would allow me to keep the stack simpler and, by using only wifi-based protocols, also potentially avoid bluetooth issues present on the Pi 3.

borky commented 3 years ago

i think what you want is what you will get by using the below command on your arch laptop if you have pulseaudio installed(replace the italic names with your information): pacmd load-module module-tunnel-sink-new server=[yourBalenaHostnameOrIP]:4317 sink=balena-sound.input format=s16le channels=2 rate=44100 sink_properties=device.icon_name=computer sink_name=YourDesiredNameForTheSinkItWillCreate channel_map=front-left,front-right

The above command will create a new audio tunnel (device) which you can select afterwards. You could call this command whenever you want it or when your laptop starts so that it will be always available.

rrrnld commented 3 years ago

That works great! Thanks. Maybe this could be added to the docs? It's an unmentioned method of playing audio that seems to come for free and for me it's a big plus over for example bluetooth, which is flaky at best on my laptop.