You are not logged in.

#1 2015-10-11 06:05:56

kinleyd
Member
From: Bhutan
Registered: 2012-09-21
Posts: 142

[solved... finally] jack, latency and the unforgiving xruns

I've been using jack2dbus, and have been able to get a latency of about 5ms after playing with jack settings, but continue to get periodic xruns.

So having tried nearly about 30 - 40 suggested tweaks off the internet and not resolving the problem (short of trying linux-rt), I gave a closer look at enabling threadirqs and using rtirq.

Alas, my periodic xruns turned into a torrent, requiring a reboot shortly after I start jack. Worse, removing rtirq as well as disabling threadirqs didn't get me back to status quo - the xrun torrent and system freeze continued!

I'm on Linux 4.2.2-1 x86_64.

I haven't yet reinstalled the linux kernel as I'm considering giving linux-rt a stab, but any thoughts on what the problem could be are welcome.

Thanks.

Edited subject to better reflect the core issue - xruns.

Last edited by kinleyd (2015-11-06 08:57:37)

Offline

#2 2015-10-11 06:47:08

hifi25nl
Member
Registered: 2011-05-07
Posts: 263

Re: [solved... finally] jack, latency and the unforgiving xruns

I think the best solution for now is using linux-rt. You don't need to compile it. There are two repositories

[coderkun-aur-audio]
Server = http://arch.coderkun.de/$repo/$arch/

[archaudio-production]
Server = http://repos.archaudio.org/$repo/$arch

The first with CPU governor set to "performance"

I would try first to disable wifi (atheros drivers for example).
What is the configuration in jack?

Offline

#3 2015-10-11 10:23:52

kinleyd
Member
From: Bhutan
Registered: 2012-09-21
Posts: 142

Re: [solved... finally] jack, latency and the unforgiving xruns

Thanks @hifi25nl.

I don't have a wifi connection, just ethernet working off an Atheros nic. Here's my jackdbus setup:

<option name="driver">alsa</option>
  <option name="realtime">true</option>
  <option name="realtime-priority">80</option>
 </engine>
 <drivers>
  <driver name="loopback">
  </driver>
  <driver name="alsa">
   <option name="device">hw:Plus,0</option>
   <option name="capture">hw:Plus,0</option>
   <option name="playback">hw:PCH,0</option>
   <option name="rate">48000</option>
   <option name="period">256</option>
   <option name="nperiods">2</option>
   <option name="softmode">false</option>
   <option name="monitor">false</option>
   <option name="inchannels">0</option>
   <option name="outchannels">0</option>
  </driver>

Re rt kernels: I tried downloading linux-rt and linux-rt-lts off the AUR but had some problems with pgp verification which I'll have to look into. Are those different from the ones you linked to or more recommendable?

Thanks again,

Kinley

Offline

#4 2015-10-11 10:37:52

hifi25nl
Member
Registered: 2011-05-07
Posts: 263

Re: [solved... finally] jack, latency and the unforgiving xruns

Why are you using Loopback device? Can you test first with alsa device?

Offline

#5 2015-10-11 10:54:51

kinleyd
Member
From: Bhutan
Registered: 2012-09-21
Posts: 142

Re: [solved... finally] jack, latency and the unforgiving xruns

I think it's all alsa. The loopback section you see is just the xml placeholder, if I understand it correctly.

Offline

#6 2015-10-11 15:16:17

kinleyd
Member
From: Bhutan
Registered: 2012-09-21
Posts: 142

Re: [solved... finally] jack, latency and the unforgiving xruns

Wow. This is really strange. I reverted to an earlier kernel in /var/cache/pacman/pkg using pacman -U and still got the system breaking torrent of xruns. Then I installed linux-rt off the aur - same problem!

Any ideas why the problem introduced by enabling threadirqs is becoming such a zombie problem? Halp!

Kinley

Edit: Hmm. It seems my shifting my M-Track Plus to another USB jack (of the same type) was causing that torrent of xruns. Shifted it back, and tweaking with Cadence on linux-rt is giving me some low, low latency (2.7 ms) with far fewer xruns than before. I'm hoping I'm going to hit a sweet spot with no xruns. smile

Last edited by kinleyd (2015-10-11 16:09:31)

Offline

#7 2015-10-13 05:44:41

kinleyd
Member
From: Bhutan
Registered: 2012-09-21
Posts: 142

Re: [solved... finally] jack, latency and the unforgiving xruns

So I went through a lot of stuff. From using the standard kernel with threadirqs and rtirq, to installing the linux-rt kernel. Then, with Guitarix as my primary reason for using jack, from a jack2 configuration with jack2-dbus and cadence, and back to jack with qjackctl (the combination that I now prefer, especially after finding out that jack2 is mostly just a C++ implementation of jack and not its successor).

Great experience, but. I still get xruns!

Both on the standard and the rt kernel when starting up with something like:
jackd -dalsa -r48000 -p256 -n3 -D -Chw:Plus,0 -Phw:PCH,0

Cadence with jack2-dbus reports a latency of 5.3 ms and I get about 1 xrun every five minutes.
And qjackctl with jack reports a latency of 16 ms with 1 xrun every five minutes.

I'm not sure why jack has a higher latency than jack2-dbus for similar option settings. I guess I'll just have to keep chipping and tweaking away! sad

Last edited by kinleyd (2015-10-13 07:10:34)

Offline

#8 2015-10-13 07:30:28

ooo
Member
Registered: 2013-04-10
Posts: 1,638

Re: [solved... finally] jack, latency and the unforgiving xruns

Did you remember to enable realtime priorities for your user/group via limits.conf?

kinleyd wrote:

especially after finding out that jack2 is mostly just a C++ implementation of jack and not its successor

There are more differences than that, like SMP and dbus support on jack2 to name a few.

Offline

#9 2015-10-13 08:25:34

kinleyd
Member
From: Bhutan
Registered: 2012-09-21
Posts: 142

Re: [solved... finally] jack, latency and the unforgiving xruns

ooo wrote:

Did you remember to enable realtime priorities for your user/group via limits.conf?

kinleyd wrote:

especially after finding out that jack2 is mostly just a C++ implementation of jack and not its successor

There are more differences than that, like SMP and dbus support on jack2 to name a few.

Yes, was aware of SMP and dbus support. It was more that after having figured out the ins and outs of jack_control, I preferred the jackd approach for setting startup options.

Re limits.conf settings I must admit I was totally clueless about that. However, it turns out it was all set up by default with the group audio, of which I had added myself as a member. I increased rtprio from 65 to 99 and memlock from 40000 to 250000 following a quick Google but haven't yet seen any improvements. Will tweak and see.

Thank you for the tip.

Offline

#10 2015-10-13 14:05:07

ooo
Member
Registered: 2013-04-10
Posts: 1,638

Re: [solved... finally] jack, latency and the unforgiving xruns

kinleyd wrote:

It was more that after having figured out the ins and outs of jack_control, I preferred the jackd approach for setting startup options.

I can 100% agree with that. In the end the idea is that applications would start using the dbus interface for controlling jack and you wouldn't need to configure it from command line at all. It also enables pulseaudio to play smoothly along with jack etc.

The SMP support however could probably be beneficial to performance. I believe if you install jack2, and use it with the legacy jackd binary you'd also benefit from SMP support compared to using jackd from 'jack' package.

kinleyd wrote:

Re limits.conf settings I must admit I was totally clueless about that. However, it turns out it was all set up by default with the group audio, of which I had added myself as a member. I increased rtprio from 65 to 99 and memlock from 40000 to 250000 following a quick Google but haven't yet seen any improvements. Will tweak and see.

Enabling realtime priority for your user is way more important than linux-rt, rtirq etc. Good to know that it's configured in by default these days. Apparently jack also provides limits.d/99-audio.conf that increases the rlimit to 99 and unlimited memlock.

Did you also check from jackd output/qjackctl that jack is actually started and running with realtime priority without any issues?

Also check out the pro audio page from arch wiki for plenty of tips, if you haven't already: https://wiki.archlinux.org/index.php/Pro_Audio

good luck with tweaking :)

Offline

#11 2015-10-13 14:36:00

kinleyd
Member
From: Bhutan
Registered: 2012-09-21
Posts: 142

Re: [solved... finally] jack, latency and the unforgiving xruns

ooo wrote:

Apparently jack also provides limits.d/99-audio.conf that increases the rlimit to 99 and unlimited memlock.

Did you also check from jackd output/qjackctl that jack is actually started and running with realtime priority without any issues?

Yes, limits.d/99-audio.conf was also there by default with those settings.

And yes, jack was running with realtime properties. The only issue was this message:

connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed

Googling tells me this is an error message that itself is an error. Not sure about that, but qjackctl has RT blinking on it.

Thanks for all the tips. I really have to figure this out! smile

Last edited by kinleyd (2015-10-13 14:36:33)

Offline

#12 2015-10-14 06:19:52

kinleyd
Member
From: Bhutan
Registered: 2012-09-21
Posts: 142

Re: [solved... finally] jack, latency and the unforgiving xruns

The end of the road for now sad :

Couldn't do better than a latency of 16ms with about 1 xrun every five minutes with:
$ jackd -dalsa -r48000 -p256 -n3 -S -D -Chw:Plus -Phw:PCH
whether I used the standard or the linux-rt kernel.

Could it be that my built in audio system isn't up to it?
00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)

I also have this installed: 01:00.1 Audio device: NVIDIA Corporation GK104 HDMI Audio Controller (rev a1) and my guitar input device is an M-Audio M-Track Plus. Anyone have any poor jack experience with any of these?:

The rest of my system is quite decently specced: Core i7-3770 CPU, 16 GB RAM, SSD, etc. so I'm really quite surprised with this problem.

Last edited by kinleyd (2015-10-15 11:12:33)

Offline

#13 2015-11-06 08:56:49

kinleyd
Member
From: Bhutan
Registered: 2012-09-21
Posts: 142

Re: [solved... finally] jack, latency and the unforgiving xruns

Offline

Board footer

Powered by FluxBB