Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to implement external fifo streams #85

Open
MrSliff opened this issue Sep 20, 2022 · 5 comments
Open

Question: How to implement external fifo streams #85

MrSliff opened this issue Sep 20, 2022 · 5 comments
Labels
feature question Further information is requested

Comments

@MrSliff
Copy link

MrSliff commented Sep 20, 2022

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
Copy link
Owner

mariolukas commented Sep 21, 2022

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:

  • add the path (location where your fifos live) to volumes in docker-compose.yml llike

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

  • add fifos to snapcast_server section in hydraplay config like
		"additional_streams": [
			{
				"label": "BLUETOOTH",
				"source_type": "fifo"
			}
		],

I tested it by using a Bluetooth of my Raspberry Pi as a fifo source. You can change the label to whatever you want. The value behind label is what is showing up in the ui. The fifos are enumerated ( first the mopidy fifos,then the additional fifos). Maybe you need to create a fifo called stream_2.fifo in the mounted docker folder on your host.

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

source = pipe:///tmp/additional_streams/stream_{{ additional_stream_id |int + hydraplay_config.mopidy.instances| int }}.fifo?name={{additional_streams[additional_stream_id].label}}-{{additional_stream_id}}

@mariolukas mariolukas reopened this Sep 21, 2022
@mariolukas mariolukas added enhancement New feature or request question Further information is requested feature and removed enhancement New feature or request labels Sep 21, 2022
@MrSliff
Copy link
Author

MrSliff commented Sep 25, 2022

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 MrSliff closed this as completed Sep 25, 2022
@MrSliff
Copy link
Author

MrSliff commented Sep 25, 2022

Sorry didnt want to close this :(

@MrSliff MrSliff reopened this Sep 25, 2022
@mariolukas
Copy link
Owner

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants