2 interfaces, 2 jackd, couple them

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

User avatar
bluebell
Established Member
Posts: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

2 interfaces, 2 jackd, couple them

Post by bluebell »

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 – http://suedwestlicht.saar.de/

User avatar
bluebell
Established Member
Posts: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

Re: 2 interfaces, 2 jackd, couple them

Post by bluebell »

I found zita-njbridge as well. Latency is much lower than using jack-stdout/in for coupling 2 jackd.

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

User avatar
khz
Established Member
Posts: 1648
Joined: Thu Apr 17, 2008 6:29 am
Location: German
Has thanked: 42 times
Been thanked: 92 times

Re: 2 interfaces, 2 jackd, couple them

Post by khz »


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

nano /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
# Defining the default device >> https://wiki.archlinux.de/title/Advance ... ult-Device


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, edit ~/.asoundrc:

Code: Select all

nano ~/.asoundrc
to (example):

Code: Select all

    defaults.ctl.card 0
    defaults.pcm.card 0
    defaults.timer.card 0
# How to order the numbering of soundcards, if using ALSA drivers? >> https://wiki.linuxaudio.org/faq/start#q ... sa_drivers


4. Merge multiple sound cards into qjackctl:

A)
Setup > Advanced: "Server Prefix" select "jackd" (old jackdmp), ("H/W Monitor", "H/W Meter",) "Soft Mode", (RT) "Priority (0 - 99)" (https://linux.die.net/man/1/jackd, https://manpages.debian.org/buster/jackd2/)

audioadapter:
In qjackctl setting: Setup >> Options >> [X] Run script at startup

Code: Select all

jack_load -i "-d hw:1 -i16 -o16" 9632 audioadapter && jack_bufsize 128 &
-d <-- 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
<== Optional: For safety, possibly not mandatory. B)
Alsa2jack (MIDI):
install:

Code: Select all

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

Code: Select all

sleep 5 && a2jmidid -e -u &


##



((https://linuxaudio.github.io/libremusic ... -jack.html; https://web.archive.org/web/20200811001 ... -jack.html;
https://github.com/jackaudio/jackaudio. ... -and-jack2, https://github.com/jackaudio/jackaudio.github.com/wiki
# http://bandshed.net/pdf/ AVL2018UserManual.pdf >> AUDIO & MIDI IN AV LINUX

https://linux.die.net/man/1/jackd, https://manpages.debian.org/buster/jackd2/, https://man.archlinux.org/man/a2jmidid.1.en, https://www.freedesktop.org/wiki/Softwa ... itymodules, #https://wiki.debian.org/PipeWire#For_JACK
==> Install "a2jmidid" https://github.com/jackaudio/a2jmidid and "pulseaudio-module-jack" https://www.freedesktop.org/wiki/Softwa ... itymodules.)

In qjackctl Setup:
Jack with a2jmidid and pulseaudio:
  • Setup >> Settings > Parameters > MIDI Drivers "seq" or "none"
  • Setup >> Settings > Advanced > "Server Prefix" select "jackd" https://github.com/jackaudio/jack2/blob/master/README)
  • Setup >> Settings > Advanced > [X] Soft Mode
  • Setup >> Settings > Advanced > (RT) Priority (0 - 98)
  • Setup >> Options > [X] Run script after startup: "pacmd load-module module-jack-source channels=2 && pacmd load-module module-jack-sink channels=2 && sleep 5 && a2j -e -u &" (a2j enables dbus) or "sleep 5 && a2jmidid -e -u &" (without dbus)
  • Setup >> Options > [X] Execute script on Shutdown: "pulseaudio --kill"
  • Setup >> Options > [X] Execute script after Shutdown: "killall jackd"
  • Setup >> Misc > [X] Provide support for ALSA sequencer

Optional:
  • Setup >> Settings > Advanced > [X] H/W Monitor
  • Setup >> Settings > Advanced > [X] H/W Meter

Jack without pulseaudio:
  • Setup >> Options > [X] Execute script at startup: "systemctl --user stop pulseaudio.socket && systemctl --user stop pulseaudio.service"
  • Setup >> Options > [X] Run script after shutdown: "killall -9 jackd && systemctl --user start pulseaudio.socket && systemctl --user start pulseaudio.service")


=> In System sounds select the "pulseaudio-module-jack". https://www.freedesktop.org/wiki/Software/PulseAudio/)
. . . 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: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

Re: 2 interfaces, 2 jackd, couple them

Post by bluebell »

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 – http://suedwestlicht.saar.de/

User avatar
khz
Established Member
Posts: 1648
Joined: Thu Apr 17, 2008 6:29 am
Location: German
Has thanked: 42 times
Been thanked: 92 times

Re: 2 interfaces, 2 jackd, couple them

Post by khz »

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. ... r_NetJack2
2.) jack with multiple cards?: viewtopic.php?t=16062
3.) That's my original post: https://www.sequencer.de/synthesizer/th ... st-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: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

Re: 2 interfaces, 2 jackd, couple them

Post by bluebell »

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. ... r_NetJack2
2.) jack with multiple cards?: viewtopic.php?t=16062
3.) That's my original post: https://www.sequencer.de/synthesizer/th ... st-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 – http://suedwestlicht.saar.de/

User avatar
khz
Established Member
Posts: 1648
Joined: Thu Apr 17, 2008 6:29 am
Location: German
Has thanked: 42 times
Been thanked: 92 times

Re: 2 interfaces, 2 jackd, couple them

Post by khz »

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: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

Re: 2 interfaces, 2 jackd, couple them

Post by bluebell »

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 – http://suedwestlicht.saar.de/

User avatar
bluebell
Established Member
Posts: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

Re: 2 interfaces, 2 jackd, couple them

Post by bluebell »

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 – http://suedwestlicht.saar.de/

User avatar
khz
Established Member
Posts: 1648
Joined: Thu Apr 17, 2008 6:29 am
Location: German
Has thanked: 42 times
Been thanked: 92 times

Re: 2 interfaces, 2 jackd, couple them

Post by khz »

:-)
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: 82
Joined: Wed Mar 16, 2011 1:22 pm

Re: 2 interfaces, 2 jackd, couple them

Post by didgewind »

Now also included in the grandiose GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info.
Thanks, but, where is this?
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: 2 interfaces, 2 jackd, couple them

Post by merlyn »

didgewind wrote:Thanks, but, where is this?
It's in @khz's signature.
User avatar
bluebell
Established Member
Posts: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

Re: 2 interfaces, 2 jackd, couple them

Post by bluebell »

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 – http://suedwestlicht.saar.de/

merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: 2 interfaces, 2 jackd, couple them

Post by merlyn »

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: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

Re: 2 interfaces, 2 jackd, couple them

Post by bluebell »

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 – http://suedwestlicht.saar.de/

Locked