Single PC solution - Use of 2 USB sound cards as crossovers using PAX Rack

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
A few things.

1. Make it work in alsa, do not mix it with PA technology. The combine-sink module uses adaptive resampling to merge two soundcards. I am not sure it is what you want - it will very likely introduce some (random?) delay between the two card streams.

2. Do not complicate things by using the plugin names for your devices. This may or may not work, I do not know. The best is to avoid such situation. Call your devices differently - e.g. multidev, ttabledev, etc.

3. How did you check there was no virtual soundcard created? Run

Code:
aplay -L

which lists hardware as well as virtual devices.


Configuring PA with that virtual device should be:

Code:
load-module module-alsa-sink device=multidev

in ~/.config/pulse/default.pa or the global default.pa file - Jürgen knows most about configuring PA.

Is the ttabledev actually needed when all the channel mappings are 1->1?
 
In answer to my question whether the pacmd command persists after a reboot, no.

1. Make it work in alsa, do not mix it with PA technology. The combine-sink module uses adaptive resampling to merge two soundcards. I am not sure it is what you want - it will very likely introduce some (random?) delay between the two card streams
.
I don't understand. The point of this is to get two sound cards to work as one in PAX Rack, so why do you say, "make it work in ALSA"?

Do not complicate things by using the plugin names for your devices.
I named the devices 101 and 202 in the udev ALSA rules file and that worked. I tried to create a virtual sound card named 303 but it would not show in PAX Rack or PulseAudio Volume Control (pavu).

I ran aplay -L and got more than I expected;
frank@MintMusic:~$ aplay -L
default
Playback/recording through the PulseAudio sound server
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
strangeio
sysdefault:CARD=101
USB Sound Device, USB Audio
Default Audio Device
front:CARD=101,DEV=0
USB Sound Device, USB Audio
Front speakers
surround21:CARD=101,DEV=0
USB Sound Device, USB Audio
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=101,DEV=0
USB Sound Device, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=101,DEV=0
USB Sound Device, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=101,DEV=0
USB Sound Device, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=101,DEV=0
USB Sound Device, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=101,DEV=0
USB Sound Device, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=101,DEV=0
USB Sound Device, USB Audio
IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=101,DEV=0
USB Sound Device, USB Audio
Direct sample mixing device
dsnoop:CARD=101,DEV=0
USB Sound Device, USB Audio
Direct sample snooping device
hw:CARD=101,DEV=0
USB Sound Device, USB Audio
Direct hardware device without any conversions
plughw:CARD=101,DEV=0
USB Sound Device, USB Audio
Hardware device with all software conversions
sysdefault:CARD=202
USB Sound Device, USB Audio
Default Audio Device
front:CARD=202,DEV=0
USB Sound Device, USB Audio
Front speakers
surround21:CARD=202,DEV=0
USB Sound Device, USB Audio
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=202,DEV=0
USB Sound Device, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=202,DEV=0
USB Sound Device, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=202,DEV=0
USB Sound Device, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=202,DEV=0
USB Sound Device, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=202,DEV=0
USB Sound Device, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=202,DEV=0
USB Sound Device, USB Audio
IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=202,DEV=0
USB Sound Device, USB Audio
Direct sample mixing device
dsnoop:CARD=202,DEV=0
USB Sound Device, USB Audio
Direct sample snooping device
hw:CARD=202,DEV=0
USB Sound Device, USB Audio
Direct hardware device without any conversions
plughw:CARD=202,DEV=0
USB Sound Device, USB Audio
Hardware device with all software conversions
hdmi:CARD=HDMI,DEV=0
HDA Intel HDMI, HDMI 0
HDMI Audio Output
hdmi:CARD=HDMI,DEV=1
HDA Intel HDMI, HDMI 1
HDMI Audio Output
hdmi:CARD=HDMI,DEV=2
HDA Intel HDMI, HDMI 2
HDMI Audio Output
hdmi:CARD=HDMI,DEV=3
HDA Intel HDMI, HDMI 3
HDMI Audio Output
dmix:CARD=HDMI,DEV=3
HDA Intel HDMI, HDMI 0
Direct sample mixing device
dmix:CARD=HDMI,DEV=7
HDA Intel HDMI, HDMI 1
Direct sample mixing device
dmix:CARD=HDMI,DEV=8
HDA Intel HDMI, HDMI 2
Direct sample mixing device
dmix:CARD=HDMI,DEV=9
HDA Intel HDMI, HDMI 3
Direct sample mixing device
dsnoop:CARD=HDMI,DEV=3
HDA Intel HDMI, HDMI 0
Direct sample snooping device
dsnoop:CARD=HDMI,DEV=7
HDA Intel HDMI, HDMI 1
Direct sample snooping device
dsnoop:CARD=HDMI,DEV=8
HDA Intel HDMI, HDMI 2
Direct sample snooping device
dsnoop:CARD=HDMI,DEV=9
HDA Intel HDMI, HDMI 3
Direct sample snooping device
hw:CARD=HDMI,DEV=3
HDA Intel HDMI, HDMI 0
Direct hardware device without any conversions
hw:CARD=HDMI,DEV=7
HDA Intel HDMI, HDMI 1
Direct hardware device without any conversions
hw:CARD=HDMI,DEV=8
HDA Intel HDMI, HDMI 2
Direct hardware device without any conversions
hw:CARD=HDMI,DEV=9
HDA Intel HDMI, HDMI 3
Direct hardware device without any conversions
plughw:CARD=HDMI,DEV=3
HDA Intel HDMI, HDMI 0
Hardware device with all software conversions
plughw:CARD=HDMI,DEV=7
HDA Intel HDMI, HDMI 1
Hardware device with all software conversions
plughw:CARD=HDMI,DEV=8
HDA Intel HDMI, HDMI 2
Hardware device with all software conversions
plughw:CARD=HDMI,DEV=9
HDA Intel HDMI, HDMI 3
Hardware device with all software conversions
sysdefault:CARD=PCH
HDA Intel PCH, ALC887-VD Analog
Default Audio Device
front:CARD=PCH,DEV=0
HDA Intel PCH, ALC887-VD Analog
Front speakers
surround21:CARD=PCH,DEV=0
HDA Intel PCH, ALC887-VD Analog
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
HDA Intel PCH, ALC887-VD Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
HDA Intel PCH, ALC887-VD Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
HDA Intel PCH, ALC887-VD Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
HDA Intel PCH, ALC887-VD Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
HDA Intel PCH, ALC887-VD Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
dmix:CARD=PCH,DEV=0
HDA Intel PCH, ALC887-VD Analog
Direct sample mixing device
dsnoop:CARD=PCH,DEV=0
HDA Intel PCH, ALC887-VD Analog
Direct sample snooping device
hw:CARD=PCH,DEV=0
HDA Intel PCH, ALC887-VD Analog
Direct hardware device without any conversions
plughw:CARD=PCH,DEV=0
HDA Intel PCH, ALC887-VD Analog
Hardware device with all software conversions
How do I get rid of all of the detritus?

Is the ttabledev actually needed when all the channel mappings are 1->1?
I don't know but when I get rid of all of the excess, I will use
load-module module-alsa-sink device=multidev
to find out.

This is frustrating as hell. I have tried every variant found in the ALSA project web pages, changing things and testing but with no success.
 
.
I don't understand. The point of this is to get two sound cards to work as one in PAX Rack, so why do you say, "make it work in ALSA"?

Alsa is a layer beneath PA. PA itself cannot merge soundcards (as already discussed with Jürgen). Merge the soundcards in alsa and tell PA to use this PCM device.


I named the devices 101 and 202 in the udev ALSA rules file and that worked. I tried to create a virtual sound card named 303 but it would not show in PAX Rack or PulseAudio Volume Control (pavu).

By default PA offers only devices, not PCMs. Look at the difference between parameters -l and -L in man aplay.

I ran aplay -L and got more than I expected;
The output is correct. All these PCM (virtual) devices are defined for each of your cards in default alsa configuration in /usr/share/alsa/pcm.

But I do not see the PCM you defined in your .asoundrc. Is your config correct? Place it here please.

How do I get rid of all of the detritus?

No need to do so, just do not use the other PCMs.

This is frustrating as hell. I have tried every variant found in the ALSA project web pages, changing things and testing but with no success.

The reason is you do not know how the stuff works internally, what is the relation between PA and alsa, therefore you do not know what to configure and what to look for. No reason to be frustrated, you are learning and you will do fine.
 
One more important thing - test the newly created 10ch PCM device in alsa before re-configuring PA to use it.

Code:
speaker-test -c 10 -D multidev

For details see man speaker-test.

The device must work OK in alsa first, only then can it be used by upper layers (PA). That is the standard troubleshooting procedure - testing/putting into operation changes layer by layer. Your final sound chain will have quite a few layers where any problem will defunct the whole chain

Playback app -> PA input -> PAX filters -> PA output -> alsa-lib virtual PCMs -> alsa raw (hw:X) devices -> alsa kernel modules/drivers -> HW soundcards.
 
Can we go back a step to see if I understand this?

In the udev file, the sound cards were given the names of "101" and "202". Is this correct?

Running cat /proc/asound/cards gives this;
0 [101 ]: USB-Audio - USB Sound Device
USB Sound Device at usb-0000:00:14.0-4, full speed
1 [202 ]: USB-Audio - USB Sound Device
USB Sound Device at usb-0000:00:14.0-3, full speed
2 [HDMI ]: HDA-Intel - HDA Intel HDMI
HDA Intel HDMI at 0xf7c14000 irq 29
3 [PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0xf7c10000 irq 30

One more important thing - test the newly created 10ch PCM device in alsa before re-configuring PA to use it.
I don't understand this. There isn't a 10 channel PCM device in ALSA, at least I can't see it.
 
Last edited:
In the udev file, the sound cards were given the names of "101" and "202". Is this correct?

Running cat /proc/asound/cards gives this;
Your cards list shows the udev rule works correctly. This is the information that command aplay -l would provide - listing cards.


I don't understand this. There isn't a 10 channel PCM device in ALSA, at least I can't see it.

Right, the devices "multidev" and "ttabledev" you configured in .asoundrc are 12 channel (6 + 6), my fault. These are not cards, but PCM devices defined on top of the cards. Raw PCM devices for your cards are called "hw:101", "hw:102", "hw:HDMI", "hw:pCH". These are the device strings you would use in alsa application configs (e.g. in PA output device config).
 
pcm.combcm106 {
type multi
slaves {
pcm "hw:101,0"
slave.a.channels 6
pcm "hw:202,0"
slave.b.channels 6
}
}

pcm.!default {
card "combcm106"
}

pcm.combcm106 {
type multi
slave.a.pcm "101"
slave.a.channels 6
slave.b.pcm "202"
slave.b.channels 6
binding.0 { slave a; channel 0: } # Six Outputs of first card
binding.1 { slave a; channel 1: }
binding.2 { slave a; channel 2: }
binding.3 { slave a; channel 3: }
binding.4 { slave a; channel 4: }
binding.5 { slave a; channel 5: }
binding.6 { slave b; channel 0: } # Six Outputs of second card
binding.7 { slave b; channel 1: }
binding.8 { slave b; channel 2: }
binding.9 { slave b; channel 3: }
binding.10 { slave b; channel 4: }
binding.11 { slave b; channel 5: }
}

# Step 5: Set up route table for 12 outputs for PAX Rack

Speaker test;
frank@MintMusic:~$ speaker-test -c 10 -D multidev

speaker-test 1.1.3

Playback device is multidev
Stream parameters are 48000Hz, S16_LE, 10 channels
Using 16 octaves of pink noise
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM multidev
Playback open error: -2,No such file or directory
frank@MintMusic:~$ speaker-test -c 10 -D combcm106

speaker-test 1.1.3

Playback device is combcm106
Stream parameters are 48000Hz, S16_LE, 10 channels
Using 16 octaves of pink noise
ALSA lib pcm_multi.c:1225:(_snd_pcm_multi_open) Unknown field slave
Playback open error: -22,Invalid argument
frank@MintMusic:~$ speaker-test -c 12 -D multidev

speaker-test 1.1.3

Playback device is multidev
Stream parameters are 48000Hz, S16_LE, 12 channels
Using 16 octaves of pink noise
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM multidev
Playback open error: -2,No such file or directory
frank@MintMusic:~$
 
Yes and I removed the full stops (periods) and it still did not result in a virtual card being available in PAX Rack.

As I said above, I went through that version and Google searched other methods, and tried them all with as many variations as I could imagine to try to get something to show up as a virtual card. Result; ZILCH.

The idea of a single box to play music and act as a crossover with remote implementation is very attractive but is looking like a step too far.

Is there a website or program that will parse this type of Linux code and detect syntax errors?
 
Last edited:
As I said, work step by step. First the speaker-test for the merged PCM device must pass. I.e. your .asoundrc must be correct. Only then can you move one layer up - pulseaudio.

Rename the devices and fix the periods in the .asoundrc in the post I linked, and post it here along with speaker-test results testing both the devices configured in your .asoundrc.

Speaker-test gives you some info about the problem, PA will just avoid your device alltogether - no troubleshooting info you need.
 
The results for the speaker test are above, though I think I did not code it properly.

BUT, the real but, I do not understand what this means;
As I said, work step by step. First the speaker-test for the merged PCM device must pass. I.e. your .asoundrc must be correct. Only then can you move one layer up - pulseaudio.

Rename the devices and fix the periods in the .asoundrc in the post I linked, and post it here along with speaker-test results testing both the devices configured in your .asoundrc.

Speaker-test gives you some info about the problem, PA will just avoid your device alltogether - no troubleshooting info you need.
I know nothing about Linux coding at all, so the quoted text means little, if anything, to me. I was hoping to take some sample code, rejig it and see if it works. I can't see any light at the end of the tunnel at this stage, despite having spent days on it.

linux - pulseaudio - simultanious - add two devices - Unix & Linux Stack Exchange
To repeat: No, you cannot use names like hw:1 for Pulseaudio. These are ALSA names for ALSA devices accessed through ALSA libraries. You can use them in Pulseaudio in exactly one place, namely when an ALSA module (module-alsa-devices or module-aslsa-card) is loaded that makes the ALSA devices available to Pulseaudio. Everywhere else you use the Pulseaudio sink names obtained from the list commands above (or by loading modules that provide sinks like module-null-sink and giving them names).
 
You sent speaker-test for a totally corrupted .asoundrc which does not make any sense.

My last attempt:

1) Rename your card in udev rules from numerical 101, 202 to non-numerical card101, card202 . If you use numerical names, alsa does not know if you mean a card name or card ID (your card named 101 has ID 0 in https://www.diyaudio.com/forums/pc-...-crossovers-using-pax-rack-3.html#post5798661 )

Check with aplay -l the cards have correct names card101 and card202 (in square brackets)

2) Use the following .asoundrc:

Code:
pcm.multidev {
        type multi;
        slaves.a.pcm "hw:card101";
        slaves.a.channels 6;
        slaves.b.pcm "hw:card202";
        slaves.b.channels 6;
        bindings.0.slave a;
        bindings.0.channel 0;
        bindings.1.slave a;
        bindings.1.channel 1;
        bindings.2.slave a;
        bindings.2.channel 2;
        bindings.3.slave a;
        bindings.3.channel 3;
        bindings.4.slave a;
        bindings.4.channel 4;
        bindings.5.slave a;
        bindings.5.channel 5;
        bindings.6.slave b;
        bindings.6.channel 0;
        bindings.7.slave b;
        bindings.7.channel 1;
        bindings.8.slave b;
        bindings.8.channel 2;
        bindings.9.slave b;
        bindings.9.channel 3;
        bindings.10.slave b;
        bindings.10.channel 4;
        bindings.11.slave b;
        bindings.11.channel 5;
}

pcm.ttabledev {
        type route;
        slave.pcm "multidev";
        ttable.0.0 1;
        ttable.1.1 1;
        ttable.2.2 1;
        ttable.3.3 1;
        ttable.4.4 1;
        ttable.5.5 1;
        ttable.6.6 1;
        ttable.7.7 1;
        ttable.8.8 1;
        ttable.9.9 1;
        ttable.10.10 1;
        ttable.11.11 1;
}

3. Post output of

Code:
speaker-test -c 12 -D multidev
 
Thank you for your persistence.

Here is the .asoundrc file. I wanted a card name I couldn't confuse. :)
pcm.multidev {
type multi;
slaves.a.pcm "hw:CARD_USB1";
slaves.a.channels 6;
slaves.b.pcm "hw:CARD_USB2";
slaves.b.channels 6;
bindings.0.slave a;
bindings.0.channel 0;
bindings.1.slave a;
bindings.1.channel 1;
bindings.2.slave a;
bindings.2.channel 2;
bindings.3.slave a;
bindings.3.channel 3;
bindings.4.slave a;
bindings.4.channel 4;
bindings.5.slave a;
bindings.5.channel 5;
bindings.6.slave b;
bindings.6.channel 0;
bindings.7.slave b;
bindings.7.channel 1;
bindings.8.slave b;
bindings.8.channel 2;
bindings.9.slave b;
bindings.9.channel 3;
bindings.10.slave b;
bindings.10.channel 4;
bindings.11.slave b;
bindings.11.channel 5;
}

pcm.ttabledev {
type route;
slave.pcm "multidev";
ttable.0.0 1;
ttable.1.1 1;
ttable.2.2 1;
ttable.3.3 1;
ttable.4.4 1;
ttable.5.5 1;
ttable.6.6 1;
ttable.7.7 1;
ttable.8.8 1;
ttable.9.9 1;
ttable.10.10 1;
ttable.11.11 1;
}

And this is the speaker test. It is still running with progressively longer times per period.
frank@MintMusic:~$ speaker-test -c 12 -D multidev

speaker-test 1.1.3

Playback device is multidev
Stream parameters are 48000Hz, S16_LE, 12 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 96 to 87381
Period size range from 48 to 43690
Using max buffer size 87380
Periods = 4
was set period_size = 21845
was set buffer_size = 87380
0 - Front Left
6 - Front Left
2 - Front Center
8 - Front Center
1 - Front Right
7 - Front Right
5 - Side Right
11 - Side Right
4 - Side Left
10 - Side Left
3 - LFE
9 - LFE
Time per period = 30.953738
0 - Front Left
6 - Front Left
2 - Front Center
8 - Front Center
1 - Front Right
7 - Front Right
5 - Side Right
11 - Side Right
4 - Side Left
9 - LFE
Time per period = 33.220554
0 - Front Left
6 - Front Left
2 - Front Center
8 - Front Center
1 - Front Right
7 - Front Right
5 - Side Right
11 - Side Right
4 - Side Left
10 - Side Left
3 - LFE
9 - LFE

9 - LFE
Time per period = 33.220554
0 - Front Left
6 - Front Left
2 - Front Center
8 - Front Center
1 - Front Right
7 - Front Right
5 - Side Right
11 - Side Right
4 - Side Left
10 - Side Left
3 - LFE
9 - LFE

Nothing appears in PAX Rack or PA volume control as a virtual card, however.
 
Very good, your 12ch alsa PCM device looks working OK. You should see the pink noise coming from each channel as it is being played by speaker-test.

Now you have to tell PA to use it. This is really Jürgen's territory, just two commands:

Adding the new PCM device to the PA list of devices offered/available:

Code:
pactl load-module module-alsa-sink device="multidev"

Switching PA output to this device:

Code:
pacmd set-default-sink alsa_output.multidev

IMO then PAXOR should see the 12 channels of the output device, but for that I suggest to move to the main PAXOR thread and talk to Jürgen (TFive).
 
There are many ways to combine two soundcards, but:

1. The aim of this thread is to use PA-based PAX Rack - alsa_in/out are Jack clients

2. Synchronization is crucial here, while quoting the manpage:

The audio interface used by alsa_in/alsa_out does not need to be synchronized with JACK
backend (or the hardware it might be using). alsa_in/alsa_out tries to resample the
output stream in an attempt to compensate for drift between the two clocks.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.