mariolukas / HydraPlay

A multiroom audio player setup, based on snapcast and mopidy.
GNU Affero General Public License v3.0
142 stars 20 forks source link

Question: How to implement external fifo streams #85

Open MrSliff opened 2 years ago

MrSliff commented 2 years ago

One more question:

Theres a section in the hydra json config file to add extra streams, hence its described to be implemented soon.

Is there a way to add your own fifo streams like from librespot without snapserver.conf getting overwritten at every start of the container?

Anyways, librespot would be a good replacement for the missing spotify function in mopidy, since it provides a remote speaker to which you can connect your spotify app on the phone and it creates a fifo file which can be consumed by snapcast. For my use case i need multiple librespot instances for different ppl in my household.

mariolukas commented 2 years ago

Yes, i played with that a few month ago. I don't remember exactly how i did that. But i think you can give it a try by doing the following:

./<path to fifos on your host>/:/tmp/additional_streams

The generated snapcast config file will then contain the additional fifos:

https://github.com/mariolukas/HydraPlay/blob/45db126f43071a00712afa9fa5cae05c6b2579b8/src/hydraplay/config/templates/snapserver.conf.j2#L85

MrSliff commented 2 years ago

Thank you very much!

So i got it working, but for librespot fifo streams to play corretly you need to append &sampleformat=44000:16:2 to line 85, otherwise the stream plays too fast:

source = pipe:///tmp/additionalstreams/stream{{ additional_stream_id |int + hydraplay_config.mopidy.instances| int }}.fifo?name={{additional_streams[additional_stream_id].label}}-{{additional_stream_id}}&sampleformat=44000:16:2

I modified my config with mounting the container directory /app/hydraplay/config/templates to the host

MrSliff commented 2 years ago

Sorry didnt want to close this :(

mariolukas commented 1 year ago

Thank you very much!

So i got it working, but for librespot fifo streams to play corretly you need to append &sampleformat=44000:16:2 to line 85, otherwise the stream plays too fast:

source = pipe:///tmp/additionalstreams/stream{{ additional_stream_id |int + hydraplay_config.mopidy.instances| int }}.fifo?name={{additional_streams[additional_stream_id].label}}-{{additional_stream_id}}&sampleformat=44000:16:2

I modified my config with mounting the container directory /app/hydraplay/config/templates to the host

Does it work with your improvement?

Two-Two-One commented 1 year ago

Good morning, would be possible to provide guidance on how you got it working with librespot, i have tried following the suggestions giving but it has not worked for me thanks