christf / snapcastc

C implementation of snapcast focussing on audio quality and ease of maintenance.
GNU General Public License v3.0
43 stars 6 forks source link

Error initiating server with 44100 sample rate #52

Open neilthomson opened 4 years ago

neilthomson commented 4 years ago

hey, found this project reading on badaix/snapcast which I get sync issues with, great project! I want to use this with spotify which I understand is at 44100Hz but when I tired to initialise with this sample rate I get

$ snapcast-server -s "pipe:///tmp/snapfifo?name=default&codec=opus&sampleformat=44100:16:2&buffer_ms=120"  -b 30000 -p 1704 -v
failed to create an encoder: v
for parameters: mss 0 samples 2123628772 channels 2123628820
christf commented 4 years ago

On Sun, Feb 23, 2020 at 03:14:21PM -0800, Neil Thomson wrote:

hey, found this project reading on badaix/snapcast which I get sync issues with, great project! I want to use this with spotify which I understand is at 44100Hz but when I tired to initialise with this sample rate I get

$ snapcast-server -s "pipe:///tmp/snapfifo?name=default&codec=opus&sampleformat=44100:16:2&buffer_ms=120"  -b 30000 -p 1704 -v
failed to create an encoder: v
for parameters: mss 0 samples 2123628772 channels 2123628820

Indeed opus only allows initialization with 48000Hz. There are two options:

  • implement another encoder - ogg vorbis maybe
  • use PCM

The first option is a bit of work, the second option won't work well over wifi due to packet load.

-- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments

christf commented 4 years ago

for now you could use sox to resample as indicated in the readme: sox input.ogg -r 48000 -t raw -b 16 -e signed -c 2 /tmp/snapfifo

christf commented 4 years ago

this is resolved by #33