Trying to run 2 jackd, one for Guitarix

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
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

Trying to run 2 jackd, one for Guitarix

Post by bluebell »

I have to run Qtractor with a buffersize of 128 to 512, depending on the song's CPU hungriness.

Guitarix runs fine with a buffersize of 32, so I'd like to combine this "ready made" guitar sound with the direct monitoring of my audio interface. Fortunately Ihave 2 audio interfaces, so I'll try to run jackd with a bigger buffersize for Qtractor and another jackd with a smaller buffersize for Guitarix. Then I try to feed the output of the audio interface used for Guitarix to the input of the "main" audio interface.

This way I want to get the perfect solution. Let's see.

EDIT:
Wow, that works like a charm. Of course I have to start the 2nd jackd with another name and start Guitarix with a shell scrip that sets this name.

Code: Select all

jackd -n git -dalsa -r48000 -p32 -n3 ...
The shell script for Guitarix is:

Code: Select all

#!/bin/bash

JACK_DEFAULT_SERVER=git
export JACK_DEFAULT_SERVER

guitarix
EDIT2:
As far as I understand those 2 jackd (with their client programs!) can distribute over CPU cores so having more than 1 core really makes sense.

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

tramp
Established Member
Posts: 2335
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 454 times

Re: Trying to run 2 jackd, one for Guitarix

Post by tramp »

Sounds like a nice advanced setup.

For guitarix, you could set the jack servername with the -s parameter, so start guitarix with

Code: Select all

guitarix -s git
will spare you the export.

regards
hermann
On the road again.
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: Trying to run 2 jackd, one for Guitarix

Post by bluebell »

Thanks. I think I will start the 2nd jackd in this script, too, so the 2nd jackd is only active when needed.

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

gimmeapill
Established Member
Posts: 564
Joined: Thu Mar 12, 2015 8:41 am
Has thanked: 44 times
Been thanked: 8 times

Re: Trying to run 2 jackd, one for Guitarix

Post by gimmeapill »

Very nice ;-)

I tried it as well a while ago, but with a single audio interface and that didn't go very well: I tried to use Zita-ajbridge to connect both jack instances (possibly also with a loopback, I don't remember very well).
The outcome was mostly a flock of xruns - which defeats the original purpose of having one extremely low latency instance where needed (guitarix) and more relaxed settings for the DAW side.
But it is good to hear that it works with 2 discrete audio interfaces. Any issues with sound quality or synchronization?
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: Trying to run 2 jackd, one for Guitarix

Post by bluebell »

gimmeapill wrote:Very nice ;-)

I tried it as well a while ago, but with a single audio interface and that didn't go very well: I tried to use Zita-ajbridge to connect both jack instances (possibly also with a loopback, I don't remember very well).
The outcome was mostly a flock of xruns - which defeats the original purpose of having one extremely low latency instance where needed (guitarix) and more relaxed settings for the DAW side.
But it is good to hear that it works with 2 discrete audio interfaces. Any issues with sound quality or synchronization?
Since the interfaces are not connected between the 2 jackd there is no need for any synchronsisation or resampling.
The connection is made on the analog audio side.
Sound quality is perfect as far as I can say.

The only hassle is having to use 2 different audio interfaces since Linux and its USB stack cannot distinguish 2 identical Focusrites. So I use a 2i4 as "main" interface and a Solo for the guitar.

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

gimmeapill
Established Member
Posts: 564
Joined: Thu Mar 12, 2015 8:41 am
Has thanked: 44 times
Been thanked: 8 times

Re: Trying to run 2 jackd, one for Guitarix

Post by gimmeapill »

Sorry, I meant latency compensation rather that synchronization.
But actually in your case it should be exactly the same as recording live guitar straight into a DAW, so nevermind.

The resampling however does happen, since you go out of the Guitarix soundcard to the qtracktor soundcard using analog jacks.
So if I understand the signal chain correctly, the signal of the guitar goes

Code: Select all

Guitar->AD->Guitarix->DA->audio cables->AD->Qtractor-> DA -> main out.
                                       |-> Direct monitoring
= gets converted two times from analog to digital (at least the recorded part) - not that there is necessarily something wrong with that.

But if this really allows to isolate the DSP loads and run several applications at different latencies on the same system, then I think you just invented "audio workload containerization" :)

The requirement for dedicated audio interfaces of different models is however annoying.
So I'm still wondering if it wouldn't be possible to achieve the same result yet only in software by having the low latency jack instance using the physical interface, and the high latency one using a virtual loopback as a dummy interface and zita-bridges connected to the first instance.
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: Trying to run 2 jackd, one for Guitarix

Post by bluebell »

gimmeapill wrote: The resampling however does happen, since you go out of the Guitarix soundcard to the qtracktor soundcard using analog jacks.
So if I understand the signal chain correctly, the signal of the guitar goes

Code: Select all

Guitar->AD->Guitarix->DA->audio cables->AD->Qtractor-> DA -> main out.
                                       |-> Direct monitoring
Yes, resampling does happen but not in the PC (alsa_in/out, audioadapter ...) what brought lots of problems when I tried.
gimmeapill wrote: But if this really allows to isolate the DSP loads and run several applications at different latencies on the same system, then I think you just invented "audio workload containerization" :)

The requirement for dedicated audio interfaces of different models is however annoying.
So I'm still wondering if it wouldn't be possible to achieve the same result yet only in software by having the low latency jack instance using the physical interface, and the high latency one using a virtual loopback as a dummy interface and zita-bridges connected to the first instance.
I don't know why there is no way to get the Scarletts' serial numbers to distinguish between them. It's annoying.

Dire Straits sing "Check out Guitar-George, he knows all the chords".
I sing "Check out bluebell, he tried all the resamplings (and got all the problems you can think of and even more)"

Alsa_out crashed as soon as I started Audacity (which seems to kill alsa_out when scanning for interfaces).
Similar thing with zita-stuff.
Loading audioadapter into jackd kept increasing the ringbuffer (and so the latency) without any observable reason.
Using a network connection on the loopback interface to couple 2 jackds, bad latency.

But I made these experiences when trying to use 2 audio interfaces that had no means for hardware sync (Scarlett 2i2, 2i4, Solo). Maybe you get better results with your attempt with only one audio interface.

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

gimmeapill
Established Member
Posts: 564
Joined: Thu Mar 12, 2015 8:41 am
Has thanked: 44 times
Been thanked: 8 times

Re: Trying to run 2 jackd, one for Guitarix

Post by gimmeapill »

Ah, ok. I see very well where's you've been with those resamplers.
I'm not going down that rabbit hole again (at least in the current state of technology) - life is just too short ;-)

If the need really arise, I'd rather drop Guitarix and use my analog signal chain (I hope Tramp doesn't read this :D), or do the two interface thing - that's brilliant!
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: Trying to run 2 jackd, one for Guitarix

Post by bluebell »

gimmeapill wrote:Ah, ok. I see very well where's you've been with those resamplers.
I'm not going down that rabbit hole again (at least in the current state of technology) - life is just too short ;-)

If the need really arise, I'd rather drop Guitarix and use my analog signal chain (I hope Tramp doesn't read this :D), or do the two interface thing - that's brilliant!
I'd add that you could use your good interface for Guitarix and the builtin interface with big buffer sizes for the DAW. Since the preamp in your good interface does the main job your builtin interface already gets line level input.

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: Trying to run 2 jackd, one for Guitarix

Post by bluebell »

My

Code: Select all

/usr/local/bin/guitarix.sh
looks like this:

Code: Select all

#!/bin/bash

FREQ=48000
BUFFERS=3
PERIODSG=32
PRIO=90

M="2i2"
M="Solo"

HW=`aplay -l | grep $M | cut -d : -f 1 | cut -d " " -f 2`
if [ -n "$HW" ]
then
/usr/bin/jackd -n git -P$PRIO -p512 -t2000 -dalsa \
  -r$FREQ -p$PERIODSG -n$BUFFERS -Xseq -dhw:$HW \
  >/tmp/jackd-hmg.log 2>&1 &

JACKPID=$!
jack_wait -w
guitarix -s git
kill -9 $JACKPID
fi

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

Post Reply