librespot
librespot copied to clipboard
ALSA lib pcm.c:8382:(snd_pcm_set_params) Sample format not available for PLAYBACK: Invalid argument
Hi,
I built librespot with alsa backend on Archlinuxarm:
https://aur.archlinux.org/packages/librespot-alsa-git/
When I try to start librespot with the following command:
librespot --cache /var/cache/librespot --name Test --bitrate 320 --username xxxxxx --password xxxxxx
I get the following error:
ALSA lib pcm.c:8382:(snd_pcm_set_params) Sample format not available for PLAYBACK: Invalid argument thread '
' panicked at 'called Option::unwrap()
on aNone
value', src/libcore/option.rs:323 note: Run withRUST_BACKTRACE=1
for a backtrace.
Any help is highly appreciated.
Many thanks,
Michael
Looks like your ALSA device does not support the sample format S16_LE
.
My device is:
ard 1, ID DAC', name
S16 USB DAC'
Device 0, ID USB Audio', name
USB Audio', 1 subdevices (1 available)
2 channels, sampling rate 44100..384000 Hz
Sample formats: S32_LE
Subdevice 0, name `subdevice #0'
and indeed does not support S16_LE.
So I assume there's no solution to this?
Many thanks for your immediate reply.
You can set the ALSA device with the --device
option. Try --device=plughw:1
.
Thank you very much, it works!
I am trying to find a more generic approach so that librespot uses the default alsa device. Is there any possibility to do this?
librespot does use the default device. Your default device does not support S16_LE. If you do not want to set the device with --device
you have to make plughw:1
your default ALSA device. You can set this in ALSA config file. Google will help you :smile:
Many thanks for everything.
I have already created an asound.conf file with the following configuration:
pcm.!default { type hw card 1 }
As it seems I have to search more for this.
Try this:
pcm.!default {
type plughw
card 1
}
Thank you very much for everything Joerg.
Everything is up and running buy adding the device option on the systemd.service file.
You are welcome!
am getting this too, but with a FiiO USB DAC adding --device=plughw:1
doesn't fix it. See my report on pimusicbox through which I am using librespot https://github.com/pimusicbox/pimusicbox/issues/453
Try doing the following: List all available devices: aplay -l Locate your USB device. For my dragonfly it was: plughw:CARD=v10 Append it to your --device option.
Worked like a charm for me.