Pipewire misdetects available sample rates on "SplitPCMed"(alsa ucm) inputs/outputs
- PipeWire version:
0.3.65
(distro package) as well as0.3.72
(master branch from here) - Distribution and distribution version:
Debian GNU/Linux 12 (bookworm)
- Desktop Environment:
GNOME 43.4
- Kernel version:
6.1.0-9-amd64
Description of Problem:
I have USB soundcard Arturia Minifuse 2 which has 4 inputs and 4 outputs which is through ALSA UCM splitted as:
- Input channels 0 and 1:
- either "Mic/Line/Inst 1 (L)" and "Mic/Line/Inst 2 (R)" or both together as "Stereo Input 1+2 L/R"
- Input channels 2 and 3:
- "Loopback L/R"
- Output channels 0 and 1:
- "Main Output L/R"
- Output channels 2 and 3:
- "Loopback L/R"
all of them capable sample rates 44100, 48000, 88200, 96000, 176400, 192000.
But when one of these UCM splitted line input/output is used through Pipewire, Pipewire offers it as 48000 sample rate only.
Without splitted inputs/outputs (disabled UCM. So all inputs as well as outputs are shown as "surround40" which is unfortunate) it detects correctly all available sample rates.
I believe this is not issue of specific soundcard, rather any soundcard with splitted inputs or outputs by ALSA UCM. But I'm just user.
At first I tried to report it on ALSA UCM, but I've got this answer:
The dshare/dsnoop alsa-lib plugins are used when the UCM client code does not support the splitting itself (and pipewire does not have this code as far as I know).
The split is using exclusive resource (hardware PCM stream) and create more separated PCM streams on top. This means if any of this stream is opened, it "fixes" the parameters to the first opened splitted PCM stream. So if client needs to change the rate / format parameters, all related streams must be closed.
So, it's design issue and pipewire does not behave good in this case. You may highlight this problem to pipewire developers.
So, here I am.
How Reproducible:
Just use UCM SplitPCMed soundcard input or output and you've got something like this:
[I][12125.637937] spa.alsa | [ alsa-pcm.c: 618 spa_alsa_open()] 0x562ee6e24218: ALSA device open '_ucm0001.minifuse12_stereo_out:M2,0,0,1' playback
[I][12125.657353] spa.alsa | [ alsa-pcm.c: 568 probe_pitch_ctl()] minifuse12_stereo_out:M2,0,0,1 could not find ctl device: No such file or directory
[D][12125.657379] spa.alsa | [ alsa-pcm.c: 1048 debug_hw_params()] enum_pcm_formats:
[D][12125.657398] spa.alsa | [ alsa-pcm.c: 469 log_write()] ACCESS: MMAP_INTERLEAVED MMAP_NONINTERLEAVED RW_INTERLEAVED RW_NONINTERLEAVED
[D][12125.657407] spa.alsa | [ alsa-pcm.c: 469 log_write()] FORMAT: S16_LE
[D][12125.657414] spa.alsa | [ alsa-pcm.c: 469 log_write()] SUBFORMAT: STD
[D][12125.657420] spa.alsa | [ alsa-pcm.c: 469 log_write()] SAMPLE_BITS: 16
[D][12125.657427] spa.alsa | [ alsa-pcm.c: 469 log_write()] FRAME_BITS: 32
[D][12125.657433] spa.alsa | [ alsa-pcm.c: 469 log_write()] CHANNELS: 2
[D][12125.657439] spa.alsa | [ alsa-pcm.c: 469 log_write()] RATE: 48000
[D][12125.657445] spa.alsa | [ alsa-pcm.c: 469 log_write()] PERIOD_TIME: 10000
[D][12125.657452] spa.alsa | [ alsa-pcm.c: 469 log_write()] PERIOD_SIZE: 480
[D][12125.657458] spa.alsa | [ alsa-pcm.c: 469 log_write()] PERIOD_BYTES: 1920
[D][12125.657463] spa.alsa | [ alsa-pcm.c: 469 log_write()] PERIODS: [2 50]
[D][12125.657468] spa.alsa | [ alsa-pcm.c: 469 log_write()] BUFFER_TIME: [20000 500000]
[D][12125.657474] spa.alsa | [ alsa-pcm.c: 469 log_write()] BUFFER_SIZE: [960 24000]
[D][12125.657481] spa.alsa | [ alsa-pcm.c: 469 log_write()] BUFFER_BYTES: [3840 96000]
[D][12125.657488] spa.alsa | [ alsa-pcm.c: 469 log_write()] TICK_TIME: ALL
[D][12125.657499] spa.alsa | [ alsa-pcm.c: 885 add_rate()] min:48000 max:48000 min-allowed:0 scale:1 interleave:1 all:0
[D][12125.657507] spa.alsa | [ alsa-pcm.c: 909 add_rate()] rate:48000 multi:1 card:0 def:0
[D][12125.657514] spa.alsa | [ alsa-pcm.c: 963 add_channels()] channels (2 2) default:2 all:0
[D][12125.657521] spa.alsa | [ alsa-pcm.c: 1036 add_channels()] 0x562ee6e24218: position 0 3
[D][12125.657528] spa.alsa | [ alsa-pcm.c: 1036 add_channels()] 0x562ee6e24218: position 1 4
If "raw", not splitted, input/output is used then you've got all rates (and formats). Which means you have to skip UCM (and try to find which channel of "surround40" is your input or output port):
[D][13133.381023] spa.alsa | [ alsa-pcm.c: 1346 spa_alsa_enum_format()] opened:0 format:0 started:0
[I][13133.381032] spa.alsa | [ alsa-pcm.c: 618 spa_alsa_open()] 0x5629c57650b8: ALSA device open 'surround40:4' playback
[I][13133.382756] spa.alsa | [ alsa-pcm.c: 568 probe_pitch_ctl()] surround40:4 could not find ctl device: No such file or directory
[D][13133.382772] spa.alsa | [ alsa-pcm.c: 1048 debug_hw_params()] enum_pcm_formats:
[D][13133.382786] spa.alsa | [ alsa-pcm.c: 469 log_write()] ACCESS: MMAP_INTERLEAVED RW_INTERLEAVED
[D][13133.382792] spa.alsa | [ alsa-pcm.c: 469 log_write()] FORMAT: S16_LE S32_LE
[D][13133.382796] spa.alsa | [ alsa-pcm.c: 469 log_write()] SUBFORMAT: STD
[D][13133.382800] spa.alsa | [ alsa-pcm.c: 469 log_write()] SAMPLE_BITS: [16 32]
[D][13133.382804] spa.alsa | [ alsa-pcm.c: 469 log_write()] FRAME_BITS: [64 128]
[D][13133.382808] spa.alsa | [ alsa-pcm.c: 469 log_write()] CHANNELS: 4
[D][13133.382812] spa.alsa | [ alsa-pcm.c: 469 log_write()] RATE: [44100 192000]
[D][13133.382816] spa.alsa | [ alsa-pcm.c: 469 log_write()] PERIOD_TIME: [125 1000000]
[D][13133.382820] spa.alsa | [ alsa-pcm.c: 469 log_write()] PERIOD_SIZE: [6 192000]
[D][13133.382824] spa.alsa | [ alsa-pcm.c: 469 log_write()] PERIOD_BYTES: [64 3072000]
[D][13133.382827] spa.alsa | [ alsa-pcm.c: 469 log_write()] PERIODS: [2 1024]
[D][13133.382831] spa.alsa | [ alsa-pcm.c: 469 log_write()] BUFFER_TIME: (62 2000000]
[D][13133.382835] spa.alsa | [ alsa-pcm.c: 469 log_write()] BUFFER_SIZE: [12 384000]
[D][13133.382839] spa.alsa | [ alsa-pcm.c: 469 log_write()] BUFFER_BYTES: [96 6144000]
[D][13133.382843] spa.alsa | [ alsa-pcm.c: 469 log_write()] TICK_TIME: ALL
[D][13133.382850] spa.alsa | [ alsa-pcm.c: 885 add_rate()] min:44100 max:192000 min-allowed:0 scale:1 interleave:1 all:0
[D][13133.382855] spa.alsa | [ alsa-pcm.c: 909 add_rate()] rate:48000 multi:1 card:0 def:0
[D][13133.382859] spa.alsa | [ alsa-pcm.c: 963 add_channels()] channels (4 4) default:4 all:0
[D][13133.382864] spa.alsa | [ alsa-pcm.c: 1036 add_channels()] 0x5629c57650b8: position 0 3
[D][13133.382868] spa.alsa | [ alsa-pcm.c: 1036 add_channels()] 0x5629c57650b8: position 1 4
[D][13133.382872] spa.alsa | [ alsa-pcm.c: 1036 add_channels()] 0x5629c57650b8: position 2 12
[D][13133.382876] spa.alsa | [ alsa-pcm.c: 1036 add_channels()] 0x5629c57650b8: position 3 13
Actual Results:
Pipewire claims the soundcard offers 48kHz sample rate only when UCM SplitPCM ports/streams(?) are used probably due to locking one of "sibling" input/output port/stream
Expected Results:
Pipewire is able to detect available sample rates and formats correctly.