make stereo from 2 cheap USB sound cards each with mono in

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

markh1289
Established Member
Posts: 4
Joined: Fri Feb 22, 2019 11:59 am

make stereo from 2 cheap USB sound cards each with mono in

Postby markh1289 » Fri Feb 22, 2019 12:06 pm

Hi,

I've done some searching on this and can only find feint promise of solutions with complexity which is beyond me. I have Ubuntu 14.04 and have had a little success with PulseAudio and QJackctl playing together OK together.
Before I go into more detail could someone please tell me if I'm able to use 2 identical USB cards each with mono mic in to simultaneously record 2 channels in Audacity relatively simply?

Thanks, MH

User avatar
bluebell
Established Member
Posts: 927
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland & Frankfurt, Germany

Re: make stereo from 2 cheap USB sound cards each with mono in

Postby bluebell » Fri Feb 22, 2019 3:59 pm

markh1289 wrote:I've done some searching on this and can only find feint promise of solutions with complexity which is beyond me. I have Ubuntu 14.04 and have had a little success with PulseAudio and QJackctl playing together OK together.
Before I go into more detail could someone please tell me if I'm able to use 2 identical USB cards each with mono mic in to simultaneously record 2 channels in Audacity relatively simply?


Qjackctl is a tool to control jackd, an audio server like Pulseaudio, just different.

It's not recommended to use multiple interfaces that cannot be synced by hardware means. You get either clicking noise or have to do some resampling that introduces latencies.

Identical USB cards are a problem generally, since Linux can't distinguish which is which. So you might end with a given interface today as "left" and tomorrow as "right".

Do yourself a favor and get a 2 channel interface.

If budget is extremely tight then you might setup multiple device with an ~/.asoundrc as described in
http://www.jackaudio.org/faq/multiple_devices.html

This can be used with or without jackd.

User avatar
Michael Willis
Established Member
Posts: 636
Joined: Mon Oct 03, 2016 3:27 pm
Contact:

Re: make stereo from 2 cheap USB sound cards each with mono in

Postby Michael Willis » Fri Feb 22, 2019 4:12 pm

bluebell wrote:Do yourself a favor and get a 2 channel interface.

Image

User avatar
CrocoDuck
Established Member
Posts: 988
Joined: Sat May 05, 2012 6:12 pm
Contact:

Re: make stereo from 2 cheap USB sound cards each with mono in

Postby CrocoDuck » Fri Feb 22, 2019 4:44 pm

markh1289 wrote:Before I go into more detail could someone please tell me if I'm able to use 2 identical USB cards each with mono mic in to simultaneously record 2 channels in Audacity relatively simply?


It is possible and people have been doing this for multiple PCI devices quite a lot in the past. Here it is how:

https://www.alsa-project.org/main/index ... el_devices

In short: you got to define a new virtual ALSA soundcard which actually incorporates multiple real soundcards. Then, you should be able to use that as an ALSA device both through ALSA and Jack. As for relatively simply... Maybe not very simple, but if you have enough time to invest to give it a try, you might do it. The article is clear on the pros and cons of such an approach, as other users already mentioned.
Check my Linux audio experiments on my SoundCloud.
Browse my AUR packages.
Fancying a swim in the pond?

markh1289
Established Member
Posts: 4
Joined: Fri Feb 22, 2019 11:59 am

Re: make stereo from 2 cheap USB sound cards each with mono in

Postby markh1289 » Sun Feb 24, 2019 4:43 am

Thankyou so much for your help CrocoDuck and bluebell.
I've tried a few combinations but it doesn't seem to be doing what I expected.
Any help would be much appreciated, please.

To original
~/.asoundrc
# create by vokoscreen 1.9.0

pcm.pulse {
type pulse
}

ctl.pulse {
type pulse
}

... I added,
pcm.merge {
type multi;
slaves.a.pcm hw:1
slaves.a.channels 2;
slaves.b.pcm hw:2
slaves.b.channels 2;
bindings.0.slave a;
bindings.0.channel 0;
bindings.1.slave b;
bindings.1.channel 0;
bindings.2.slave a;
bindings.2.channel 1;
bindings.3.slave b;
bindings.3.channel 1;
}

ctl.merge {
type hw
card 0
}

Then rebooted.
Would I expect to see a new device under,
qjackctl > Setup > Interface > ‘>’ ?
There is no new device there.

Or should I expected to see a new device in qjackctl > Connections Kit called 'merge'
like shown here,
https://forum.audacityteam.org/viewtopic.php?t=56492
under “by steve » Fri May 13, 2011 4:04 pm”
? - it had nothing new.
Should hw:1 and hw:2 instead be,
hw:1.0 and hw2.0
or
Device and Device_1
or
hw:CARD=Device,DEV=0 and hw:CARD=Device_1,DEV=0
?

Here's some background information,

From,
pactl list
Source #3
State: RUNNING
Name: alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00-Device.analog-mono
Description: USB Audio Device Analogue Mono
Driver: module-alsa-card.c
Sample Specification: s16le 1ch 44100Hz
Channel Map: mono
device.string = "hw:1"

Source #5
State: RUNNING
Name: alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00-Device_1.analog-mono
Description: USB Audio Device Analogue Mono
Driver: module-alsa-card.c
Sample Specification: s16le 1ch 44100Hz
Channel Map: mono
device.string = "hw:2"

From,
aplay -L
front:CARD=Device,DEV=0
USB Audio Device, USB Audio
Front speakers

hw:CARD=Device,DEV=0
USB Audio Device, USB Audio
Direct hardware device without any conversions


front:CARD=Device_1,DEV=0
USB Audio Device, USB Audio
Front speakers

hw:CARD=Device_1,DEV=0
USB Audio Device, USB Audio
Direct hardware device without any conversions


Here a portion of aplay –L. There is mention of ‘merge’ but I suspect there should be more below it,
mh@mh-U14:~$ aplay -L | more
default
Playback/recording through the PulseAudio sound server
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
merge
sysdefault:CARD=Intel
HDA Intel, STAC9205 Analog
Default Audio Device
front:CARD=Intel,DEV=0
HDA Intel, STAC9205 Analog
Front speakers

User avatar
bluebell
Established Member
Posts: 927
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland & Frankfurt, Germany

Re: make stereo from 2 cheap USB sound cards each with mono in

Postby bluebell » Sun Feb 24, 2019 8:08 am

All I can say is that you don't need a reboot for .asoundrc changes take effect, only a restart of those programs that use the ALSA api, e.g. jackd and probably pulseaudio.

markh1289
Established Member
Posts: 4
Joined: Fri Feb 22, 2019 11:59 am

Re: make stereo from 2 cheap USB sound cards each with mono in

Postby markh1289 » Sat Mar 02, 2019 12:19 am

Firstly I'd like to acknowledge that noone on this forum is obliged to give me any support. 2nd I'm disappointed at the lack of support. 3rd Is there something wrong with how I presented my issue? Happy to learn.

rghvdberg
Established Member
Posts: 800
Joined: Mon May 12, 2014 7:11 am

Re: make stereo from 2 cheap USB sound cards each with mono in

Postby rghvdberg » Sat Mar 02, 2019 1:10 pm

markh1289 wrote:Firstly I'd like to acknowledge that noone on this forum is obliged to give me any support. 2nd I'm disappointed at the lack of support. 3rd Is there something wrong with how I presented my issue? Happy to learn.

could also be, nobody know ¯\_(ツ)_/¯

User avatar
CrocoDuck
Established Member
Posts: 988
Joined: Sat May 05, 2012 6:12 pm
Contact:

Re: make stereo from 2 cheap USB sound cards each with mono in

Postby CrocoDuck » Sat Mar 02, 2019 1:44 pm

markh1289 wrote:Firstly I'd like to acknowledge that noone on this forum is obliged to give me any support. 2nd I'm disappointed at the lack of support.


I do not really understand what you mean by this.

Anyway, I am afraid I cannot help much on .asoundrc stuff, as I am no expert on that. However, I followed your link and this seems really interesting:
https://forum.audacityteam.org/viewtopi ... 92#p142160

I tried to see whether I could use that to use, at the same time, my UMC202HD and EARS headphone measurements jig. It worked, but I only tried it briefly, so I am not sure about how well this works, if there sync issues or things like that.

Here what I did:

I connected both my devices. If I do arecord -l I see them both:

Code: Select all

**** List of CAPTURE Hardware Devices ****
card 1: PCH [HDA Intel PCH], device 0: ALC269VB Analog [ALC269VB Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: E36dB [E.A.R.S Gain: 36dB], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 3: U192k [UMC202HD 192k], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0


As you can see, my EARS is card 2, so its ALSA name is hw:2.

Then, I started jack normally to use my UMC202HD. I used qjackctl normally for that, just selected my UMC for both input and output in the advanced configuration. You can see in the screen below that jack just starts normally, and the system input/outputs are that of my UMC.
Image

Then, in the terminal, I run this command:

Code: Select all

alsa_in -j EARS -d hw:2 -c 2 -p 3 -n 128 -r 48000


Where I matched Periods, buffer size and sample rate to that of jack. That managed to create a new EARS Jack input tied to hw:2, my EARS device, as you can see:
Image

So, I can now use both my UMC and EARS at the same time, to record. Those devices are clearly not identical, but it seems to work.

I think this is perhaps the simplest way. So, start jack with just one of your cards, and then add the inputs and outputs for the other. Let us know if you need any help with that.

By the way, from the man page:

A JACK client that opens a specified audio interface (different to the one used
by the JACK server, if any) and moves audio data between its JACK ports and the
interface. alsa_in will provide data from the interface (potentially for cap‐
ture); alsa_out will deliver data to it (for playback).

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.

As of jack-0.116.3 this works almost perfectly. It takes some time, to reach
absolute resample-rate stability. So give it some minutes (its intended to be
running permanently anyways)


Seems like it is pretty cool. I did not know about that.

EDIT:
By the way, from here: https://forum.audacityteam.org/viewtopi ... 92#p142160
On limitation for this method is that each device has only 2 recording channels, so Audacity can still only record 2 channels at a time, but when set-up as above it will record a mix of the two sound cards. To be able to record all 4 channels independently you could use Ardour.


That's not true. In my example you could define 4 mono tracks in Audacity and then set them up to record from each of the 4 available inputs, the 2 of the UMC and the 2 of the EARS, as detailed here:
https://wiki.cdot.senecacollege.ca/wiki ... cording.29
Check my Linux audio experiments on my SoundCloud.
Browse my AUR packages.
Fancying a swim in the pond?

jptrol
Established Member
Posts: 8
Joined: Sun Mar 10, 2019 9:57 am

Re: make stereo from 2 cheap USB sound cards each with mono in

Postby jptrol » Tue Mar 12, 2019 2:30 pm

I tried to make the same but with two stereo USB cards to provide a 4 ways recorder under Ardour5. I use as a first card a Scarlet Focusrite 2i4 and as a second one an Edirol UA25 like this :

Code: Select all

 0 [HDMI           ]: HDA-Intel - HDA ATI HDMI
                      HDA ATI HDMI at 0xfeb64000 irq 39
 1 [Loopback       ]: Loopback - Loopback
                      Loopback 1
 2 [Generic        ]: HDA-Intel - HD-Audio Generic
                      HD-Audio Generic at 0xfeb60000 irq 16
 3 [USB            ]: USB-Audio - Scarlett 2i4 USB
                      Focusrite Scarlett 2i4 USB at usb-0000:00:10.0-2, high speed
 4 [UA25           ]: USB-Audio - UA-25
                      EDIROL UA-25 at usb-0000:00:13.0-1, full speed


Then I tried the first solution given in the Jack site that is using the alsa_in client wth the last card, like this

Code: Select all

alsa_in -j CartSON2 -d hw:4 -c 2 -p 64 -n 2 -r 48000 -f 50000

This command is issued after I launch JACK on the first USB card ( hw:3)
I launch Ardour5 with 4 audio tracks and set the 2 first on the first card and the 2 others on the second (labelled CARTSON2). Everything is OK until now.
I expected a drift between the 4 tracks but it's worse ; the two tracks recorded with the alsa_in client are marred by a very strong 150 Hz or so.
Of course I had chosen the same 48000 Hz resolution for both cards and a buffer size of 128 = 2 x 64.
I tried to reverse the cards but the same fault follows the card defined as an alsa_in client.
Anyone got an idea where it can come from ?

I also tried the second solution ( just like Mark) including a new merge device with a PCM definition in the .asoundrc file but I can't see the result anywhere. Just as if the file wasn't read . Qjackctk and Cadence launch JACK as if .asoundrc did not exist. I checked after deleting .asoundrc : it did not change anything. :roll:

merlyn
Established Member
Posts: 172
Joined: Thu Oct 11, 2018 4:13 pm

Re: make stereo from 2 cheap USB sound cards each with mono in

Postby merlyn » Tue Mar 12, 2019 3:36 pm

What is the 150Hz like? A buzz or a sine tone? I can't think of a way this would originate in the digital domain. Is it an earth problem between the two cards?

jptrol
Established Member
Posts: 8
Joined: Sun Mar 10, 2019 9:57 am

Re: make stereo from 2 cheap USB sound cards each with mono in

Postby jptrol » Tue Mar 12, 2019 7:44 pm

merlyn wrote:What is the 150Hz like? A buzz or a sine tone? I can't think of a way this would originate in the digital domain. Is it an earth problem between the two cards?


It's a buzz but it is impossible that it comes from a earth problem : each card alone works perfectly well. I do not even touch the cards or the connections when I reverse the alsa_in client cards : the 150 Hz follows the card in alsa_in . I have made lots of recordings with those two cards and I have found the same problem with another PC computer. I think this 150 Hz, with harmonics I suppose, come from something of the delay or sampling or else but surely not from an electrical problem.

merlyn
Established Member
Posts: 172
Joined: Thu Oct 11, 2018 4:13 pm

Re: make stereo from 2 cheap USB sound cards each with mono in

Postby merlyn » Tue Mar 12, 2019 10:26 pm

Have you checked the JACK connections and made sure an output isn't connected to an input in JACK and you're getting feedback?

jptrol
Established Member
Posts: 8
Joined: Sun Mar 10, 2019 9:57 am

Re: make stereo from 2 cheap USB sound cards each with mono in

Postby jptrol » Wed Mar 13, 2019 1:11 pm

merlyn wrote:Have you checked the JACK connections and made sure an output isn't connected to an input in JACK and you're getting feedback?


Here is one of the sequences I made ( this one on a former dual-core system with JACK launched on the EDIROL UA25 as hw:1).

ALSA_IN command : launching as CARTSON2 the USB Scarlet Focusrite 2i4 : OK

Image

Once I have launched Ardour that works fine without any loop, with Catia we see that the second card is launched but not yet connected :

Image

This card is now connected through Ardour5 (click to enlarge) :

Image

And this is the result :

Image

I disconnected the LTC , Linear TimeCode being useless here. But the result is always spoilt by this 150 Hz in which the audio is drowned.

merlyn
Established Member
Posts: 172
Joined: Thu Oct 11, 2018 4:13 pm

Re: make stereo from 2 cheap USB sound cards each with mono in

Postby merlyn » Wed Mar 13, 2019 2:04 pm

I had a look at

Code: Select all

man alsa_in

There are a lot of options, and -r is unnecessary. 'selected sample format 32 bit' seems a bit weird as the hardware won't be able to sample at 32 bits. That could be the internal resolution of course.


Return to “System Tuning and Configuration”

Who is online

Users browsing this forum: No registered users and 1 guest