[GH-ISSUE #200] When using usb soundcard: "ALSA error at snd_pcm_hw_params_set_format: Invalid argument" #132

Closed
opened 2026-02-28 14:25:39 +03:00 by kerem · 3 comments
Owner

Originally created by @Gerrelt on GitHub (Aug 30, 2025).
Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/200

I've installed go-librespot on a raspberry pi, with the rpi executable.
When using the default souncard, it works, I can connect to it, and play a song.

But when I configure the USB soundcard (hw:CARD=Device,DEV=0) in the config.yml, I get this error when pressing play in spotify:

DEBU[0027] put connect state because PLAYER_STATE_CHANGED
DEBU[0027] sending successful reply for dealer request
DEBU[0027] skipping dealer message                       uri=social-connect/v2/broadcast_status_update
DEBU[0027] put connect state because PLAYER_STATE_CHANGED
DEBU[0031] handling resume player command from ea22f5ce3b2e8a20803ce90d56bb6b144e26aac2
WARN[0031] failed handling dealer request                error="**failed starting playback: ALSA error at snd_pcm_hw_params_set_format: Invalid argument**"

It connects fine, but only when pressing play I get the error message, and it will not play.
Does anybody know what's going on?

This is my config.yml:

log_level: debug # Log level configuration (trace, debug, info, warn, error)
#device_id: '' # Spotify device ID (auto-generated)
device_name: 'Test' # Spotify device name
device_type: computer # Spotify device type (icon)
audio_backend: alsa # Audio backend to use (alsa, pipe, pulseaudio)
audio_device: 'hw:CARD=Device,DEV=0' # ALSA audio device to use for playback
#mixer_device: '' # ALSA mixer device for volume synchronization
#mixer_control_name: Master # ALSA mixer control name for volume synchronization
#audio_buffer_time: 500000 # Audio buffer time in microseconds, ALSA only
#audio_period_count: 4 # Number of periods to request, ALSA only
#audio_output_pipe: '' # Path to a named pipe for audio output
#audio_output_pipe_format: s16le # Audio output pipe format (s16le, s32le, f32le)
bitrate: 320 # Playback bitrate (96, 160, 320)
volume_steps: 100 # Volume steps count
initial_volume: 100 # Initial volume in steps (not applied to the mixer device)
#external_volume: false # Whether volume is controlled externally
#disable_autoplay: false # Whether autoplay of more songs should be disabled
Originally created by @Gerrelt on GitHub (Aug 30, 2025). Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/200 I've installed go-librespot on a raspberry pi, with the rpi executable. When using the default souncard, it works, I can connect to it, and play a song. But when I configure the USB soundcard (hw:CARD=Device,DEV=0) in the config.yml, I get this error when pressing play in spotify: ``` DEBU[0027] put connect state because PLAYER_STATE_CHANGED DEBU[0027] sending successful reply for dealer request DEBU[0027] skipping dealer message uri=social-connect/v2/broadcast_status_update DEBU[0027] put connect state because PLAYER_STATE_CHANGED DEBU[0031] handling resume player command from ea22f5ce3b2e8a20803ce90d56bb6b144e26aac2 WARN[0031] failed handling dealer request error="**failed starting playback: ALSA error at snd_pcm_hw_params_set_format: Invalid argument**" ``` It connects fine, but only when pressing play I get the error message, and it will not play. Does anybody know what's going on? This is my config.yml: ``` log_level: debug # Log level configuration (trace, debug, info, warn, error) #device_id: '' # Spotify device ID (auto-generated) device_name: 'Test' # Spotify device name device_type: computer # Spotify device type (icon) audio_backend: alsa # Audio backend to use (alsa, pipe, pulseaudio) audio_device: 'hw:CARD=Device,DEV=0' # ALSA audio device to use for playback #mixer_device: '' # ALSA mixer device for volume synchronization #mixer_control_name: Master # ALSA mixer control name for volume synchronization #audio_buffer_time: 500000 # Audio buffer time in microseconds, ALSA only #audio_period_count: 4 # Number of periods to request, ALSA only #audio_output_pipe: '' # Path to a named pipe for audio output #audio_output_pipe_format: s16le # Audio output pipe format (s16le, s32le, f32le) bitrate: 320 # Playback bitrate (96, 160, 320) volume_steps: 100 # Volume steps count initial_volume: 100 # Initial volume in steps (not applied to the mixer device) #external_volume: false # Whether volume is controlled externally #disable_autoplay: false # Whether autoplay of more songs should be disabled ```
kerem closed this issue 2026-02-28 14:25:39 +03:00
Author
Owner

@devgianlu commented on GitHub (Aug 30, 2025):

It seems that the ALSA device does not support SND_PCM_FORMAT_FLOAT_LE. There is an old PR trying to introduce support for other formats, perhaps you can try it?

<!-- gh-comment-id:3239301823 --> @devgianlu commented on GitHub (Aug 30, 2025): It seems that the ALSA device does not support `SND_PCM_FORMAT_FLOAT_LE`. There is an [old PR](https://github.com/devgianlu/go-librespot/pull/166) trying to introduce support for other formats, perhaps you can try it?
Author
Owner

@Gerrelt commented on GitHub (Aug 30, 2025):

I will check it! Thanks.

<!-- gh-comment-id:3239304181 --> @Gerrelt commented on GitHub (Aug 30, 2025): I will check it! Thanks.
Author
Owner

@devgianlu commented on GitHub (Aug 30, 2025):

Marking this as duplicate of #160, we can keep discussing this there.

<!-- gh-comment-id:3239317214 --> @devgianlu commented on GitHub (Aug 30, 2025): Marking this as duplicate of #160, we can keep discussing this there.
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/go-librespot#132
No description provided.