Xruns on linux mint 17.2 and kxstudio software

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

JohannesTress
Established Member
Posts: 101
Joined: Fri Jun 21, 2013 3:56 pm

Xruns on linux mint 17.2 and kxstudio software

Post by JohannesTress »

Hello together,
I spend the last hours with reading and trial & error with my new notebook. After not having any success I decided to ask you people for help.
I bought a thinkad t450s with an Intel® Core™ i5-5200U Dual-Core Prozessor (2.2 – 2.7 GHz) and 256 GB SSD. After installing linux mint 17.2 and adding all the kstudio repo stuff, I'm experiencing a lot of xruns.
Recently I'm a lot into Bitwig-Studio and doing live-electronic stuff. Therefore I need a very low latency (64 samples would be perfect). With my old t420 it was absolutely no problem to get the latency under 2 ms with my RME Babyface but now I get xruns with a sample rate of 256 samples. Are there any suggestions I can start with? Thank you very much indeed!
asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Xruns on linux mint 17.2 and kxstudio software

Post by asbak »

In case your comp has USB3, DON'T use USB3 ports for audio, or set USB3 port to USB2 mode in the BIOS

http://linuxmusicians.com/viewtopic.php ... 70&p=65531
http://linuxmusicians.com/viewtopic.php ... 99&p=65558
Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
JohannesTress
Established Member
Posts: 101
Joined: Fri Jun 21, 2013 3:56 pm

Re: Xruns on linux mint 17.2 and kxstudio software

Post by JohannesTress »

I already read about the usb 2 issues but infact it doesn't make any difference on my system if I force it to use usb 2...
folderol
Established Member
Posts: 2069
Joined: Mon Sep 28, 2015 8:06 pm
Location: Here, of course!
Has thanked: 224 times
Been thanked: 400 times
Contact:

Re: Xruns on linux mint 17.2 and kxstudio software

Post by folderol »

Have you looked at your bios power management? If it's stepping the CPU clock speed that will almost certainly cause xruns.
The Yoshimi guy {apparently now an 'elderly'}
JohannesTress
Established Member
Posts: 101
Joined: Fri Jun 21, 2013 3:56 pm

Re: Xruns on linux mint 17.2 and kxstudio software

Post by JohannesTress »

Yes the cpu governor is running in performance mode, so no speed stepping should be the cause of the xruns...
gimmeapill
Established Member
Posts: 564
Joined: Thu Mar 12, 2015 8:41 am
Has thanked: 44 times
Been thanked: 8 times

Re: Xruns on linux mint 17.2 and kxstudio software

Post by gimmeapill »

Did you run the Quickscan?
https://github.com/raboof/realtimeconfigquickscan

Cheers,

LX
JohannesTress
Established Member
Posts: 101
Joined: Fri Jun 21, 2013 3:56 pm

Re: Xruns on linux mint 17.2 and kxstudio software

Post by JohannesTress »

Yes I did and I get the following results which seem to be ok so far:

Code: Select all

~/realtimeconfigquickscan $ perl ./realTimeConfigQuickScan.pl
== GUI-enabled checks ==
Checking if you are root... no - good
Checking filesystem 'noatime' parameter... 3.19.0 kernel - good
(relatime is default since 2.6.30)
Checking CPU Governors... CPU 0: 'performance' CPU 1: 'performance' CPU 2: 'performance' CPU 3: 'performance'  - good
Checking swappiness... 10 - good
Checking for resource-intensive background processes... none found - good
Checking checking sysctl inotify max_user_watches... >= 524288 - good
Checking access to the high precision event timer... readable - good
Checking access to the real-time clock... readable - good
Checking whether you're in the 'audio' group... yes - good
Checking for multiple 'audio' groups... no - good
Checking the ability to prioritize processes with chrt... yes - good
Checking kernel support for high resolution timers... found - good
Kernel with Real-Time Preemption... not found - not good
Kernel without real-time capabilities found
For more information, see http://wiki.linuxaudio.org/wiki/system_configuration#installing_a_real-time_kernel
Checking if kernel system timer is set to 1000 hz... found - good
Checking kernel support for tickless timer... found - good
== Other checks ==
Checking filesystem types... ok.
not found.
** Warning: no tmpfs partition mounted on /tmp
   For more information, see:
   - http://wiki.linuxaudio.org/wiki/system_configuration#tmpfs
   - http://lowlatency.linuxaudio.org
** Set $SOUND_CARD_IRQ to the IRQ of your soundcard to enable more checks.
   Find your sound card's IRQ by looking at '/proc/interrupts' and lspci.
JohannesTress
Established Member
Posts: 101
Joined: Fri Jun 21, 2013 3:56 pm

Re: Xruns on linux mint 17.2 and kxstudio software

Post by JohannesTress »

What is really strange is that when I boot into KXStudio 14.04 with a bootable USB-Stick I'm able to work with lower sample rates without getting these xruns.
Could it be some Mint specific problems or is it the older lowlatency kernel (13.13...) which gives me better results than the latest one distributed via the KXStudio Repos (13.19...)?

Thanks again for your very much appreciated help!
gimmeapill
Established Member
Posts: 564
Joined: Thu Mar 12, 2015 8:41 am
Has thanked: 44 times
Been thanked: 8 times

Re: Xruns on linux mint 17.2 and kxstudio software

Post by gimmeapill »

The kernel is not detected as RT:
Kernel with Real-Time Preemption... not found - not good
Kernel without real-time capabilities found
For real low latencies (in the 2 ms ballpark), I think you still need the RT patchset.
Are you sure you're using the kernel from the KX repo?
gimmeapill
Established Member
Posts: 564
Joined: Thu Mar 12, 2015 8:41 am
Has thanked: 44 times
Been thanked: 8 times

Re: Xruns on linux mint 17.2 and kxstudio software

Post by gimmeapill »

Sorry FalkTX, I assumed wrongly that there was an optimized kernel in the KX repos - never used those actually.
In my experience (Arch Linux), RT still has a small edge over non RT (let's ~2-3ms second latency vs ~3-4ms), but it's for sure not as dramatic as it used to be.
For the sake of troubleshooting I'd still recommend to try it - may or may not help.
folderol
Established Member
Posts: 2069
Joined: Mon Sep 28, 2015 8:06 pm
Location: Here, of course!
Has thanked: 224 times
Been thanked: 400 times
Contact:

Re: Xruns on linux mint 17.2 and kxstudio software

Post by folderol »

I do think people get too hung up on latency. Speed of sound through air at room temperature is about 340m/S or 34cm / milisec, so if you are a metre away from you speakers you already have a latency of around 3mS. Live musicians on stage are likely to be 2 to 3 metres away, yet they don't seem to have a problem. Nor do other members of the band.
The Yoshimi guy {apparently now an 'elderly'}
glowrak guy
Established Member
Posts: 2315
Joined: Sat Jun 21, 2014 8:37 pm
Been thanked: 251 times

Re: Xruns on linux mint 17.2 and kxstudio software

Post by glowrak guy »

I think some latency tends to humanize music that could otherwise
lean towards the robotic. Even modulation effects add a variety of desirable latencies.

Fortunately, affordable software and hardware are so wonderful, that latency is
mainly an optional extra, in the toolbox, not some dreaded spectre.
Good times!
asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Xruns on linux mint 17.2 and kxstudio software

Post by asbak »

Audio users for whom audio latencies and keeping time are irrelevant are usually not 'traditional' musicians.

Who are traditional musicians? They are people who play 'traditional' type instrumental music using 'traditional' type instruments (including synths) in 'traditional' type group or solo arrangement settings. For a traditional musician, timing matters.

There is a second category of users who are audio and equipment enthusiasts ie knob-twirlers, who typically cannot play instruments, or if they do, not very coherently or in a way that a musician would. For knob-twirlers, timing often doesn't matter because for many of them the concept of keeping time doesn't exist. The Internet common perception that audio latency is (almost) irrelevant comes from the ranks of knob-twirlers (DJ's, producers, stars of EDM and dubstep etc) who vastly outnumber musicians.

At 64ms only the deaf couldn't notice the obvious delay, at 32ms it's less prominent but still borderline detectable, even to non-specialists. Anything > 20ms is not really ideal for the average musician and when they are already running gear with somewhat high-latency and are positioned far away from speakers etc that delay adds up and becomes even worse. Sure it is 'possible' to play under such conditions but sloppy timing contributes to sloppy overall sound. It may not matter to certain connoisseurs of EDM but it would matter a hell of a lot to a classical musician, a reggae player, prog-rocker or a jazz player to name a few examples.

Whoever started the popular "RT is not necessary for linux audio" old wives tale obviously never learned to play an instrument in his or her life because RT reduces xruns considerably at lower latency settings. So yes, RT is still very relevant.
Using a RT kernel isn't the only method to reduce xruns though. A PREEMPT kernel will achieve a very similar effect. In other words, a RT or PREEMPT kernel can substitute for each other in order to reduce xruns at low latency settings.

Standard kernels cause a lot more xruns when trying to use lower latency settings and particularly when using Windoze VSTi's under Wine. I've personally verified this on different flavours of Linux on different computers using different brands of USB and PCI cards.

I really hope that this explanation helps clear up the numerous and frequently cited misconceptions about audio latency in Linux and in general.
Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
folderol
Established Member
Posts: 2069
Joined: Mon Sep 28, 2015 8:06 pm
Location: Here, of course!
Has thanked: 224 times
Been thanked: 400 times
Contact:

Re: Xruns on linux mint 17.2 and kxstudio software

Post by folderol »

Traditional musicians?
A family friend (long gone now) was a professional pipe organist, and played in many cathedrals, theatres and even humble village churches. Something I picked up from him was the need to play to what an instrument can achieve. Apparently, a 32ft pedal F can have a rise time of as much as 300mS while 4ft middle C is virtually instantaneous. Every register/pipe bank is different, so it is no good saying it must conform to some numerical figure. I've heard him play, and with all that variation his timing was impeccable. I've heard him play what he used to call "Tomato & Fudge", but he would never play Vidor's Toccata - said he would when he thought he was good enough :(
The Yoshimi guy {apparently now an 'elderly'}
gimmeapill
Established Member
Posts: 564
Joined: Thu Mar 12, 2015 8:41 am
Has thanked: 44 times
Been thanked: 8 times

Re: Xruns on linux mint 17.2 and kxstudio software

Post by gimmeapill »

Just one thing regarding the latency calculation.
If you want to use the speed of sound through air when playing an analog instrument as a comparison, then the calculation on the jack side should account for the total round trip latency, not just the playback latency.
This can be measured quite precisely by looping the input to the output of the soundcard with a patch cable and http://apps.linuxaudio.org/apps/all/jack_delay or the utility included in Jack).
A far better explanation can be found here http://apps.linuxaudio.org/wiki/jack_latency_tests

If we take as example 3ms latency capture + 3ms playback + jack internal latency, that would give in practise roughly 9-10ms total latency = like playing an electric instrument like guitar or synth about 3 m from the amp.
Not a big deal yet, but for a responsive feel, you probably don't want to get much higher than that, especially if the analog signal goes then to a real amp, stage PA, etc... Latencies tend to add up, and that usually doesn't bring anything good.

There's also no need to play any live instrument to benefit from low latencies, there are quite a few uses cases where even 15ms might not cut it, ex:
- sequencing soft synths & hardware synths routed back to the DAW
- sync'ing audio to video,
- digital dj'ing (especially with control vynils).

But enough discussed the "why", let's focus on the "how" - I bet that JohannesTress has a good reason to search for a low latency setup otherwise he would probably not have invested in a an RME Babyface and a new notebook in the first place...
Post Reply