alsa-project / alsa-ucm-conf

ALSA Use Case Manager configuration
BSD 3-Clause "New" or "Revised" License
76 stars 216 forks source link

Support for TC-Helicon GoXLR #121

Closed Toniob closed 2 years ago

Toniob commented 2 years ago

Hi,

I’m the owner of a GoXLR : https://www.tc-helicon.com/product.html?modelCode=P0CQK . It is a usb sound mixer that is not supported officially with Linux. The main issue is that the GoXLR is a multi inputs / multi outputs device, but it is not seen as one. It works great under Windows thanks to a driver. With Linux, it is seen as a single usb sound device with a single multichannel output. Right now, I managed with other people to separate those channels with pulseaudio or jack or even pipewire, using loopback modules for example. For exemple, Front Left and Front Right are the stereo output named "System". Rear left and rear right are another stereo output named "Game". There are other outputs, and it is the same mechanism for the inputs.

I opened an issue on pipewire, but someone told me it wasn’t possible to separate the in/outputs with a profile : https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1787 .

I then wondered if it was possible with a kernel quirk, which I asked : https://bugzilla.kernel.org/show_bug.cgi?id=215035 .

I was adviced to open a ticket here. So here I am. Do you think it would be possible to create a profile for my device ?

alsa-info.txt pipewire.conf.txt

perexg commented 2 years ago

I created a test configuration for one stereo stream at https://github.com/perexg/alsa-ucm-conf/commit/goxlr (patch URL: https://github.com/perexg/alsa-ucm-conf/commit/goxlr.patch).

Please, get the latest alsa-ucm-conf from this repo, pull / unpack it somewhere and redirect (symlink) /usr/share/alsa/ucm2 to the unpacked ucm2 tree (backup/rename the original /usr/share/alsa/ucm2 tree). Also, apply the above patch.

Let me know, if the Speaker / System device is detected, eventually show me the PW log.

Toniob commented 2 years ago

I did it but when I do so, I don’t have the output anymore.

pw-dump.txt spa-acp-tool.txt

perexg commented 2 years ago

Thanks, the spa-acp-tool output is sufficient. Could you show me output from alsaucm -c hw:2 get _alibcfg ?

UPDATE: I did some tests locally, but it seems like a bummer from pipewire. It handles incorrectly the private alsa-lib configurations for the PCM devices.

Toniob commented 2 years ago

Here it is alsaucm.txt

perexg commented 2 years ago

Also alsaucm -c hw:2 dump text ?

UPDATE: Could you add Syntax 4 to the ucm2/USB-Audio/GoXLR/GoXLR.conf for a test (as the first line)?

Toniob commented 2 years ago

Here is the dump alsaucm_dump.txt

If I do add Syntax 4 as the first line of the file, I now have a warning ALSA lib parser.c:2107:(parse_master_file) unknown master file field Syntax Is it expected ?

For the following tests, is there a way to reload the ucm configuration without rebooting ?

perexg commented 2 years ago

Here is the dump alsaucm_dump.txt

If I do add Syntax 4 as the first line of the file, I now have a warning ALSA lib parser.c:2107:(parse_master_file) unknown master file field Syntax Is it expected ?

Ahh. OK. The syntax cannot be changed here. Please, modify Syntax 3 to Syntax 4 in USB-Audio/USB-Audio.conf .

For the following tests, is there a way to reload the ucm configuration without rebooting ?

It should be enough to restart pipewire / run acp tool or alsaucm.

Toniob commented 2 years ago

It works with Syntax 4 moved to the USB-Audio.conf file. I’ve got the output showing in Gnome settings and I can play audio.

alsaucm_dump.txt alsaucm_cfg.txt

perexg commented 2 years ago

OK, now it's the time to analyze the channel / output jack mapping. What output jack is connected to first two channels?

In configuration, look for the two bindings lines:

bindings.0 0
bindings.1 1

Change just the second value (like bindings.0 2 bindings.1 3 and so on - test and describe the used stereo output. I'll add missing devices.

Toniob commented 2 years ago

You have the corresponding outputs in my pipewire.conf file in the first message 0 1 : System 2 3 : Game 4 5 : Music 6 7 : Voice Chat 8 9 : Sample

Thanks a lot for your work. It helps a lot.

perexg commented 2 years ago

I updated https://github.com/perexg/alsa-ucm-conf/commit/goxlr for playback.

Toniob commented 2 years ago

Thanks. It is not working currently. Here is my last working GoXLR-HiFi.conf file. GoXLR-HiFi.conf.txt

I changed the bindings to 8 and 9 for Sample, not 10 and 11. But it doesn’t change the fact that the moment I uncomment one more Sectiondevice part, it isn’t working anymore. With only one sectiondevice spa-1sectiondevice.txt It is ok and I can use my output in Gnome Settings.

With 2 or more uncommented spa-2sectiondevice.txt And my outputs, even the system one, totally disappear.

perexg commented 2 years ago

I updated https://github.com/perexg/alsa-ucm-conf/commit/goxlr again. The playback device has 10 channels total, right ?

Toniob commented 2 years ago

You’re right, it got 10 channels : FL, FR, RL, RR, SL, SR, FC, LFE, AUX0, AUX1. I tried your new patch, but it still not working. In fact, the moment I uncomment something else than the System sectiondevice, it doesn’t work anymore. spa.txt

Also, is there something to force 48khz and s32le to get rid of this

Device goxlr_system:GoXLR doesn't support 44100 Hz, changed to 48000 Hz.
Device goxlr_system:GoXLR doesn't support sample format s16le, changed to s32le.
perexg commented 2 years ago

I updated https://github.com/perexg/alsa-ucm-conf/commit/goxlr again. The channels settings were at the wrong place.

Toniob commented 2 years ago

It works ! Wonderful ! Thank you so much. spa.txt

One mistake from my side. Maybe somewhere pipewire and ucm differs in naming the outputs. But Voice chat and music are inverted. Music should be 6 and 7 and Voice is 4 and 5. I think System should be the output with the priority (you put sample). And I still have the sample and rate warning.

Can we now try with the inputs ?

Toniob commented 2 years ago

Can you please also add this usb id : 1220:8FE4 , which is another version of the GoXLR (the Mini version but it works the same) ? Thanks

perexg commented 2 years ago

I updated https://github.com/perexg/alsa-ucm-conf/commit/goxlr again. I simplified playback (needs verification) and added capture (input). I don't know how many channels the PCM capture device has. It should be tweaked in the config. Also, the mono mic channel is not readable from the pipewire config. I expect errors somewhere.

Toniob commented 2 years ago

Thanks a lot again. It works if I take off the Mono mic. But I checked on windows, and this input isn’t present. I changed your file to make the names the same as Windows. What do you think ?

GoXLR-HiFi.conf.txt

Toniob commented 2 years ago

Damn ! Another issue. Everything is working fine with a kernel 5.10 (which I was using for the tests). But if I reboot to the same system but with a kernel 5.14, the profile is gone. There is only the "off" profile available. Do you have an idea ?

spa-5.14.txt

The fact is, I don’t have sound working on a 5.14 kernel even when I don’t use this new ucm profile. The multichannel stays mute. So it’s not because of what we’ve done, I had the problem before. But I was hoping it will solve this issue.

perexg commented 2 years ago

Report this in the kernel's bugzilla: https://bugzilla.kernel.org . It appears like a kernel bug:

Trying _ucm0001.goxlr_sample_input:GoXLR with SND_PCM_NO_AUTO_FORMAT ...
snd_pcm_hw_params_any failed
unable to initialize slave
Error opening PCM device _ucm0001.goxlr_sample_input:GoXLR: Invalid argument

It's better to test the input using arecord or any other simple application.

Toniob commented 2 years ago

The bug is reported : https://bugzilla.kernel.org/show_bug.cgi?id=215079

Thanks again for your kind help.