Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One audio plugin seems to be getting low priority. #141

Closed
JeffreyBenjaminBrown opened this issue Sep 29, 2022 · 5 comments
Closed

One audio plugin seems to be getting low priority. #141

JeffreyBenjaminBrown opened this issue Sep 29, 2022 · 5 comments

Comments

@JeffreyBenjaminBrown
Copy link
Contributor

JeffreyBenjaminBrown commented Sep 29, 2022

(If you think I should be posting this somewhere else please let me know. The reason I suspect it's NixOS-specific is described in the second section below, titled A hunch, and some things I've tried.)

The problem

Audio on my system is in general perfect, with the exception of a single sound-generating plugin called PianoTeq.

I've been using QJackCtl, a2jmidid, Ardour, various other plugins (which modify rather than generate sound), and my external soundcard (a Scarlett Focusrite) with zero problems. But recently I started using Pianoteq, controlling it with a USB MIDI keyboard. It stutters, pops, and sometimes goes siilent. When it goes silent, Pianoteq pops up a window sometimes telling me that my computer can't handle it -- but this is a decent 2017 laptop, and Pianoteq runs fine on much older hardware.

Sometimes the problem is more or less severe. Sometimes I can smash the keyboard and there are no glitches. I keep running top to try to find some CPU hog but there never seems to be one -- almost always, the biggest hog is ArdourGUI at around 25%. Here's a typical screenshot of top's output:

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND     
 3509 jeff      20   0 3023088 892656 222504 S  17.6   5.5   1:50.61 ArdourGUI
 3805 jeff      20   0   10980   3752   3284 R  11.8   0.0   0:00.04 top
    8 root      20   0       0      0      0 I   5.9   0.0   0:00.90 kworker/u8:0-events_unbound
 1045 root      20   0       0      0      0 I   5.9   0.0   0:00.94 kworker/1:3-events
 3479 jeff      20   0  281180 131224 111364 S   5.9   0.8   0:06.50 jackd
    1 root      20   0  168556  13128   9744 S   0.0   0.1   0:01.35 systemd

(with everything after that using 0.0 %CPU and 0.0 %MEM).

A hunch, and some things I've tried

I suspect it's not being given high priority.

In QJackCtl under Setup, on the Settings tab, under the Advanced subtab, one can choose a priority level. I tried setting that to 90, restarted QJackCtl and everything that depends on it, and didn't notice any change.

I've found some procedural instructions online about giving higher priority to audio processes, but I suspect they're not going to work in NixOS. One, I remember, told me to edit some config file that didn't even exist on my machine. (Sorry, it's been a while, I didn't record the details.)

I've searched online and haven't found anything resembling this problem described elsewhere, even omitting Nix and NixOS.

@magnetophon
Copy link
Member

Have you tried contacting the makers of PianoTeq?
Have you tried running other more CPU heavy synths, like Vital or Vitalium?

@JeffreyBenjaminBrown
Copy link
Contributor Author

Those are great idea. Will do! (I did look on the Pianoteq forum, but didn't consider asking them outright.)

@JeffreyBenjaminBrown
Copy link
Contributor Author

JeffreyBenjaminBrown commented Oct 1, 2022

SOLVED. I just needed to disable CPU throttling for each core:

sudo cpufreq-set -c 0 -g performance
sudo cpufreq-set -c 1 -g performance
sudo cpufreq-set -c 2 -g performance
sudo cpufreq-set -c 3 -g performance

The Pianoteq Linux README says as much, for CPUs that aren't beefy. Sorry, and thanks!

(Interestingly, Vitalium ran perfectly well, handling lots of voices, without doing that -- despite its apparently being a more intense algorithm.)

@magnetophon
Copy link
Member

magnetophon commented Oct 1, 2022

Are you using musnix? That is one of the base settings:

powerManagement.cpuFreqGovernor = "performance";

@JeffreyBenjaminBrown
Copy link
Contributor Author

I deleted my first response to your most recent post because searching the MusNix README for "frequency" answered my question. It appears that merely enabling MusNix should "Activate the performance CPU frequency scaling governor". I'm definitely enabling MusNix. But without running cpufreq-set -c i -g performance for four values of i as described above, Pianoteq glitches like crazy.

If it's of interest, here's the top file in my config with the line that imports the audio configuration highlighted. Here's the audio config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants