Jack settings, latency, system optimization on Linux


#1

Anyone running SuperCollider on Linux?

What’s the optimal settings for jack I should set up for working with SuperCollider? (simple rate, frames/period, periods/buffers, etc)

What’s like the desired latency I shoud shoot for? (and how do i check for latency and X-run?)

Lastly, what are some vital system optimization that should be set in order to gain a better audio performance on a linux operating system?

swappiness, cpu governors? realtime kernel?


#2

Depends on your soundcard very much… I have one startup script for the internal soundcard and one for my RME Fireface UCX:

rme:

#!/bin/bash

jack_control stop
jack_control ds alsa
jack_control dps device hw:UCX23815246,0
jack_control dps capture hw:UCX23815246,0
jack_control dps playback hw:UCX23815246,0
jack_control dps rate 44100
jack_control dps nperiods 3
jack_control dps inchannels 18
jack_control dps outchannels 18
jack_control dps period 128
jack_control dps duplex true
jack_control dps midi-driver seq
jack_control start

internal soundcard:

#!/bin/bash

kernel=$(uname -r)

jack_control stop
jack_control ds alsa
jack_control dps device hw:PCH,0
jack_control dps capture hw:PCH,0
jack_control dps playback hw:PCH,0
jack_control dps rate 44100
jack_control dps inchannels 2
jack_control dps outchannels 2
jack_control dps nperiods 2
case "$kernel" in
    *-rt*)
        jack_control dps period 256
        ;;
    *)
        jack_control dps period 1024
        ;;
esac
jack_control dps duplex true
jack_control dps midi-driver seq
jack_control start
sleep 10
# a2jmidid -e

And then I use cadence to check for xruns…


#3

Here is a good guide to hardware configuration. The realtimeconfigquickscan is in AUR…


#4

sample rate: 48000
frames/period: 128
periods/buffer: 2
In the buttom right hand corner Qjackctl shows latency to be: 5.33 msec

set up qjackctl on my laptop with the same settings: also showed 5.33 msec
booted the system with realtime kernel and also showed 5.33 msec

so i’m guessing this is just the estimated latency of these numbers i inputted into qjackctl: sample/frames/period.

the ACTUAL latency has to be actually tested? and this latency number shown by qjackctl is basically pretty arbitrary then? what do you guys use to actually test the real latency? :stuck_out_tongue:


#5

Haven’t done any real testing of the actual latency, but I have been happy with what I have now on my rme. If you want to test the actual, physical latency you probably need to patch the physical output to the pohysical input on your soundcard, send out a click from a DAW and record it back in again. Comparing the waveforms of the out- and in signal on the timeline should give you an idea of the latency. Maybe there is a clever way to do this in sc, but I am not aware of one…


#6

I have found that 5.33 msec latency is too low for my system. I was getting a lot of xruns when I had it that low. I shoot for 11 or 16 (10.6 is my current). I can’t tell the difference and my sound isn’t choppy any more.

Also, the realtime kernel config might not be necessary:
http://www.jackaudio.org/faq/realtime_vs_realtime_kernel.html

Another point, something that I stumbled on, is this package:
pulseaudio-module-jack

This was the missing piece that fixed most of the issues I was having with jack. I am running Ubuntu 18.04. This package makes jack and pulse play nicely, don’t know what it is doing exactly. I don’t know your distribution, but it’s probably available in your package repos.

Lastly, make sure when tweaking your jack settings that those settings are actually being used by the sc server by reading the server boot output. I had some issues tweaking settings in qjackctl, where the settings were not being saved out and the server was booting with old settings. It’s an issue that others have noticed. I think I eventually just rebooted my system and the settings took.