[GH-ISSUE #47] ALSA lib pcm.c:8382:(snd_pcm_set_params) Sample format not available for PLAYBACK: Invalid argument #36

Closed
opened 2026-02-27 19:28:27 +03:00 by kerem · 11 comments
Owner

Originally created by @sashahilton00 on GitHub (Jan 29, 2018).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/47

Issue by archphile
Saturday Mar 11, 2017 at 09:44 GMT
Originally opened as https://github.com/plietar/librespot/issues/162


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 a None value', src/libcore/option.rs:323
note: Run with RUST_BACKTRACE=1 for a backtrace.

Any help is highly appreciated.

Many thanks,

Michael

Originally created by @sashahilton00 on GitHub (Jan 29, 2018). Original GitHub issue: https://github.com/librespot-org/librespot/issues/47 <a href="https://github.com/archphile"><img src="https://avatars0.githubusercontent.com/u/8850082?v=4" align="left" width="96" height="96" hspace="10"></img></a> **Issue by [archphile](https://github.com/archphile)** _Saturday Mar 11, 2017 at 09:44 GMT_ _Originally opened as https://github.com/plietar/librespot/issues/162_ ---- 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 '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:323 > note: Run with `RUST_BACKTRACE=1` for a backtrace. Any help is highly appreciated. Many thanks, Michael
kerem 2026-02-27 19:28:27 +03:00
Author
Owner

@sashahilton00 commented on GitHub (Jan 29, 2018):

Comment by joerg-krause
Saturday Mar 11, 2017 at 10:19 GMT


Looks like your ALSA device does not support the sample format S16_LE.

<!-- gh-comment-id:361261535 --> @sashahilton00 commented on GitHub (Jan 29, 2018): <a href="https://github.com/joerg-krause"><img src="https://avatars2.githubusercontent.com/u/6870896?v=4" align="left" width="48" height="48" hspace="10"></img></a> **Comment by [joerg-krause](https://github.com/joerg-krause)** _Saturday Mar 11, 2017 at 10:19 GMT_ ---- Looks like your ALSA device does not support the sample format `S16_LE`.
Author
Owner

@sashahilton00 commented on GitHub (Jan 29, 2018):

Comment by archphile
Saturday Mar 11, 2017 at 10:21 GMT


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.

<!-- gh-comment-id:361261561 --> @sashahilton00 commented on GitHub (Jan 29, 2018): <a href="https://github.com/archphile"><img src="https://avatars0.githubusercontent.com/u/8850082?v=4" align="left" width="48" height="48" hspace="10"></img></a> **Comment by [archphile](https://github.com/archphile)** _Saturday Mar 11, 2017 at 10:21 GMT_ ---- 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.
Author
Owner

@sashahilton00 commented on GitHub (Jan 29, 2018):

Comment by joerg-krause
Saturday Mar 11, 2017 at 10:24 GMT


You can set the ALSA device with the --device option. Try --device=plughw:1.

<!-- gh-comment-id:361261577 --> @sashahilton00 commented on GitHub (Jan 29, 2018): <a href="https://github.com/joerg-krause"><img src="https://avatars2.githubusercontent.com/u/6870896?v=4" align="left" width="48" height="48" hspace="10"></img></a> **Comment by [joerg-krause](https://github.com/joerg-krause)** _Saturday Mar 11, 2017 at 10:24 GMT_ ---- You can set the ALSA device with the `--device` option. Try `--device=plughw:1`.
Author
Owner

@sashahilton00 commented on GitHub (Jan 29, 2018):

Comment by archphile
Saturday Mar 11, 2017 at 10:28 GMT


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?

<!-- gh-comment-id:361261590 --> @sashahilton00 commented on GitHub (Jan 29, 2018): <a href="https://github.com/archphile"><img src="https://avatars0.githubusercontent.com/u/8850082?v=4" align="left" width="48" height="48" hspace="10"></img></a> **Comment by [archphile](https://github.com/archphile)** _Saturday Mar 11, 2017 at 10:28 GMT_ ---- 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?
Author
Owner

@sashahilton00 commented on GitHub (Jan 29, 2018):

Comment by joerg-krause
Saturday Mar 11, 2017 at 10:35 GMT


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 😄

<!-- gh-comment-id:361261609 --> @sashahilton00 commented on GitHub (Jan 29, 2018): <a href="https://github.com/joerg-krause"><img src="https://avatars2.githubusercontent.com/u/6870896?v=4" align="left" width="48" height="48" hspace="10"></img></a> **Comment by [joerg-krause](https://github.com/joerg-krause)** _Saturday Mar 11, 2017 at 10:35 GMT_ ---- 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:
Author
Owner

@sashahilton00 commented on GitHub (Jan 29, 2018):

Comment by archphile
Saturday Mar 11, 2017 at 10:40 GMT


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.

<!-- gh-comment-id:361261634 --> @sashahilton00 commented on GitHub (Jan 29, 2018): <a href="https://github.com/archphile"><img src="https://avatars0.githubusercontent.com/u/8850082?v=4" align="left" width="48" height="48" hspace="10"></img></a> **Comment by [archphile](https://github.com/archphile)** _Saturday Mar 11, 2017 at 10:40 GMT_ ---- 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.
Author
Owner

@sashahilton00 commented on GitHub (Jan 29, 2018):

Comment by joerg-krause
Saturday Mar 11, 2017 at 10:43 GMT


Try this:

pcm.!default {
type plughw
card 1
}
<!-- gh-comment-id:361261673 --> @sashahilton00 commented on GitHub (Jan 29, 2018): <a href="https://github.com/joerg-krause"><img src="https://avatars2.githubusercontent.com/u/6870896?v=4" align="left" width="48" height="48" hspace="10"></img></a> **Comment by [joerg-krause](https://github.com/joerg-krause)** _Saturday Mar 11, 2017 at 10:43 GMT_ ---- Try this: ``` pcm.!default { type plughw card 1 } ```
Author
Owner

@sashahilton00 commented on GitHub (Jan 29, 2018):

Comment by archphile
Saturday Mar 11, 2017 at 11:11 GMT


Thank you very much for everything Joerg.

Everything is up and running buy adding the device option on the systemd.service file.

<!-- gh-comment-id:361261691 --> @sashahilton00 commented on GitHub (Jan 29, 2018): <a href="https://github.com/archphile"><img src="https://avatars0.githubusercontent.com/u/8850082?v=4" align="left" width="48" height="48" hspace="10"></img></a> **Comment by [archphile](https://github.com/archphile)** _Saturday Mar 11, 2017 at 11:11 GMT_ ---- Thank you very much for everything Joerg. Everything is up and running buy adding the device option on the systemd.service file.
Author
Owner

@sashahilton00 commented on GitHub (Jan 29, 2018):

Comment by joerg-krause
Saturday Mar 11, 2017 at 11:15 GMT


You are welcome!

<!-- gh-comment-id:361261717 --> @sashahilton00 commented on GitHub (Jan 29, 2018): <a href="https://github.com/joerg-krause"><img src="https://avatars2.githubusercontent.com/u/6870896?v=4" align="left" width="48" height="48" hspace="10"></img></a> **Comment by [joerg-krause](https://github.com/joerg-krause)** _Saturday Mar 11, 2017 at 11:15 GMT_ ---- You are welcome!
Author
Owner

@sashahilton00 commented on GitHub (Jan 29, 2018):

Comment by arthurlutz
Thursday Nov 16, 2017 at 20:45 GMT


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

<!-- gh-comment-id:361261737 --> @sashahilton00 commented on GitHub (Jan 29, 2018): <a href="https://github.com/arthurlutz"><img src="https://avatars1.githubusercontent.com/u/108437?v=4" align="left" width="48" height="48" hspace="10"></img></a> **Comment by [arthurlutz](https://github.com/arthurlutz)** _Thursday Nov 16, 2017 at 20:45 GMT_ ---- 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
Author
Owner

@ComlOnline commented on GitHub (Jan 29, 2018):

The last comment was a different issue. Closing as it was solved.

<!-- gh-comment-id:361428137 --> @ComlOnline commented on GitHub (Jan 29, 2018): The last comment was a different issue. Closing as it was solved.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#36
No description provided.