XRUNS ... but why?

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

XRUNS ... but why?

Post by lilith »

Today I was trying with support from JackWinter to get rid of my xruns which I observe with low buffer sizes below 512 samples and rather large projects with lots of VSTs at DSP loads of around ~60%. My system is Debian Stretch with added KXrepositories. First thing we checked is if the right settings in

Code: Select all

cat /etc/security/limits.conf
@audio - rtprio 99
@audio - memlock unlimited
@audio - nice -10

where set, which is obviously the case. Next important thing is to optimize the priority of the interrupt handlers of the soundcard. When the KXrepos are added this is done via the Rtirq script (https://alsa.opensrc.org/Rtirq) automatically (more or less).

The interrupt handler of the soundcard can also be set manually higher by hand. First check the running processes with

Code: Select all

cat /proc/interrupts


and localize the process for which the interrupts are increasing the fastest (soundcard should have a lot to do, so let's run a big project in your DAW).

If you have localized the interrupt handler for the soundcard let's check it's PID with

Code: Select all

pgrep irq/xx
where xx is the number from the first column from

Code: Select all

cat /proc/interrupts
of the busiest process.

Setting the priority higher works with

Code: Select all

sudo chrt -f -p 95 yy
where yy is the output of the pgrep command.

Another thing which is important is to check that your audio interface connected to a USB bus where no other devices are connected. I my case it looks like:

Code: Select all

marco@fox:/etc$ lsusb
Bus 006 Device 002: ID 8087:8000 Intel Corp. 
Bus 006 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 002: ID 04e8:61f5 Samsung Electronics Co., Ltd 
Bus 005 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 004 Device 009: ID 046d:c069 Logitech, Inc. M-U0007 [Corded Mouse M500]
Bus 004 Device 008: ID 09e8:0076 AKAI  Professional M.I. Corp. LPK25 MIDI Keyboard
Bus 004 Device 007: ID 0835:8502 Action Star Enterprise Co., Ltd 
Bus 004 Device 006: ID 0835:8500 Action Star Enterprise Co., Ltd 
Bus 004 Device 005: ID 046a:0011 Cherry GmbH G83 (RS 6000) Keyboard
Bus 004 Device 004: ID 0835:8501 Action Star Enterprise Co., Ltd 
Bus 004 Device 003: ID 0835:8500 Action Star Enterprise Co., Ltd 
Bus 004 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 002: ID 1686:014f ZOOM Corporation 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
This is ok as my interface from ZOOM is connected to Bus 002 and no other device is connected to that Hub.

After doing all the appropriate changes I still get xruns with buffer sizes below 512 at DSP loads of ~60-85%. And the strange thing is that I get more xruns when switching desktop windows or browsing in chromium. Especially using the scroll wheel of the mouse seems to trigger xruns. When using 512 samples everything works fine, but of course adding more vst instruments will cause problems even at this buffer size.

Does anyone know where this might come from or what else can I check?

@JackWinter: If I have written bogus somewhere please correct me.
User avatar
d.healey
Established Member
Posts: 610
Joined: Fri Sep 22, 2017 8:33 pm
Has thanked: 274 times
Been thanked: 100 times

Re: XRUNS ... but why?

Post by d.healey »

Are you using Cadence of QjackCtl? When I was using Cadence I always had xruns, I have hardly any with QjackCtl.
David Healey
YouTube - Free HISE scripting and sample library dev tutorials
Libre Wave - Freedom respecting instruments and effects.
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: XRUNS ... but why?

Post by lilith »

I'm using Cadence. I'll make a test with QjackCtl now :shock:
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: XRUNS ... but why?

Post by lilith »

No change with QjackCtl. On the other hand Cadence is also started when starting QjackCtl.
User avatar
d.healey
Established Member
Posts: 610
Joined: Fri Sep 22, 2017 8:33 pm
Has thanked: 274 times
Been thanked: 100 times

Re: XRUNS ... but why?

Post by d.healey »

lilith wrote:No change with QjackCtl. On the other hand Cadence is also started when starting QjackCtl.
I removed Cadence completely so no idea how well they'll run together.
David Healey
YouTube - Free HISE scripting and sample library dev tutorials
Libre Wave - Freedom respecting instruments and effects.
stanlea
Established Member
Posts: 700
Joined: Wed Apr 25, 2012 9:49 pm
Has thanked: 41 times
Been thanked: 23 times

Re: XRUNS ... but why?

Post by stanlea »

Cadence and Qjackctl are mainly GUIs for jack services, so the problem is in the jack parameters under the hood.
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: XRUNS ... but why?

Post by khz »

If I only edit/route audio I have very few xruns. As soon as I work with MIDI I have much more xruns.
Can MIDI also be optimized for real-time?

Is that also the case with you that if you work with MIDI you have significantly more xruns?
. . . 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
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: XRUNS ... but why?

Post by lilith »

khz wrote:If I only edit/route audio I have very few xruns. As soon as I work with MIDI I have much more xruns.
Can MIDI also be optimized for real-time?

Is that also the case with you that if you work with MIDI you have significantly more xruns?
Sure, Midi VSTs is the problem here. I didn't test it yet, but I'm pretty sure that I can record with 128 samples without any xruns. As soon a lot of VSTs come into play I get xruns at DSP loads of up to ~80% (on average).
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: XRUNS ... but why?

Post by khz »

There are timers https://wiki.linuxaudio.org/wiki/system ... ion#timers but it seems that they are only available for ALSA.
Could the xrunś come from the fact that audio is processed in real time and MIDI is not, so MIDI will eventually be processed?
lilith wrote:Sure, Midi VSTs is the problem here.
It makes no difference whether it is LV2 or native VST MIDI, xruns generally occur with MIDI, no matter what MIDI.

Wish List: Is there a real-time optimization for jack MIDI?
. . . 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
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: XRUNS ... but why?

Post by lilith »

I mean software synths, not midi with external synths. I think in the end it doesn't matter if the DSP load is caused by VST synths or by recording a lot of audio tracks. Fact is I get xruns at ~80% DSP load and this is not expected.
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: XRUNS ... but why?

Post by khz »

Yes, software synthesizers controlled by MIDI.
If audio is processed in real time and MIDI is not processed in real time - i.e. MIDI is processed at some point (jitter) - this could be the problem. Two different priorities for a task (music).
. . . 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.
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: XRUNS ... but why?

Post by merlyn »

So you're thinking that you should only get Xruns when the CPU gets to 100%? That does seem sensible.

I've noticed DSP load goes up and down, so the figure you see must be an average, which will take out short lived spikes.

I set my irq prority on AVLinux by editing /etc/default/rtirq. That file is in a different location on Arch, so might be in a different location on your system.

Code: Select all

/etc/init.d/rtirq status
is useful. Again rtirq may be in a different place on your system.
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: XRUNS ... but why?

Post by khz »

?
Source: http://jack-audio.10948.n7.nabble.com/C ... 19580.html
. . . 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
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: XRUNS ... but why?

Post by lilith »

merlyn wrote:So you're thinking that you should only get Xruns when the CPU gets to 100%? That does seem sensible.

I've noticed DSP load goes up and down, so the figure you see must be an average, which will take out short lived spikes.

I set my irq prority on AVLinux by editing /etc/default/rtirq. That file is in a different location on Arch, so might be in a different location on your system.

Code: Select all

/etc/init.d/rtirq status
is useful. Again rtirq may be in a different place on your system.
No, not 100%, but maybe 90% :D We optimized the IRQ priority yesterday, so there's no problem here. Strange is also, that switching windows and working with the mouse causes more xruns.
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: XRUNS ... but why?

Post by merlyn »

Do you have an nvidia graphics card?
Post Reply