2 audio interfaces as input

Support & discussion regarding DAWs and MIDI sequencers.

Moderators: MattKingUSA, khz

tony-j
Established Member
Posts: 42
Joined: Fri Aug 25, 2017 11:36 pm
Has thanked: 6 times

2 audio interfaces as input

Post by tony-j »

Hello i'm on ubuntu studio from an year and i have a really nice question for you.

I own a Steinberg UR22 (1 stereo I/O) and it's really awesome thanks to its preamps for recording and play live.
I'm going to buy an UR44 (2 stereo I/O) to connect my ESXs directly to the audio interface without using a mixer.
I was wondering: is there a way to use this 2 audio interfaces together to record with 3 stereo input channels? Maybe using a jack script?

Well if the answer is " buy a device with more inputs" my question remain because of the interface that i already own.
I know the main problem is that the clocks would not go sync, but maybe connecting the MIDI ports of the two girls like master/slave system?
CrocoDuck
Established Member
Posts: 1133
Joined: Sat May 05, 2012 6:12 pm
Been thanked: 17 times

Re: 2 audio interfaces as input

Post by CrocoDuck »

tony-j wrote:I was wondering: is there a way to use this 2 audio interfaces together to record with 3 stereo input channels?
It can be possible, but it is quite tricky. You need to write an .asoundrc file. That file is an advanced configuration file for ALSA that allows, among other things, to create virtual devices out of one (or more, as you want to do) physical interfaces. Then, the system will use the virtual interface as a whole. This is the most common application example for your use case.
tony-j wrote:I know the main problem is that the clocks would not go sync, but maybe connecting the MIDI ports of the two girls like master/slave system?
If you have a way to slave them to the same clock I would go for it.
tony-j
Established Member
Posts: 42
Joined: Fri Aug 25, 2017 11:36 pm
Has thanked: 6 times

Re: 2 audio interfaces as input

Post by tony-j »

42low wrote:Can's answer for your specific interfaces.
But if i have more 'in sources' i can select on tracks which one to connect to. And although i don't use it that much, i can also make separate connections within Jack and then select within DAW.
do you mean like a bus that goes to the track ? like jamin do?
how do you do that with jack? it makes me choose only one between the internal card or the UR22, even if i want one for in and one for out, i have to use the script "alsa in , alsa out"
CrocoDuck wrote:
tony-j wrote:I was wondering: is there a way to use this 2 audio interfaces together to record with 3 stereo input channels?
It can be possible, but it is quite tricky. You need to write an .asoundrc file. That file is an advanced configuration file for ALSA that allows, among other things, to create virtual devices out of one (or more, as you want to do) physical interfaces. Then, the system will use the virtual interface as a whole. This is the most common application example for your use case.
well extremely thank you, this is a good choice, i'm reading the script, and it's making the two clocks of the interfaces slaves of the jack clock, do i have to change the number of inputs and playback as much as i have in my hardware? It requires S/PDIF to make the master/slave system as i thought, hope my URs can do that.
i'm little worried about the cpu's work of my laptop if it would be able to carry that.
He says it produce lots of xruns but you can't hear them. Well xruns sometimes could be heard when the sound is played loud. Let's try it and see.

In a year i barely learned to use Ardour, so now what's the direction of my path i've got to take to handle this sort of things? patchage and jackd?


42low wrote:
This wonders me.
One can build in two soundcards or screencards in a computer and those can be implemented together.
Software like jack, ardour and lmms can handle multiple sources.
But two interfaces (extensive soundcards) can't go together for real?

I'm not doubting it. It really wonders me.
How the ones who have several/many interfaces next to each other do that then?
well i think that they don't need it. Pro Studios and mastering houses have their big mixers with 18 channels, mics , hardware compressors and gates that costs thousands of dollars, because every instrument should have it's channel, and every element of the song should have its stereo track. They would preferes spend more for a single unit with more inputs. Even if the final result is a Stereo Output.
CrocoDuck
Established Member
Posts: 1133
Joined: Sat May 05, 2012 6:12 pm
Been thanked: 17 times

Re: 2 audio interfaces as input

Post by CrocoDuck »

tony-j wrote: well extremely thank you, this is a good choice, i'm reading the script, and it's making the two clocks of the interfaces slaves of the jack clock, do i have to change the number of inputs and playback as much as i have in my hardware? It requires S/PDIF to make the master/slave system as i thought, hope my URs can do that.
i'm little worried about the cpu's work of my laptop if it would be able to carry that.
He says it produce lots of xruns but you can't hear them. Well xruns sometimes could be heard when the sound is played loud. Let's try it and see.

In a year i barely learned to use Ardour, so now what's the direction of my path i've got to take to handle this sort of things? patchage and jackd?
I am not sure about where to start, a part trying to read as most as you can about .asoundrc documentation first. You can find plenty by googling, if you straggle I will try to dig out the pages I found some time ago.

I think that you will have to do some experiments and see how it goes. This is a pretty tricky thing, I never used .asoundrc a part for simple things. Perhaps, in your case everything will be made a bit more complicated by the fact you are trying to use different interfaces on the USB. USB configurations tend to be trickier due to the high number of interrupts from other hardware traveling down the USB hubs and controllers...
Frank Carvalho
Established Member
Posts: 363
Joined: Sat Nov 17, 2012 3:36 pm

Re: 2 audio interfaces as input

Post by Frank Carvalho »

On my main DAW I use the exact script shown above, as I have two M-Audio cards. But this scipt is specific to cards using ICE1712, and for your cards it will probably look somewhat different.

But I think there may be another workable solution. I use a remote PC as a headless NetJack slave to my main PC, serving remote sound I/O, with Jack on the remote slave being synced to the main PC master. Then I attach the remote sound card using the commands alsa_in and alsa_out.

What happens (I think) is, that alsa_in/out makes the sound card on hw:0 available to Jack, but without syncing their clocks. So I think the sound card runs on its own internal clock. I am not sure how many errors that will inject into the sound stream, but my experience with this setup is that it is not audible, so something along the way probably compensates for the out-of-syncedness.

EDIT: And indeed this is the case. According to the man page this is exactly what alsa_in/out does.

My suggestion is to try the same, with an ordinary instance of jack, syncing one sound card with jack, and making the second sound card available using alsa_in/out.

This is my NetJack script, for inspiration:

Code: Select all

#!/bin/bash

# Script to start daemon making this machine JACK slave
# Network latency is near 0, even with 20 channels I/O
# Latency is added by the sound cards at either end.

JDPID=`ps -ef | grep "/usr/bin/jackd" | gawk '{print $2}'`
PAPID=`ps -ef | grep "pulse" | gawk '{print $2}'`
if [ "$JDPID" ]
then
  kill -9 $JDPID
fi
if [ "$PAPID" ]
then
  kill -9 $PAPID
fi
/usr/bin/jackd -R -d net -C 20 -P 20 -i 12 -o 10 &
sleep 5
alsa_in  -j local_in  -d hw:0 -c 12 -r 48000 &
alsa_out -j local_out -d hw:0 -c 10 -r 48000 &
sleep 1
jack_connect system:capture_1 local_out:playback_1 
jack_connect system:capture_2 local_out:playback_2
jack_connect local_in:capture_1 system:playback_1
jack_connect local_in:capture_2 system:playback_2
PID=`ps -ef | grep "/usr/bin/jackd" | gawk '{print $2}'`
echo "jackd pid=$PID"
PID=`ps -ef | grep "alsa_in" | gawk '{print $2}'`
echo "alsa_in pid=$PID"
PID=`ps -ef | grep "alsa_out" | gawk '{print $2}'`
echo "alsa_out pid=$PID"
/Frank
Vox, Selmer, Yamaha and Leslie amplifiers. Rickenbacker, Epiphone, Ibanez, Washburn, Segovia, Yamaha and Fender guitars. Hammond, Moog, Roland, Korg, Yamaha, Crumar, Ensoniq and Mellotron keyboards. Xubuntu+KXStudio recording setup.
CrocoDuck
Established Member
Posts: 1133
Joined: Sat May 05, 2012 6:12 pm
Been thanked: 17 times

Re: 2 audio interfaces as input

Post by CrocoDuck »

@42low, I am not sure the problem is clear to you (or maybe I am misunderstanding what you type).

tony-j wants to use 2 different interfaces at the same time. Normally, Jack allows to use only one interface for capture and only one interface for playback. That means that if you want to use interface A and B for capture you can't.

Why using interface A and B? Because that will be like using one interface, but with more channels (the sum of channels of interface A and interface B). The Delta1010T is an interface very commonly exploited in this way.
CrocoDuck
Established Member
Posts: 1133
Joined: Sat May 05, 2012 6:12 pm
Been thanked: 17 times

Re: 2 audio interfaces as input

Post by CrocoDuck »

42low wrote: Sorry but i quess you missunderstand me then. I use 2 interfaces for capturing together next to each other.
Like i said, i can let channel A record IF A where channel B records IF B, all together, in one recording session. That's what's asked for, isn't it?
OK. I think it is a little bit clearer to me now, thanks. Sorry, but English is not my first language. So, to clarify, lets say interface A has 2 channels: A1 and A2. Then, interface B has four channels: B1, B2, B3, B4. Can you arrange an Ardour (or qtractor... whatever) session with 6 mono tracks and record simultaneously from all channels?

Interface channels___Ardour Track
A1---------------------->1
A2---------------------->2

B1---------------------->3
B2---------------------->4
B3---------------------->5
B4---------------------->6

This way you can record, for example, a band of 6 elements. tony-j is interested in this approach, if I got it correctly. If your solution allows for this, please let us know how you do it.
42low wrote:But i'm not looking for any debate on that
We are looking for a solution for a question, not for any debate.
tony-j
Established Member
Posts: 42
Joined: Fri Aug 25, 2017 11:36 pm
Has thanked: 6 times

Re: 2 audio interfaces as input

Post by tony-j »

42low wrote:I would say look what source options you have there to assign.
Like i said, the sources have to come in within the computer (and work when not some kind of conflict like I/O). The sources are there.
And if both sources come in the computer IMO should/could be visuable to choose and assign.
maybe you are talking about different kinds of signal, one analog (like a mic) and one digital (like a midi keyboard), the midi signal is bridged by the sound card but is handled by the cpu, that sends the kind of sound you've choosed, imho, but i really know nothing about midi stuff^^
CrocoDuck wrote:Why using interface A and B? Because that will be like using one interface, but with more channels (the sum of channels of interface A and interface B). The Delta1010T is an interface very commonly exploited in this way.
Thats right.
i work only with analog signals, for example lets take a rock group , you can record an entire song with only one mic (like i do now), but then you have only a track for all instruments and you have all the sounds mixed together. You can use that mic to record one instrument at the time, but the group has to play together to match better.
So every element must have its own mic and its own channel (for the drums even more than one) while they're playing together and each one should have his track to adjust faders EQs and panning, put compressors and gates,before and after. Only then the tracks are mixed into a Stereo one


unfortunately my UR22 does not have the S/PDIF I/O, same the UR44 so i can't use that good script, maybe there's not even an internal clock.

They don't process digital any information (except for the MIDIs) to give more space to the quality of the analog signal I/O.

42low wrote:I'm not that 'Jack' specialist while i mostly use alsa.
But in QjackXL i can make connections as also patchbay connections.
yep i do really need to start learning the patchbay stuff :roll:

Frank Carvalho wrote:On my main DAW I use the exact script shown above, as I have two M-Audio cards. But this scipt is specific to cards using ICE1712, and for your cards it will probably look somewhat different.

But I think there may be another workable solution. I use a remote PC as a headless NetJack slave to my main PC, serving remote sound I/O, with Jack on the remote slave being synced to the main PC master. Then I attach the remote sound card using the commands alsa_in and alsa_out.

What happens (I think) is, that alsa_in/out makes the sound card on hw:0 available to Jack, but without syncing their clocks. So I think the sound card runs on its own internal clock. I am not sure how many errors that will inject into the sound stream, but my experience with this setup is that it is not audible, so something along the way probably compensates for the out-of-syncedness.

EDIT: And indeed this is the case. According to the man page this is exactly what alsa_in/out does.

My suggestion is to try the same, with an ordinary instance of jack, syncing one sound card with jack, and making the second sound card available using alsa_in/out.

This is my NetJack script, for inspiration:
yeah thank you i'm really inspired.
I think that use the 2 soundcards with two different PCs is the easiest way, especially for a script kiddie like me. Even better if Jack can handle a network , to start the recordings at the same time. I don't care so much if the wave files are in different computers i can transfer them later.
I think it's a good solution even for use one to record and one to play in RT without overheating the CPU and get a faster performance than using only 1 processor.
Well in my path of knowledge seems to be only one big thing for now : JACKD JACKD JACKD!!!!!!!! :o

Thanks to you all for the answers !!! :o
Jack Winter
Established Member
Posts: 381
Joined: Sun May 28, 2017 3:52 pm

Re: 2 audio interfaces as input

Post by Jack Winter »

I didn't pay much attention to this thread, so maybe I'm stating the obvious.

It is possible to use 2 soundcards for I/O with JACK, but clocks will drift apart unless they can by synced by word clock, spdif, or adat.

For both JACK1 and JACK2, you can use the alsa_in/out utilities, there are also the zita-a2jbridge utilities that supposedly does better samplerate conversion (to compensate for the drifting clocks). JACK1 also has a builtin client (based on zita-a2jbridge), see the -A parameter. Seem to remember that ALSA itself also has some facility to do this, but am not sure about the details.
Reaper/KDE/Archlinux. i7-2600k/16GB + i7-4700HQ/16GB, RME Multiface/Babyface, Behringer X32, WA273-EQ, 2 x WA-412, ADL-600, Tegeler TRC, etc 8) For REAPER on Linux information: https://wiki.cockos.com/wiki/index.php/REAPER_for_Linux
Jack Winter
Established Member
Posts: 381
Joined: Sun May 28, 2017 3:52 pm

Re: 2 audio interfaces as input

Post by Jack Winter »

42low wrote: The clock has my doubts too.
Buf if both IFs connected/assigned with Ardour, don't the clocks get controled/synced by the Ardour clock as main?
No, that's done in hardware, maybe someday it could be under software control.

If you have one card running at 44102 and the other at 44098 Hz, they will drift apart, and either you'll have to skip samples, add silence or use samplerate conversion to make them appear to run the same samplerate. This is the reason that there are solutions to sync them, normally in a pro setting with word clock, but spdif or adat would work too.
Reaper/KDE/Archlinux. i7-2600k/16GB + i7-4700HQ/16GB, RME Multiface/Babyface, Behringer X32, WA273-EQ, 2 x WA-412, ADL-600, Tegeler TRC, etc 8) For REAPER on Linux information: https://wiki.cockos.com/wiki/index.php/REAPER_for_Linux
Frank Carvalho
Established Member
Posts: 363
Joined: Sat Nov 17, 2012 3:36 pm

Re: 2 audio interfaces as input

Post by Frank Carvalho »

yeah thank you i'm really inspired.
I think that use the 2 soundcards with two different PCs is the easiest way, especially for a script kiddie like me. Even better if Jack can handle a network , to start the recordings at the same time. I don't care so much if the wave files are in different computers i can transfer them later.
I think it's a good solution even for use one to record and one to play in RT without overheating the CPU and get a faster performance than using only 1 processor.
I wasn't suggesting you use NetJack, although obviously it will give some other advantages. I was suggesting you use the same technique to attach your second sound card to to the Jack setup, using alsa_in/out. But you should be able to do that on the same machine.

If you actually try NetJack, then make sure you have a gigabit connection between the two computers.

/Frank
Vox, Selmer, Yamaha and Leslie amplifiers. Rickenbacker, Epiphone, Ibanez, Washburn, Segovia, Yamaha and Fender guitars. Hammond, Moog, Roland, Korg, Yamaha, Crumar, Ensoniq and Mellotron keyboards. Xubuntu+KXStudio recording setup.
User avatar
English Guy
Established Member
Posts: 525
Joined: Wed Oct 17, 2012 7:28 pm
Location: England
Has thanked: 8 times
Been thanked: 7 times

Re: 2 audio interfaces as input

Post by English Guy »

Sorry I am late to the conversation. I have previously got two sound devices working with jack (one a soundcard, the other my USB interface).

I set jack up running the usb device then added the soundcard by running this command in a terminal

Code: Select all

alsa_in -j on-board -d hw:0 -c 2 -p 4 -n 512 -r 48000
Where hw:0 is the name of the internal card (your name may vary, check in qjackctl). The other settings matched the settings I already had used for jack.

You then need to make connections to get input and monitor etc.

Hope this helps.
tony-j
Established Member
Posts: 42
Joined: Fri Aug 25, 2017 11:36 pm
Has thanked: 6 times

Re: 2 audio interfaces as input

Post by tony-j »

English Guy wrote:Sorry I am late to the conversation. I have previously got two sound devices working with jack (one a soundcard, the other my USB interface).

I set jack up running the usb device then added the soundcard by running this command in a terminal

Code: Select all

alsa_in -j on-board -d hw:0 -c 2 -p 4 -n 512 -r 48000
Where hw:0 is the name of the internal card (your name may vary, check in qjackctl). The other settings matched the settings I already had used for jack.

You then need to make connections to get input and monitor etc.

Hope this helps.
Is this what you Frank were suggesting for?
isn't quite tricky at all if it works, because unfortunally the URs can't be synced with the clock and spdif ports.
thanks guys i really appreciate that.

let's check if i understood the concept for the records, because i can't do tests for a week, the alsa_in works as a jack client, this client will be visible in the capture section of the jack-server's connections, it has to be connected to the ardour out (that goes to the speakers).
Then i go in Ardour, to audio connections, i should see the client (maybe in the miscellaneous section of the audio-in), and connect it to a stereo track destination.(easier done than said) to have an indipendent audio-in source, is that right?
Frank Carvalho
Established Member
Posts: 363
Joined: Sat Nov 17, 2012 3:36 pm

Re: 2 audio interfaces as input

Post by Frank Carvalho »

tony-j wrote: Is this what you Frank were suggesting for?
isn't quite tricky at all if it works, because unfortunally the URs can't be synced with the clock and spdif ports.
thanks guys i really appreciate that.
Yes. Same suggestion
tony-j wrote: let's check if i understood the concept for the records, because i can't do tests for a week, the alsa_in works as a jack client, this client will be visible in the capture section of the jack-server's connections, it has to be connected to the ardour out (that goes to the speakers).
Then i go in Ardour, to audio connections, i should see the client (maybe in the miscellaneous section of the audio-in), and connect it to a stereo track destination.(easier done than said) to have an indipendent audio-in source, is that right?
alsa_in is the capture from sound card, so it should go to the inputs of Ardour
alsa_out is the output to sound card, so Ardour out from the master should to to alsa_out

When you configure the alsa_in and out, make sure to set number of channels to match your sound cards. Use Carla to set up the patchbay, and save the setting 'till next time. I always build small shell scripts to start everything.

/Frank
Vox, Selmer, Yamaha and Leslie amplifiers. Rickenbacker, Epiphone, Ibanez, Washburn, Segovia, Yamaha and Fender guitars. Hammond, Moog, Roland, Korg, Yamaha, Crumar, Ensoniq and Mellotron keyboards. Xubuntu+KXStudio recording setup.
Pablo
Established Member
Posts: 1274
Joined: Thu Apr 17, 2008 9:57 pm
Been thanked: 3 times

Re: 2 audio interfaces as input

Post by Pablo »

The OP needs two interfaces as _audio_ input for jack. You can't do that without resorting to alsa_in or zita-a2j (I haven't ever tried making a virtual device in some alsa configuration file, but that could be another option). I would just use alsa_in, as others have suggested.

42low, you are using two interfaces at the same time, but not both for audio input or both for audio output at the same time. In your case, I think, one them is for MIDI signals. No problem with that, but it's a very different thing.
Post Reply