USB Audio Interface JACK Xruns on Linux but not on Windows

Talk about your MIDI interfaces, microphones, keyboards...

Moderators: MattKingUSA, khz

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

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by merlyn »

What does

Code: Select all

/etc/init.d/rtirq status
show?
vittopascu

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by vittopascu »

merlyn wrote:What does

Code: Select all

/etc/init.d/rtirq status
show?
Still thank you very much for your help, here it is:

PID CLS RTPRIO NI PRI %CPU STAT COMMAND
140 FF 90 - 130 0.6 S irq/27-xhci_hcd
131 FF 85 - 125 0.0 S irq/17-ehci_hcd
135 FF 85 - 125 0.1 S irq/18-ohci_hcd
133 FF 84 - 124 0.0 S irq/17-ehci_hcd
136 FF 84 - 124 0.0 S irq/18-ohci_hcd
134 FF 83 - 123 0.0 S irq/17-ehci_hcd
137 FF 83 - 123 0.0 S irq/18-ohci_hcd
138 FF 82 - 122 0.0 S irq/18-ohci_hcd
657 FF 80 - 120 0.0 S irq/16-snd_hda_
658 FF 80 - 120 0.0 S irq/29-snd_hda_
72 FF 50 - 90 0.0 S irq/9-acpi
142 FF 50 - 90 0.0 S irq/8-rtc0
250 FF 50 - 90 0.0 S irq/14-pata_ati
251 FF 50 - 90 0.0 S irq/15-pata_ati
256 FF 50 - 90 0.0 S irq/19-ahci[000
820 FF 50 - 90 0.1 S irq/16-ath9k
1432 FF 50 - 90 0.0 S irq/28-enp5s0
1443 FF 50 - 90 0.5 S irq/31-nvidia
1444 FF 49 - 89 0.9 S irq/31-s-nvidia
7 TS - 0 19 0.1 S ksoftirqd/0
17 TS - 0 19 0.0 S ksoftirqd/1
23 TS - 0 19 0.0 S ksoftirqd/2
29 TS - 0 19 0.0 S ksoftirqd/3
35 TS - 0 19 0.0 S ksoftirqd/4
41 TS - 0 19 0.0 S ksoftirqd/5
47 TS - 0 19 0.0 S ksoftirqd/6
53 TS - 0 19 0.0 S ksoftirqd/7
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by merlyn »

That looks good. Your soundcard has the highest priority. You could raise it to 95 by editing /etc/rtirq.conf with

Code: Select all

RTIRQ_PRIO_HIGH=99
and lower the priority of all other interrupts with

Code: Select all

RTIRQ_RESET_ALL=1
I don't think that is what is causing an Xrun every 50 seconds, though. To diagnose that you could use htop and see if a process becomes active, or watch messages 'live' with

Code: Select all

sudo journalctl -f
if your system uses systemd
vittopascu

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by vittopascu »

Sadly I could see nothing particularly suspicious. The only thing was this error message:

[pulseaudio] module-jack-source.c: JACK error >Cannot use real-time scheduling (RR/94)(1: Operation not permitted)

when starting Jack, but it has to da with PulseAudio. Disabling the option "Enable JACK D-Bus interface" in qjackctl makes the error disappear (and will not route audio to and from PulseAudio) but the infamour xrun is still there...

However I noticed something interesting, I was looking at the system monitor, which gives me a time-line of the CPU load, and it seems that there is a small CPU spike exactly once every 50 seconds only when JACK is running. Stopping JACK will instantly give me a completely flat (0-1%) CPU usage. However I cannot single out what is causing it or whether it is the cause or a consequence of these xruns.

Another interesting thing is that running JACK in playback only generated no xruns (except when I start reaper or I open chrome. In that configuration I can play a MIDI keyboard and hear my virtual synth without any significant latency (I am very picky about it so if I don't find it annoying it has to be below 5ms).

I have seen this post: viewtopic.php?f=6&t=14759&start=15

I tried to replicate those settings and indeed I get duplex without xruns but I cannot get any decent latency out of it, is there something that can be done to improve the situation?
glowrak guy
Established Member
Posts: 2315
Joined: Sat Jun 21, 2014 8:37 pm
Been thanked: 251 times

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by glowrak guy »

vittopascu wrote:Hello,
Now I have the situation where I get an xrun exactly every exactly 50 seconds, even with wifi disabled. What could the cause be? Is there a way to diagnose what could be interfering at such regular intervals?
could be something poling for a cd/dvd, could be power-management, could be
a temperature check, an rss feed checker, malware looking for new data...

use a stopwatch, and view top or htop listings for running processes,
and do some screengrabs so you can view them at leisure,
and find some culprit(s)
Good hunting to you! 8)

(are you talking about audible xruns, pop-click-glurge etc
heard when a recording is played back? )
vittopascu

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by vittopascu »

glowrak guy wrote: (are you talking about audible xruns, pop-click-glurge etc
heard when a recording is played back? )
Yes very audible, they produce a single hard pop that is way louder than the rest of the audio stream.

Thank you for your valuable advice, I will do some research and come back to you if I solve the issue :)
rghvdberg
Established Member
Posts: 1067
Joined: Mon May 12, 2014 7:11 am
Has thanked: 15 times
Been thanked: 36 times

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by rghvdberg »

Drumfix
Established Member
Posts: 299
Joined: Mon Jan 26, 2009 5:15 pm
Been thanked: 11 times

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by Drumfix »

Use 48 or 96 samples with 3 buffers. And forget about the reported latencies on W10, except if they were measured with the RTL utility from oblique audio.
vittopascu

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by vittopascu »

Hi, yes I stumbled upon that post some days ago and I tried that solution. Bringing the setting from 128/2 to 128/3 causes the xruns to occur exactly every 2 minutes, as opposed to the 50 seconds from before. However 8ms is the kind of latency that one begins to feel, especially while playing guitar so I would rather not go above that.

Another interesting fact is that is I use the on-board audio chip I can reach lower latency without xruns, even if the IRQ is not on top of the priority list...

Also, I was measuring the frequency of the xruns with various buffer settings and there seems to be a roughly exponential relationship between the buffer length and the period between consecutive xruns. Note that the period is very exact and never "skips a beat" so it seems a very deterministic behaviour.

Fs = 48kHz

16/3 -> 14-15s
32/3 -> 28-30s
64/3 -> 50s
128/3 -> 110-120s
256/3 -> 4min
512/3 -> 12min

Also, the fact that the relation between buffer length and intra-xrun-period is so exact hints to the fact that it migh not be caused by an external periodic process. I also want to point out that this happened exactly the same with a fresh installation of Ubuntu studio disco dingo.

However, I also noticed that if I stop JACK somewhen between xruns and then I start it again, the first xrun happens one "period" after starting jack, so the xrun occurrence is relative to the moment jack is started.
Last edited by vittopascu on Thu Jun 13, 2019 10:16 pm, edited 1 time in total.
Drumfix
Established Member
Posts: 299
Joined: Mon Jan 26, 2009 5:15 pm
Been thanked: 11 times

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by Drumfix »

Then it looks as if ALSA does not use implicit feedback for synchronization of input and output for this device. Changing this requires a kernel patch.
vittopascu

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by vittopascu »

Drumfix wrote:Then it looks as if ALSA does not use implicit feedback for synchronization of input and output for this device. Changing this requires a kernel patch.
I have absolutely no idea what that means, why it is specific to my hardware, how to find out if that is actually the cause and, finally, how to actually get it fixed :) :)
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by merlyn »

Did you try a 48 buffer?
vittopascu

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by vittopascu »

merlyn wrote:Did you try a 48 buffer?
It is not among the available options
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by merlyn »

Just type it in. :)
vittopascu

Re: USB Audio Interface JACK Xruns on Linux but not on Windows

Post by vittopascu »

merlyn wrote:Did you try a 48 buffer?
Nope, still no difference. For a moment there I thought it was fixed but then I realized I was in "playback only" mode. For some reason I have no xruns (not reported nor audible) in playback only mode, but in duplex mode I always have my standard periodic dropout.
Post Reply