Hi There,
I am trying to achieve something very similar and struggling a lot.
Here is the objective: I want to create basically a wireless audio splitter, where when I play audio through one speaker, it plays through multiple speakers. I dont care about any streaming app, spotify, youtube music, google music, airplay etc. All I want is
my phone to pair to a rpi4b via bluetooth, and then play anything on the phone, like a local mp3 file, youtube, whaterver, and teh audio is received by Rpi4b, then forwarded to snapcast server which then syncs playback on a number of pi3B units running snapcast client, each connected to a cheap speaker via 3.5mm slot.
I figured I dont need mopidy. So was thinking of using pulseaudio to send the audio to snapcast server. Because of my lack of knowledge of pulseaudio implementation in PI4, and snapcast server, I have been struggling with it.
I understand that there needs to be this entity called a “sink” that should capture teh pulseaudio output, and snapcast server will somehow magically consume from this sink. I tried to follow: [Tutorial] How to Stream Audio From your PC to any Device - Tutorials - Manjaro Linux Forum , where the path is :
The first 2 commands work without errors:
pacmd load-module module-pipe-sink file=/tmp/snapfifo sink_name=Snapcast format=s16le rate=48000
pacmd update-sink-proplist Snapcast device.description=Snapcast
Then when I start snapcast server (with default configuration file, no changes):
2023-04-02 03-39-43.418 [Info] (Snapserver) Version 0.27.0, revision 54a3d862
2023-04-02 03-39-43.418 [Info] (Snapserver) Adding source: pipe:///tmp/snapfifo?name=default
2023-04-02 03-39-43.420 [Notice] (init) Settings file: “/home/fyelabs/.config/snapserver/server.json”
2023-04-02 03-39-43.422 [Info] (Snapserver) Using HTTP host name: spaudio
2023-04-02 03-39-43.439 [Info] (Avahi) Adding service ‘Snapcast’
2023-04-02 03-39-43.450 [Info] (PcmStream) PcmStream: default, sampleFormat: 48000:16:2
2023-04-02 03-39-43.450 [Info] (PipeStream) PipeStream mode: create
2023-04-02 03-39-43.450 [Info] (Server) Stream: {“fragment”:“”,“host”:“”,“path”:“/tmp/snapfifo”,“query”:{“chunk_ms”:“20”,“codec”:“flac”,“name”:“default”,“sampleformat”:“48000:16:2”},“raw”:“pipe:////tmp/snapfifo?chunk_ms=20&codec=flac&name=default&sampleformat=48000:16:2”,“scheme”:“pipe”}
2023-04-02 03-39-43.451 [Info] (FlacEnc) Init - compression level: 2
2023-04-02 03-39-43.452 [Info] (ControlServer) Creating TCP acceptor for address: 0.0.0.0, port: 8081
2023-04-02 03-39-43.452 [Info] (ControlServer) Creating HTTP acceptor for address: 0.0.0.0, port: 8080
2023-04-02 03-39-43.452 [Info] (StreamServer) Creating stream acceptor for address: 0.0.0.0, port: 8082
2023-04-02 03-39-43.453 [Info] (Snapserver) Number of threads: 4, hw threads: 4
2023-04-02 03-39-44.502 [Info] (Avahi) Service ‘Snapcast’ successfully established.
So it starts. I can use a snapcast client app on my phone and can actually see the snapcast server. HOwever, when I play some audio on my pi4b locally, say a mp3 file using vlc, it plays through the local sink, and audio comes out of the speakers connected at 3.5 mm slot instead of teh newly created snapcast sink.
I confirmed teh sink was created and when I pared bluetooth with my phone, na dplayed some youtube stuff on my phone, the audio came out from teh pi4b speakers and the wrong sink:
0 alsa_output.platform-bcm2835_audio.analog-stereo module-alsa-card.c s16le 2ch 44100Hz RUNNING
1 alsa_output.platform-3f902000.hdmi.hdmi-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
2 Snapcast module-pipe-sink.c s16le 2ch 48000Hz SUSPENDED
I guess since the audio is not getting routed through the snapcast sink, it never makes it to snapcast server, and therefore to none of teh clients. I am lost at this point in terms of whts should be teh next step. I feel this should have been an extremely simple setup, but probably becasue of my lack of knowledge, its turning out to be very frustrating. Can anyone help me out with more detailed instructions on how to make teh system work? I belive teh article I was following assumed advanced level users, and did not probably provide additional instructions on how to route audio through teh newly created sink.
Any help will be much appreciated.
Thanks