2 interfaces, 2 jackd, couple them

Optimize your system for ultimate performance.

Moderators: khz, MattKingUSA

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

2 interfaces, 2 jackd, couple them

Postby bluebell » Sun Jul 22, 2018 7:02 pm

As I wrote Ihave 2 interfaces and need all of their outputs.

My first attempt with alsa_out on the 2nd interface worked but when it ran with 48000 then starting Audacity broke it.

So I am using another setup now:

jackd (on interface 1)
jackd -n monitor (on interface 2)

They can be coupled:

Code: Select all

jack-stdout -q -e float "Calf Studio Gear:Equalizer 12 Band Out #1" "Calf Studio Gear:Equalizer 12 Band Out #2" | JACK_DEFAULT_SERVER=monitor jack-stdin -q -e float system:playback_1 system:playback_2


Advantage: seems to be very stable
Disadvantage: additional latency on the signal that goes to the 2nd jackd
Linux – MOTU UltraLite AVB – Qtractor – https://soundcloud.com/suedwestlicht

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

Re: 2 interfaces, 2 jackd, couple them

Postby bluebell » Sun Jul 22, 2018 8:08 pm

I found zita-njbridge as well. Latency is much lower than using jack-stdout/in for coupling 2 jackd.
Linux – MOTU UltraLite AVB – Qtractor – https://soundcloud.com/suedwestlicht

User avatar
khz
Established Member
Posts: 1241
Joined: Thu Apr 17, 2008 6:29 am
Location: German

Re: 2 interfaces, 2 jackd, couple them

Postby khz » Mon Jul 23, 2018 7:37 am


I did it with the "audioadapter" (4.), all in one qjackctl (Jack2) instance:
The boot sequence of the (PCI/PCIe) sound cards (Audio/MIDI interfaces) is important so that the same prerequisite (sound card sequence) is always given when the computer is started.

1. Define first sound card. What's in the computer:

Code: Select all

cat /proc/asound/cards

edit:

Code: Select all

/etc/modprobe.d/alsa.conf

Example, take what "/proc/asound/cards" says!

- same drivers :

Code: Select all

    options snd-ymfpci index=0
    options snd-hda-intel index=1,2

- different drivers:

Code: Select all

    options snd-emu10k1 index=0
    options snd-via82xx index=1



2. Save settings in alsamixer (as root), make settings for each sound card separately and save them:

Code: Select all

alsactl store



3. Programs take certain sound card:

Code: Select all

~/.asoundrc

Code: Select all

    defaults.ctl.card 0
    defaults.pcm.card 0
    defaults.timer.card 0

# https://wiki.linuxaudio.org/faq/start#qhow_to_order_the_numbering_of_soundcards_if_using_alsa_drivers


4. Merge multiple sound cards into qjackctl:

A)
Setup > Advanced: "Server Prefix" select "jackdmp", "H/W Monitor", "H/W Meter", "Soft Mode", (RT) "Priority (0 - 99)" (https://linux.die.net/man/1/jackd)
Setup >> Options >> [X] Run script at startup

Code: Select all

jack_load -i "-d hw:1 -i16 -o16" 9632 audioadapter && jack_bufsize 128 &

hw <-- you want to merge (sound card) (hw:1/hw:0/...)
-i <-- your number of sound card inputs
-o <-- your number of sound card outputs
9632 <-- as you want to call them (jackport name)
jack_bufsize <-- set the JACK buffer size

# https://github.com/jackaudio/jackaudio.github.com/wiki/WalkThrough_User_NetJack2


B)
Alsa2jack (MIDI):
install:

Code: Select all

a2jmidid

Setup >> Options >> [X] Run script after startup

Code: Select all

sleep 5 && a2jmidid -e &

FZ - Does humor belongs in Music?
GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info && GNU/Linux Debian installing >> Linux Audio Workstation LAW
    I don't care about the freedom of speech because I have nothing to say.

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

Re: 2 interfaces, 2 jackd, couple them

Postby bluebell » Mon Jul 23, 2018 8:49 am

khz wrote:>> http://jackaudio.org/faq/multiple_devices.html
I did it with the "audioadapter"


Interesting but I can't find the word "audioadapter" there. Where did you find docs about the audioadapter feature?
Linux – MOTU UltraLite AVB – Qtractor – https://soundcloud.com/suedwestlicht

User avatar
khz
Established Member
Posts: 1241
Joined: Thu Apr 17, 2008 6:29 am
Location: German

Re: 2 interfaces, 2 jackd, couple them

Postby khz » Mon Jul 23, 2018 9:06 am

No idea anymore. I was desperate and had searched the Internet for a solution. There were not much contributions/documentation and if then very different to it.
After several failed attempts of the different possibilities, the "audioadapter" worked. I documented it right away in the net because I and also other users maybe later want to have it easier.

1.) On the fast even that found: https://github.com/jackaudio/jackaudio.github.com/wiki/WalkThrough_User_NetJack2
2.) jack with multiple cards?: https://linuxmusicians.com/viewtopic.php?t=16062
3.) That's my original post: https://www.sequencer.de/synthesizer/threads/alsa-soundkartenreihenfolge.93441/page-3#post-1156186
FZ - Does humor belongs in Music?
GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info && GNU/Linux Debian installing >> Linux Audio Workstation LAW
    I don't care about the freedom of speech because I have nothing to say.

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

Re: 2 interfaces, 2 jackd, couple them

Postby bluebell » Mon Jul 23, 2018 10:24 am

khz wrote:No idea anymore. I was desperate and had searched the Internet for a solution. There were not much contributions/documentation and if then very different to it.
After several failed attempts of the different possibilities, the "audioadapter" worked. I documented it right away in the net because I and also other users maybe later want to have it easier.

1.) On the fast even that found: https://github.com/jackaudio/jackaudio.github.com/wiki/WalkThrough_User_NetJack2
2.) jack with multiple cards?: https://linuxmusicians.com/viewtopic.php?t=16062
3.) That's my original post: https://www.sequencer.de/synthesizer/threads/alsa-soundkartenreihenfolge.93441/page-3#post-1156186



Very interesting. I'll play around with it.

The solution "coupling 2 jackd with zita-j2n and zita-n2j" has the disadvantage that zita-j2n crashes when I change the bufsize of the jackd where it's connected to. Else it would be nearly perfect (low latency).
Linux – MOTU UltraLite AVB – Qtractor – https://soundcloud.com/suedwestlicht

User avatar
khz
Established Member
Posts: 1241
Joined: Thu Apr 17, 2008 6:29 am
Location: German

Re: 2 interfaces, 2 jackd, couple them

Postby khz » Mon Jul 23, 2018 11:47 am

I'm not sure right now if the "audioadapter" command is important. "audioadapter" may be superfluous.
The "jack_load" command is important!

Once you have found the working setting, please document it comprehensibly for other users.
Good documentation is so helpful! :-D
FZ - Does humor belongs in Music?
GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info && GNU/Linux Debian installing >> Linux Audio Workstation LAW
    I don't care about the freedom of speech because I have nothing to say.

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

Re: 2 interfaces, 2 jackd, couple them

Postby bluebell » Mon Jul 23, 2018 6:31 pm

khz wrote:I'm not sure right now if the "audioadapter" command is important. "audioadapter" may be superfluous.
The "jack_load" command is important!

Once you have found the working setting, please document it comprehensibly for other users.
Good documentation is so helpful! :-D


Code: Select all

jack_load -i "-d hw:2 " onboard audioadapter


onboard: the name as seen in qjackctl, can be chosen freely
audioadapter: the resampling module, name has to be exactly like this

That does the job on one of my machines. Changing bufsize seems to work. This is the most promising attempt.

In a few days I can test it on the other machine with 2 usb-interfaces.
Linux – MOTU UltraLite AVB – Qtractor – https://soundcloud.com/suedwestlicht

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

Re: 2 interfaces, 2 jackd, couple them

Postby bluebell » Wed Jul 25, 2018 5:56 pm

The audioadapter internal client is the best solution for me. I can't believe that it is so badly documented, especially the internal clients audioadapter and netadapter.

Scarlett 2i4:
jackd -p512 -t2000 -dalsa -r48000 -p128 -n2 -Xseq -dhw:1

Add Scarlett 2i2:
jack_load -i "-dhw:2 -p64 -r48000" 2i2 audioadapter
Linux – MOTU UltraLite AVB – Qtractor – https://soundcloud.com/suedwestlicht

User avatar
khz
Established Member
Posts: 1241
Joined: Thu Apr 17, 2008 6:29 am
Location: German

Re: 2 interfaces, 2 jackd, couple them

Postby khz » Wed Jul 25, 2018 6:28 pm

:-)
Now also included in the grandiose GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info. ;-)


Wish/Request/: @qjackctl @Cadence/Cadence-JackSettings
Offer audio and net adapters under "Settings >> Parameters"?
Would make sense IMHO :freedom: and so
FZ - Does humor belongs in Music?
GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info && GNU/Linux Debian installing >> Linux Audio Workstation LAW
    I don't care about the freedom of speech because I have nothing to say.

didgewind
Established Member
Posts: 77
Joined: Wed Mar 16, 2011 1:22 pm

Re: 2 interfaces, 2 jackd, couple them

Postby didgewind » Wed Nov 27, 2019 3:07 pm

Now also included in the grandiose GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info.


Thanks, but, where is this?

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

Re: 2 interfaces, 2 jackd, couple them

Postby merlyn » Wed Nov 27, 2019 3:16 pm

didgewind wrote:Thanks, but, where is this?

It's in @khz's signature.

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

Re: 2 interfaces, 2 jackd, couple them

Postby bluebell » Wed Nov 27, 2019 4:46 pm

Sorry but after some time I wasn’t happy with any solution. Audioadapter increased its buffer without reason, alsa_out crashed when I started Audacity and so on.

I bought a MOTU UltraLite AVB. It has a good internal mixer (with EQ) that can be controlled with a web browser. Problem solved.
Linux – MOTU UltraLite AVB – Qtractor – https://soundcloud.com/suedwestlicht

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

Re: 2 interfaces, 2 jackd, couple them

Postby merlyn » Wed Nov 27, 2019 6:11 pm

bluebell wrote: Audioadapter increased its buffer without reason,

I see. Is that while it was playing back? Or do you mean one day the latency was OK, then the next day the latency was bad?

I've used audioadapter and it seems pretty good. I haven't done involved testing. I use it with jackdbus so I use jack_control to set parameters.

Code: Select all

$ jack_control ip audioadapter
--- get internal parameters (type:isset:default:value)
            capture: Provide capture ports.  Optionally set device (str:notset:none:none)
            playback: Provide playback ports.  Optionally set device (str:set:none:none)
            device: ALSA device name (str:set:hw:0:hw:GR55)
            rate: Sample rate (uint:set:48000:44100)
            periodsize: Period size (uint:set:512:64)
            nperiods: Number of periods of playback latency (uint:notset:2:2)
            duplex: Provide both capture and playback ports (bool:set:True:True)
            in-channels: Number of capture channels (defaults to hardware max) (sint:notset:0:0)
            out-channels: Number of playback channels (defaults to hardware max) (sint:set:0:2)
            quality: Resample algorithm quality (0 - 4) (uint:set:0:0)
            ring-buffer: Fixed ringbuffer size (uint:set:32768:512)
         

The ringbuffer seems to affect latency the most. The default value is crazy high and I didn't see a value set for that in the command you posted above.

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

Re: 2 interfaces, 2 jackd, couple them

Postby bluebell » Thu Nov 28, 2019 6:13 am

merlyn wrote:
bluebell wrote: Audioadapter increased its buffer without reason,

I see. Is that while it was playing back? Or do you mean one day the latency was OK, then the next day the latency was bad?

I've used audioadapter and it seems pretty good. I haven't done involved testing. I use it with jackdbus so I use jack_control to set parameters.

Code: Select all

$ jack_control ip audioadapter
--- get internal parameters (type:isset:default:value)
            capture: Provide capture ports.  Optionally set device (str:notset:none:none)
            playback: Provide playback ports.  Optionally set device (str:set:none:none)
            device: ALSA device name (str:set:hw:0:hw:GR55)
            rate: Sample rate (uint:set:48000:44100)
            periodsize: Period size (uint:set:512:64)
            nperiods: Number of periods of playback latency (uint:notset:2:2)
            duplex: Provide both capture and playback ports (bool:set:True:True)
            in-channels: Number of capture channels (defaults to hardware max) (sint:notset:0:0)
            out-channels: Number of playback channels (defaults to hardware max) (sint:set:0:2)
            quality: Resample algorithm quality (0 - 4) (uint:set:0:0)
            ring-buffer: Fixed ringbuffer size (uint:set:32768:512)
         

The ringbuffer seems to affect latency the most. The default value is crazy high and I didn't see a value set for that in the command you posted above.


The ringbuffer increased after some minutes of operation to ridiculous large values.
Linux – MOTU UltraLite AVB – Qtractor – https://soundcloud.com/suedwestlicht


Return to “System Tuning and Configuration”

Who is online

Users browsing this forum: No registered users and 1 guest