Xruns with NI Kontakt on an otherwise Xrun-free system

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
mvdoornik
Established Member
Posts: 5
Joined: Thu Oct 08, 2015 11:22 am

Xruns with NI Kontakt on an otherwise Xrun-free system

Post by mvdoornik »

Hi everyone,

Having only recently started to get back into the music-making hobby, I've been able to successfully setup my linux audio workstation. Normally, I don't have any xruns whatsoever, but NI Kontakt has me stumped. I've obtained NI Komplete Elements with my purchase of a Samson Graphite 49 keyboard and the installation has been quite uneventful. Reaktor is running quite nicely with Wine ASIO and seems to give no xruns with the included synths, such as Steampipe. Kontakt, however, cannot seem to play even a few notes without starting to severely glitch, click and buzz. I've tried increasing the jack buffers as well as the ASIO buffers, but even with a 1024-byte buffer the massive xruns still occur. Normally, I can run with 3 64-byte buffers at 48kHz (4ms latency) no problem with a 10 to 15% CPU load, but Kontakt gives quite frequent 100%-ish spikes.

I'm currently running Xubuntu 14.04 64-bit with the KXStudio RT-PREEMPT kernel and repositories on an AMD A6-5400K system. It has 4GB of RAM and a Behringer UCA222 audio interface. Main controller is a Samson Graphite 49. Jack has been configured for 3 64-byte buffers at 48kHz, yielding 4ms of latency with no xruns whatsoever.

Any help will be greatly appreciated!
Software
  • KXStudio 14.04 AMD64 - Openbox - Linux 3.13 low-latency from KX repos
  • Wine-RT - WineASIO
  • Jack RT 3 periods, 64/128 bytes, prio 85

Hardware
  • AMD A6-5400K 3.9 GHz
  • 4GB DDR3 1600 MHz
  • Behringer UCA222 audio
  • Samson Graphite 49
  • Akai LPD8
asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Xruns with NI Kontakt on an otherwise Xrun-free system

Post by asbak »

- Disable CPU multicore support in Kontakt (important)
- Set Frames to at least 128 (64 will more likely lead to xruns). USB soundcards need to have periods set to 3.
- Set CPU to performance
- Ensure that Kontakt samples are on a fast internal drive (slow drive IO will lead to endless xruns)

As Alex mentioned, perhaps it's wine related. Are you running wine or wine-rt from kxstudio? Ensure you have wine-rt installed.
USB port issue, if your soundcard is plugged into a USB 3 port be sure to move it to a USB 2 port or set the port to USB 2 in the BIOS.
Last edited by asbak on Fri Oct 09, 2015 4:45 am, edited 2 times in total.
Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
User avatar
AlexTheBassist
Established Member
Posts: 353
Joined: Mon May 19, 2014 3:44 am
Location: Russia, Moscow
Been thanked: 1 time

Re: Xruns with NI Kontakt on an otherwise Xrun-free system

Post by AlexTheBassist »

I think it's either wine or wineasio issue. I had kinda similar problem when was trying to use Guitar Rig. It worked well in Carla, but when I tried to use it with Ardour (still launched in Carla, Ardour guitar tracks were routed to Guitar Rig), I got gazillions of xruns and ear bleeding. The issue itself is caused by some realtime priority conflict IMO.

Also, do you have USB3 on your motherboard? If you do, try plugging your interface into 2.0 port or disable USB3 at all in your BIOS/UEFI. USB3 is known to cause that kind of problems.
Being creative does not imply being lazy, stupid, or illiterate.

Working in Harrison Mixbus and Ardour on KDE Neon + KXStudio.
mvdoornik
Established Member
Posts: 5
Joined: Thu Oct 08, 2015 11:22 am

Re: Xruns with NI Kontakt on an otherwise Xrun-free system

Post by mvdoornik »

Thanks for the swift replies, I'll try disabling CPU multicore in Kontakt first to see where that leads. Disabling USB3.0
is another thing I'll try, as I've done all the other things pretty much already. Will keep you posted!
Software
  • KXStudio 14.04 AMD64 - Openbox - Linux 3.13 low-latency from KX repos
  • Wine-RT - WineASIO
  • Jack RT 3 periods, 64/128 bytes, prio 85

Hardware
  • AMD A6-5400K 3.9 GHz
  • 4GB DDR3 1600 MHz
  • Behringer UCA222 audio
  • Samson Graphite 49
  • Akai LPD8
mvdoornik
Established Member
Posts: 5
Joined: Thu Oct 08, 2015 11:22 am

Re: Xruns with NI Kontakt on an otherwise Xrun-free system

Post by mvdoornik »

After disabling the multicore support within Kontakt, I now have very few xruns. Awesome! Thanks a lot for this great information! I do still have some xruns with the - apparently - more demanding instruments, such as the upright piano included with Komplete Elements, but I assume this is because of the added overhead of running everything within wine-rt. Nevertheless, the results are encouraging. Now I just have to tweak everything until it breaks. :wink:
Software
  • KXStudio 14.04 AMD64 - Openbox - Linux 3.13 low-latency from KX repos
  • Wine-RT - WineASIO
  • Jack RT 3 periods, 64/128 bytes, prio 85

Hardware
  • AMD A6-5400K 3.9 GHz
  • 4GB DDR3 1600 MHz
  • Behringer UCA222 audio
  • Samson Graphite 49
  • Akai LPD8
asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Xruns with NI Kontakt on an otherwise Xrun-free system

Post by asbak »

Yeah the CPU setting pretty much makes or breaks one's kontakt + wine experience.
The same thing is required for running Reason + Wine.
For me using Kontakt with dssi-vst (in Muse for example) works quite well, it seems to be less xrun prone (apart from a few when loading samples) than some other methods & hosts.

There are a lot of things which may or may not help with incremental improvements

- Optimise jackd settings, run jackd with a high priority
- no IRQ sharing with the USB audio device may help a bit
- using a PREEMPT or RT kernel. PREEMPT works OK for me, RT should also be good. Standard kernels don't work as well for this kind of thing, at least not for me.
- disabling unnecessary services
- disabling wifi in some cases
- Separate internal drive for streaming samples if possible
- deciding whether or not certain potentially IO hungry cronjobs (look in /etc/cron.daily) are essential or can be temporarily disabled
- pay particular attention to disk IO (from things like locate updates, tracker-miner-fs in Debian etc) because samples are streamed in kontakt and if something is grabbing too many disk resources (or you have a slowwww drive) while you're streaming samples it'll xrun badly.
- Keep frames at 128 or 256 for kontakt to minimise xruns whilst keeping the latency at a usable level
- Closing the Kontakt GUI may help a little (when running it inside a host)
- Check the usual tuning guides and apply their recommendations
- Set CPU to Performance mode
- avoid webbrowsers, particularly when using Kontakt

More speculative things to try which may or may not reduce xruns

- prioritising jackd, wine and Kontakt processes with chrt and SCHED_FIFO policies may help (or may be a red-herring... not sure)
Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
mvdoornik
Established Member
Posts: 5
Joined: Thu Oct 08, 2015 11:22 am

Re: Xruns with NI Kontakt on an otherwise Xrun-free system

Post by mvdoornik »

Wow Asbak, those are quite a few recommendations. I'll have to have a go at those once I can find the time! Is the low-latency kernel included with KXstudio a RT preempting one?

You mention running Kontakt from DSSI-VST, is this less prone to xruns than running kontakt.exe standalone?

<OT>
BTW, you be Dutch, by any chance?
</OT>

Once again, thanks!
Software
  • KXStudio 14.04 AMD64 - Openbox - Linux 3.13 low-latency from KX repos
  • Wine-RT - WineASIO
  • Jack RT 3 periods, 64/128 bytes, prio 85

Hardware
  • AMD A6-5400K 3.9 GHz
  • 4GB DDR3 1600 MHz
  • Behringer UCA222 audio
  • Samson Graphite 49
  • Akai LPD8
asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Xruns with NI Kontakt on an otherwise Xrun-free system

Post by asbak »

mvdoornik wrote:Wow Asbak, those are quite a few recommendations. I'll have to have a go at those once I can find the time!
I can't guarantee all of them are relevant or applicable to your circumstances but most of them have affected me at some time or another, depending upon conditions which vary with zillions of variables...sigh
Basically, once you're not getting xruns any longer when using Kontakt (you'll possibly still get them when loading instruments but that doesn't really matter) then your system's probably been tuned enough.
Is the low-latency kernel included with KXstudio a RT preempting one?

I don't know what kernel comes with the KXstudio iso but when you do an

Code: Select all

apt-cache search linux-lowlatency
that shows you the Ubuntu (I think?) PREEMPT kernel which can be installed if it hasn't been installed already.

This command

Code: Select all

uname -a
will show you what kernel is running. If it says something like "lowlatency" or "PREEMPT" it is a PREEMPT kernel.
I compile my own ones because I don't think the Ubuntu ones are 1000Hz and besides, they're on the old side.
The industrial automation guys need RT kernels but so far I haven't found much benefit using a RT over a PREEMPT kernel for audio. Perhaps it makes a difference for some people but PREEMPT is good enough for me.

You mention running Kontakt from DSSI-VST, is this less prone to xruns than running kontakt.exe standalone?
I haven't tried the kontakt.exe lately. I don't get xruns when using DSSI-VST and the 32bit plug.
BTW, you be Dutch, by any chance?
Kind of... if you went back some 100's of years in time. I've spent more time in Flanders actually. :D
Once again, thanks!
You're welcome, any time!
Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
Post Reply