Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALSA lib pcm.c:8382:(snd_pcm_set_params) Sample format not available for PLAYBACK: Invalid argument #47

Closed
sashahilton00 opened this issue Jan 29, 2018 · 11 comments

Comments

@sashahilton00
Copy link
Member

Issue by archphile
Saturday Mar 11, 2017 at 09:44 GMT
Originally opened as plietar/librespot#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

@sashahilton00
Copy link
Member Author

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.

@sashahilton00
Copy link
Member Author

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.

@sashahilton00
Copy link
Member Author

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.

@sashahilton00
Copy link
Member Author

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?

@sashahilton00
Copy link
Member Author

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 😄

@sashahilton00
Copy link
Member Author

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.

@sashahilton00
Copy link
Member Author

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


Try this:

pcm.!default {
type plughw
card 1
}

@sashahilton00
Copy link
Member Author

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.

@sashahilton00
Copy link
Member Author

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


You are welcome!

@sashahilton00
Copy link
Member Author

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 pimusicbox/pimusicbox#453

@ComlOnline
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants