gonic icon indicating copy to clipboard operation
gonic copied to clipboard

Fixed sampling rate in jukebox mode

Open bytepossum opened this issue 3 years ago • 2 comments

Thanks to @lxea for jukebox mode implementation! It looks like in its current form all audio is resampled to 48 kHz: https://github.com/sentriz/gonic/blob/6f02b58add5e6fcaa3bc83d53df6d88f7b33a6f4/server/jukebox/jukebox.go#L76 The Beep wiki states that it's possible to use the sampling rate of the file being played. Can this method be used? Are there limitations to using per-file frequency (gapless playback issues maybe)?

bytepossum avatar Mar 09 '21 10:03 bytepossum

I think it should be possible, I didnt look into doing that yet though. It shouldn't be too hard, taglib can get the sample rate I think. I'm not sure if the gonic db has it stored or If I'll need to parse each file again :thinking:

lxea avatar Mar 09 '21 11:03 lxea

Shouldn't the sampling rate be in format.SampleRate after calling streamer, format, err = flac.Decode(f) in doUpdateSpeaker? But then speaker is already initialized with some rate, right? Can speaker.Init be called right before speaker.Play?

Sorry if it makes no sense, it's the first time I look at Go code :confused:

bytepossum avatar Mar 09 '21 12:03 bytepossum