Ubuntu, jack, maximum priority for audio application

What other apps and distros do you use to round out your studio?

Moderators: MattKingUSA, khz

Post Reply
genderbee
Posts: 2
Joined: Fri Aug 16, 2019 11:24 am

Ubuntu, jack, maximum priority for audio application

Post by genderbee »

OS, apps and hardware info

Code: Select all

    Linux local 5.0.0-23-lowlatency #24-Ubuntu SMP PREEMPT Mon Jul 29 16:17:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
    jackdmp version 1.9.12 tmpdir /dev/shm protocol 8
    Bitwig-studio version 3.0.1
    USB2 Audio interface Tascam US16x02
Question

Is possible run audio application with max priority for this application? For best performance and lowest latency without cruckling/buffer problem for audio application.

Situation

I reinstalled `Ubuntu studio 19.04`, `update`, `upgrade`, install DAW `Bitwig studio 3.0.1`, then install `indicator-cpufreq` (for changing my cpu to best performance).

Then I ran `jackd` in this configuration.

Code: Select all

    /usr/bin/jackd -dalsa -dhw:US16x08 -r44000 -p128 -n2
I select in `indicator-cpufreq` applet `Performance` (for best performance), then checked via `lscpu` it is working.

Code: Select all

    Model name:          Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
    CPU MHz:             3455.159
    CPU max MHz:         3500,0000
    CPU min MHz:         400,0000
    NUMA node0 CPU(s):   0-3
Then I ran Bitwig studio. I tried do load some my older project.

Issue

When play the music in DAW, there are some crackling during the playing, and when I do something in DAW during playing (for example zooming or moving only), crackling is even worst.

Jackd log shows me many `xruns`. Is possible to identify what is cause of this `xruns`?

I swear I had same configuration before reinstall OS and it was OK for this configuration, no crackling at all during playing even when working in DAW during playing or recording, with same jack configuration.

I tried install older versions of `Ubuntu studio`, no effect, crackling still present, same.

Why is now crackling due playing in DAW? Applet `indicator-cpufreq` changed to best performance.

What is the magic? Before I reinstalled OS, everything works fine. I found something about `nice` utility. Is it what I need to setup? Is there a way to set max performance/priority to running application? Will it help?

Thank you very much for any informations.

Update

When I set `Performance` for cpu in `cpufreq` instead `Powersave`, it is even whorse! Where could be the catch?
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: Ubuntu, jack, maximum priority for audio application

Post by merlyn »

Is the 44000 in your jackd command a typo? From what I know USB interfaces work best using 48000 Hz. Also I've seen 3 periods per buffer recommended.
glowrak guy
Established Member
Posts: 2315
Joined: Sat Jun 21, 2014 8:37 pm
Been thanked: 251 times

Re: Ubuntu, jack, maximum priority for audio application

Post by glowrak guy »

99 is the highest priority available for limits.conf
These lines conclude my particular text file /etc/security/limits.conf

@audio - rtprio 95
@audio - memlock unlimited
#@audio - nice -19

In qjackctl, the maximim priority to choose is 89, but I often use 70,
without perceiving lesser performance, along with 95 in limits.conf,
as some people have said linux 'housekeeping'
activities might rarely be pre-empted at an unlucky moment with limits.conf
set at 99. I'm a fairly dumb musician, so I mainly heed what apparently
very bright people suggest. If something breaks, I adjust it til it works,
and feel less dumb for a few minutes. Also, melyn spotted trouble accurately!
Cheers
genderbee
Posts: 2
Joined: Fri Aug 16, 2019 11:24 am

Re: Ubuntu, jack, maximum priority for audio application

Post by genderbee »

Hello again,
thanks. Now I add some parameters and seems everything is ok now.

Code: Select all

/usr/bin/jackd -d alsa -d hw:US16x08 -r 48000 -p 128 -n 2 -H -M -D -s -zr
I think there is no need to handle pririty if you add these parameters to the end.

Cheers.

Update

just info, that is important to handle priority, sorry.

This is what I did to get best performance after fresh ubuntu install.

1. Install and apply low latency kernel.

Code: Select all

sudo apt install linux-lowlatency
2. Edit limits.conf.

Code: Select all

sudo mcedit /etc/security/limits.conf
Add these lines.

Code: Select all

* - rtprio 70
* - memlock unlimited
* hard memlock unlimited
* soft memlock unlimited
4. Reboot.

3. Install some service to get best cpu performance, set cpu to best performance.

Code: Select all

sudo apt install cpufrequtils
sudo cpufreq-set -r -g performance
or

Code: Select all

sudo apt install indicator-cpufreq
(after reboot you will see applet in notification area for changing performance of cpu)

4. Install jackd2 if you don't have already installed.

Code: Select all

sudo apt install jackd2
5. Run jackd2 with parameters you need.

Code: Select all

/usr/bin/jackd -d alsa -d hw:PCH -r 48000 -p 192 -n 3
You have to try (lowest -p, -n = lowest latency).

Note: If you want to know what are the names of your HW, run this command. In example above, my hw: is PCH.

Code: Select all

aplay --list-devices
cat /proc/asound/cards
6. Run DAW.

Thats all. I hope it will help.

Bye.
Post Reply