badaix / snapcast

Synchronous multiroom audio player

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add ability to set different sample rate for different streams

chicco-carone opened this issue · comments

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
I stream all of my music from plexamp in flac lossless and have multiple players that could support different sample rates and i would like to stream a different rate in a different stream.

Describe the solution you'd like
A clear and concise description of what you want to happen.
The ability to set the sample rate per stream so it can exist a plexamp lossless with 96k/24 sample rate and a normal plexamp stream with normal quality. The main issue is that browser players don't support higher sample rates and don't support resampling so setting the main stream to a higher rate would make browser client useless for playback

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Using 44/16 which is supported by everything i tried,

Additional context
Add any other context or screenshots about the feature request here.
I don't think the server would need to resample since with pipewire (which i use to capture the audio for my server and send into a fifo) can resample the audio for multiple sources with enough cpu and it can create 2 fifos which can reproduce sound at the same time. An additional bonus would be to keep the client in the same group for group volume and just change the source of the necessary clients

You can add sampleformat=<sampleformat> to any source. If not set, the global one will be used:
https://github.com/badaix/snapcast/blob/develop/doc/configuration.md
https://github.com/badaix/snapcast/blob/develop/README.md#server

@badaix i tried to set in the stream settings 2 different sample rates and I pointed them to the same Fifo and the sound doesn't work in want of them it just crackles randomly

Seems that I misunderstood you, my understanding was that you can capture plexamp's audio and forward it into two different fifos, using different formats (e.g. /tmp/snapfifo and /tmp/snapfifo_hires). Then you could define two sources:

source = pipe:///tmp/snapfifo?name=hifi&sampleformat=48000:16:2
source = pipe:///tmp/snapfifo_hires?name=hires&sampleformat=96000:24:2

If your browser based player is Snapweb, you can use Snapweb v0.7.50, which does support 96k/24/2 PCM and Flac. The player part of Snapweb was (and still is) just a proof of concept when WebSocket support was added to Snapcast, hacked on a rainy vacation day, without deeper knowledge of JS or TS.

Another solution would be #1228