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 error: snd_pcm_hw_params_set_format failed: Invalid argument. #413

Open
linuxandos2 opened this issue Oct 21, 2024 · 7 comments
Open

Comments

@linuxandos2
Copy link

Playing a flac with a samplerate higer than 96000 with audacious gives:

ALSA error: snd_pcm_hw_params_set_format failed: Invalid argument.

Output device for audacious is hw:1.0 - USB Audio
the device is a soudbaster blasterx G6.

output of cat /proc/asound/card1/stream0

Creative Technology Ltd Sound BlasterX G6 at usb-0000:00:14.0-4.1, high speed :
USB Audio

Playback:
Status: Stop
Interface 1
Altset 1
Format: S24_3LE
Channels: 2
Endpoint: 0x01 (1 OUT) (ASYNC)
Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000
Data packet interval: 125 us
Bits: 24
Channel map: FL FR
Sync Endpoint: 0x81 (1 IN)
Sync EP Interface: 1
Sync EP Altset: 1
Implicit Feedback Mode: No
Interface 1
Altset 2
Format: S32_LE
Channels: 2
Endpoint: 0x01 (1 OUT) (ASYNC)
Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000
Data packet interval: 125 us
Bits: 32
Channel map: FL FR
Sync Endpoint: 0x81 (1 IN)
Sync EP Interface: 1
Sync EP Altset: 2
Implicit Feedback Mode: No

Capture:
Status: Stop
Interface 2
Altset 1
Format: S24_3LE
Channels: 2
Endpoint: 0x82 (2 IN) (ASYNC)
Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000
Data packet interval: 125 us
Bits: 24
Channel map: FL FR
Interface 2
Altset 2
Format: S32_LE
Channels: 2
Endpoint: 0x82 (2 IN) (ASYNC)
Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000
Data packet interval: 125 us
Bits: 32
Channel map: FL FR

linux: gentoo
kernel: 6.9.9-gentoo-x86_64
alsa-lib-1.2.12
alsa-topology-conf-1.2.5.1
alsa-ucm-conf-1.2.12
alsa-plugins-1.2.12
alsa-utils-1.2.12

selecting

pulse - PulseAudio Sound Server

in audacious results in no sound and audacious hangs.
Pipewire and wireplumber are used.

On an old gentoo- system on another partition all samplerates play successfully.

kernel: linux-6.8.1-gentoo
the versions of alsa are:
alsa-lib-1.2.10-r2
alsa-topology-conf-1.2.5.1
alsa-ucm-conf-1.2.10-r1
alsa-plugins-1.2.7.1-r1
alsa-utils-1.2.10-r1

On the new system the 'old' kernel linux-6.8.1-gentoo is also available.
Rolled back alsa-lib from alsa-lib-1.2.12 to alsa-lib-1.2.10 and booted kernel kernel linux-6.8.1-gentoo
Still same problem.

@perexg
Copy link
Member

perexg commented Oct 21, 2024

It looks like a kernel driver issue (but maybe not even the sound driver). Try to connect your USB audio device to another USB port (like 2.0 only) on your system. Some USB host drivers have issues with the bandwidth calculation. Also try to reproduce your issue with the aplay or some basic ALSA utility. Like aplay -D hw:0 -f S24_3LE -r 96000 -c 2 /dev/zero . Replace zero in hw:0 with your card number.

@linuxandos2
Copy link
Author

The usb port use is no a powered usb3 hub.
Tryed on a usb3 port derectly on the system an also on a usb2 port: same results.
Now new system is running with the same kernel same .config as the old one where flac's above 192000 samples per second play.
Tests with aplay:

96000

marco@localhost ~ $ aplay -D hw:1,0 -c 1 -f S24_3LE -r 96000 -c 2 /dev/zero
Playing raw data '/dev/zero' : Signed 24 bit Little Endian in 3bytes, Rate 96000 Hz, Stereo

192000

marco@localhost ~ $ aplay -D hw:1,0 -c 1 -f S24_3LE -r 192000 -c 2 /dev/zero
Playing raw data '/dev/zero' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo
aplay: set_params:1456: Unable to install hw params:
ACCESS: RW_INTERLEAVED
FORMAT: S24_3LE
SUBFORMAT: STD
SAMPLE_BITS: 24
FRAME_BITS: 48
CHANNELS: 2
RATE: 192000
PERIOD_TIME: 125000
PERIOD_SIZE: 24000
PERIOD_BYTES: 144000
PERIODS: 4
BUFFER_TIME: 500000
BUFFER_SIZE: 96000
BUFFER_BYTES: 576000
TICK_TIME: 0

@tiwai
Copy link
Contributor

tiwai commented Oct 22, 2024

Make sure that no input stream is running on the same device while you test different parameters for the output.
Since the device runs in the implicit feedback mode, the parameters are tied for both input and output.

@linuxandos2
Copy link
Author

Yes there is no input stream running, dureing both tests.
cat /proc/asound/card1/stream0:

Capture:
Status: Stop
Interface 2
Altset 1
Format: S24_3LE
Channels: 2
Endpoint: 0x82 (2 IN) (ASYNC)
Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000
Data packet interval: 125 us
Bits: 24
Channel map: FL FR
Interface 2
Altset 2
Format: S32_LE
Channels: 2
Endpoint: 0x82 (2 IN) (ASYNC)
Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000
Data packet interval: 125 us
Bits: 32
Channel map: FL FR

@tiwai
Copy link
Contributor

tiwai commented Oct 22, 2024

Hm, what if you run with plughw instead of hw? Also, try to adjust the buffer and period size, too.

@linuxandos2
Copy link
Author

linuxandos2 commented Oct 22, 2024

Test with plughw, rate 96000, buffer-size=1000000 ==>OK
aplay -D plughw:1,0 -c 1 -f S24_3LE -r 96000 -c 2 --buffer-size=1000000 /dev/zero

Playing raw data '/dev/zero' : Signed 24 bit Little Endian in 3bytes, Rate 96000 Hz, Stereo

Test with plughw, rate 192000, buffer-size=1000000 ==>NOK
aplay -D plughw:1,0 -c 1 -f S24_3LE -r 192000 -c 2 --buffer-size=1000000 /dev/zero

Playing raw data '/dev/zero' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo
aplay: set_params:1456: Unable to install hw params:
ACCESS: RW_INTERLEAVED
FORMAT: S24_3LE
SUBFORMAT: STD
SAMPLE_BITS: 24
FRAME_BITS: 48
CHANNELS: 2
RATE: 192000
PERIOD_TIME: 1000000
PERIOD_SIZE: 192000
PERIOD_BYTES: 1152000
PERIODS: 2
BUFFER_TIME: 2000000
BUFFER_SIZE: 384000
BUFFER_BYTES: 2304000
TICK_TIME: 0

@linuxandos2
Copy link
Author

Also tryed different period sizes.

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

No branches or pull requests

3 participants