Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER for Linux

Reply
 
Thread Tools Display Modes
Old 06-16-2020, 12:34 PM   #1
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default LINUX : Real-time audio configurations (a newbie's summary)

Well, by June 2020 I am myself a Linux newbie. I began by installing Ubuntu Studio and and trying to configure it for heavy Vsti/Vst use (first with all the usual Linux suspects - Surge, Zyn Fusion, etc... -, and then a bunch of selected Win freeware classics such as Synth1, the Full Bucket synths, the Melda bundle, etc. And on top of all of that (which has worked well up to now), there came the Komplete 10 bundle, particularly for the Kontakt goodies, which is obviously a must for many studio projects.



During this process, I have met many difficulties, in spite of Ubuntu Studio's claims of a pre-optimized OS for audio and video. Regarding audio, various things are of course facilitated, but there seem to be many loose ends, and if you try to configure the system for a heavy Vsti use, you meet those shortcomings sooner than later.



So, the idea with this thread would be to leave these first posts as placeholders to reunite, little by little, the easiest, clearest, tried and true recipes for optimizing Linux for real-time, heavy audio duties. Of course, being a newbie, I invite the experts to share their knowledge, and I'll also contribute my own personal experiences so far, so they can be confirmed or refused by the knowledgeable ones.



Of course, there are the great Jack Winter's stickied threads, but I think that they're not intended as complete summaries. I, as a newbie, feel that Linux for audio needs and deserves a centralized, focused summary that attempts to gather all the fragmented and scattered info that is spread across threads/forums/pages, etc.



Last but not least, something is obvious regarding all of this : what I'm invoking is probably utopic, since each system/distro/hardware/software combination brings potential pitfalls and exceptions to any rule that could be summarized here. Having that in mind, knowing that this task is most probably almost impossible, I'll nevertheless leave the space here to begin such a task. If you know of any online resource that already comprises what I 'm striving to create here, feel free to post a link and I'll happily post it here. What I've read, so far, is almost always to technical and fragmented for a newbie - like me - to grasp in the first instance. I'm on Ubuntu, and obviously will begin with Ubuntu recipes, but recipes for any distro are also welcome.


After this preface, I'll leave the placeholders and will begin at any moment to compile the topics. I'll also comment about my latest issue with my soundcard, in the hope that any wizard can contribute with a solution and add to this future list of optimizations.
Soli Deo Gloria is online now   Reply With Quote
Old 06-16-2020, 12:35 PM   #2
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

Placeholder 1
Soli Deo Gloria is online now   Reply With Quote
Old 06-16-2020, 12:35 PM   #3
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

Placeholder 2
Soli Deo Gloria is online now   Reply With Quote
Old 06-16-2020, 12:36 PM   #4
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

Placeholder 3
Soli Deo Gloria is online now   Reply With Quote
Old 06-16-2020, 12:48 PM   #5
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

So, here is my latest issue... the realtimesystemconfigurationquickscan gives me all "good" for all topics. BUT... my Komplete Audio 6 USB card gives a plethora of sound interruptions, during which I even see the meters of the tracks go down and up again, as if something mutes them temporarily. This happens mostly with Kontakt/Wine/LinVST and/or a combination of Piano In 162 in Linux Sampler and a heavy dose of Zyn Fusion with laaarge release and lots and lots of sustain pedal, just to stress things out. The same in Win 7 does not seem to give problems. Ubuntu Studio has Rtirq installed, but it doesn't seem to be properly configured, or at least I think so, given the results I'm still getting. Even a single instance of Kontakt with the Challen piano of Cinesamples' Abbey Road Pianos (a heavyweight, I know) brings the audio card to its knees.


With the command sudo /etc/init.d/rtirq status, I managed to get these results :

PID CLS RTPRIO NI PRI %CPU STAT COMMAND
156 FF 95 - 135 0.2 S irq/23-ehci_hcd
157 FF 94 - 134 0.8 S irq/23-ehci_hcd
10 TS - 0 19 0.1 S ksoftirqd/0
18 TS - 0 19 0.1 S ksoftirqd/1
etc...


The ehci_hcd seems to be the Komplete Audio card, so, it should be given RT priorities without a problem.


But, if I type the command systemctl status rtirq, I get this :

● rtirq.service - LSB: Realtime IRQ thread tunning.
Loaded: loaded (/etc/init.d/rtirq; generated)
Active: inactive (dead)
Docs: man:systemd-sysv-generator(8)


Which seems to indicate that Rtirq is inactive, in spite of having started it with the corresponding command (sudo /etc/init.d/rtirq start).


The rtirq file in /etc/default/ has these values :



RTIRQ_NAME_LIST="ehci_hcd"

# Highest priority.
RTIRQ_PRIO_HIGH=95

# Priority decrease step.
RTIRQ_PRIO_DECR=5

# Lowest priority.
RTIRQ_PRIO_LOW=51

# Whether to reset all IRQ threads to SCHED_OTHER.
RTIRQ_RESET_ALL=1


But anyway, the USB sound card continues xrunning like crazy. So, I invite you, charitable souls, to contribute with your insights, since I'm lost here.


Thanks so much in advance!
Soli Deo Gloria is online now   Reply With Quote
Old 06-16-2020, 01:19 PM   #6
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 4,568
Default

Quote:
Originally Posted by Soli Deo Gloria View Post

[...]

But, if I type the command systemctl status rtirq, I get this :

● rtirq.service - LSB: Realtime IRQ thread tunning.
Loaded: loaded (/etc/init.d/rtirq; generated)
Active: inactive (dead)
Docs: man:systemd-sysv-generator(8)


Which seems to indicate that Rtirq is inactive, in spite of having started it with the corresponding command (sudo /etc/init.d/rtirq start).
This is what I get with that command.

● rtirq.service - LSB: Realtime IRQ thread tunning.
Loaded: loaded (/etc/init.d/rtirq; generated)
Active: active (exited) since Tue 2020-06-16 08:46:05 CDT; 6h ago
Docs: man:systemd-sysv-generator(8)
Process: 781 ExecStart=/etc/init.d/rtirq start (code=exited, status=0/SUCCESS)

Jun 16 08:46:04 DW systemd[1]: Starting LSB: Realtime IRQ thread tunning....
Jun 16 08:46:05 DW rtirq[781]: Setting IRQ priorities: start [ehci_hcd] irq=16 pid=103 prio=95: OK.
Jun 16 08:46:05 DW rtirq[781]: Setting IRQ priorities: start [ehci_hcd] irq=23 pid=104 prio=94: OK.
Jun 16 08:46:05 DW systemd[1]: Started LSB: Realtime IRQ thread tunning..
__________________
Glennbo
Hear My Music - Click Me!!!
--
Glennbo is offline   Reply With Quote
Old 06-16-2020, 09:19 PM   #7
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

You've got it active, indeed. With systemctl status rtirq, mine says : "inactive (dead)" and I can't figure out why... I changed the USB hub for the audio card and gave a 95 RTPrio only for it..

Now, with sudo /etc/init.d/rtirq status, I get :

PID CLS RTPRIO NI PRI %CPU STAT COMMAND
158 FF 95 - 135 5.4 S irq/28-xhci_hcd
10 TS - 0 19 0.3 S ksoftirqd/0
18 TS - 0 19 0.2 S ksoftirqd/1
etc...


But the outcome is just the same : xruns and xruns with the USB sound card. An old M-Audio PCI card I had installed does behave much better, by the way, but it's more convenient for my work to use the USB card. I still haven't foud a single piece of information that is completely clear about this subject. I hope someone can give any insight into this...

Last edited by Soli Deo Gloria; 06-16-2020 at 09:43 PM.
Soli Deo Gloria is online now   Reply With Quote
Old 06-17-2020, 07:11 AM   #8
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

I even set the IRQ of the soundcard (28 in this case) to realtimesystemconfigquickscan, and it now gives a report with all the parameters OK. I'm stuck here...
Soli Deo Gloria is online now   Reply With Quote
Old 06-17-2020, 07:17 AM   #9
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 4,568
Default

Quote:
Originally Posted by Soli Deo Gloria View Post
I changed the USB hub for the audio card and gave a 95 RTPrio only for it..
When you say "USB hub" you don't mean you are using an external USB hub do you, because those are bad news for anything time critical.

Here's a thought. Do all the files you've modified have root permissions? Seems I remember modifying some file in the past and it wouldn't execute because it had my user but not root permissions.

Another thought. Is the rtirq service started?

sudo /etc/init.d/rtirq start

The above command comes back with the following here.

Setting IRQ priorities: start [ehci_hcd] irq=16 pid=103 prio=95: OK.
Setting IRQ priorities: start [ehci_hcd] irq=23 pid=104 prio=94: OK.
__________________
Glennbo
Hear My Music - Click Me!!!
--

Last edited by Glennbo; 06-17-2020 at 07:26 AM.
Glennbo is offline   Reply With Quote
Old 06-17-2020, 07:52 AM   #10
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

Well, I managed to get it active by running something which I read somewwhere, by chance : sudo systemctl enable rtirq and rebooting (by the way, this isn't even mentioned on the Rtirq github page, which is absolutely crazy! The crux of Linux, really : even devs don't explain things clearly...).


So, now, according to realtimesystemconfigquickscan, I have everything OK, Rtirq is active and the sound card is exclusively set to RTprio 95, but the sound interrupts continue (!!!!!!!).


Now, take a look at this :






I 'm playing a combination of Piano In 162 in Linux Sampler and Zyn Fusion with a heavy patch. Both tracks are processed with some intensive FXs. On my old M-Audio Audiophile 192 PCI card this plays nice (albeit with a noticeably low gain level). Now, with the USB Komplete Audio 6, if you pay attention from 9 to 10 seconds onwards, the meters of both tracks go down and up. It's not just stutter, some crackles or processing artifacts, as usual. These are complete interrupts of the sound, even to the point that the audio of the instruments shut down for a while and then reinit. Even if I leave the keys pressed, it happens the same : there are "cuts" in the meters every X seconds...


If I get to know the cause of this, I guess all the other parameters of the system are now tuned. But this nut is really hard to crack...
Soli Deo Gloria is online now   Reply With Quote
Old 06-17-2020, 08:21 AM   #11
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 4,568
Default

What happens if you increase your latency to the next higher number, or increase the number of periods?

Reason I ask is when I went from a pair of M-Audio Delta 2496 cards to my current Behringer UMC1820 I did have to increase the number of periods from three to four, and my projects hit the limit on running 64 samples latency sooner than happened with the M-Audio PCI cards. By the end of my most recent project I had upped the latency to 128, but used 64 when tracking the initial bass, guitar, and drums tracks.
__________________
Glennbo
Hear My Music - Click Me!!!
--
Glennbo is offline   Reply With Quote
Old 06-17-2020, 08:37 AM   #12
Klangfarben
Human being with feelings
 
Join Date: Jul 2016
Location: Los Angeles, CA
Posts: 1,105
Default

This may not be in any way helpful, but the NI Komplete 6 was a problematic USB audio device and many users reported poor performance on both OSX and Windows.

It mainly had to do with the KA6 using a separate/proprietary safety buffer in their drivers which basically had to be used to get decent performance. It wouldn't be using that under Linux, which could be crippling the box without it, regardless of buffer settings. The box was designed to use that extra buffer for everyday use, so if it's not there it may be the cause of your massive xruns.

I know USB audio devices should be fairly apples to apples on Linux, but as NI did something non-standard/proprietary with their drivers, you may want to try another device and see if you have the same degraded performance.
Klangfarben is online now   Reply With Quote
Old 06-17-2020, 08:39 AM   #13
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

I'm on 128 latency buffer, and even if I set the periods to 8, I get the exact same results. AND, what's craziest, is that even if I set the buffer to 2048, it gives the same results (!!!!!!!).


Something here is quite wrong...
Soli Deo Gloria is online now   Reply With Quote
Old 06-17-2020, 08:59 AM   #14
Klangfarben
Human being with feelings
 
Join Date: Jul 2016
Location: Los Angeles, CA
Posts: 1,105
Default

Quote:
Originally Posted by Soli Deo Gloria View Post
I'm on 128 latency buffer, and even if I set the periods to 8, I get the exact same results. AND, what's craziest, is that even if I set the buffer to 2048, it gives the same results (!!!!!!!).


Something here is quite wrong...
My guess is it has to do with the proprietary safety buffer NI put in their drivers I'm referring to above - which again wouldn't be there under Linux. You could put extra periods and up the buffer all day long, but if the box is designed to perform well only with their own proprietary safety buffer engaged, it wouldn't help in the slightest. It also probably wouldn't rear its head as much for the average user that doesn't have heavier VSTi usage. At the very least trying a different device would give you an indication whether you are looking at a device issue or something else.
Klangfarben is online now   Reply With Quote
Old 06-17-2020, 09:11 AM   #15
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

Quote:
Originally Posted by Klangfarben View Post
This may not be in any way helpful, but the NI Komplete 6 was a problematic USB audio device and many users reported poor performance on both OSX and Windows.

It mainly had to do with the KA6 using a separate/proprietary safety buffer in their drivers which basically had to be used to get decent performance. It wouldn't be using that under Linux, which could be crippling the box without it, regardless of buffer settings. The box was designed to use that extra buffer for everyday use, so if it's not there it may be the cause of your massive xruns.

I know USB audio devices should be fairly apples to apples on Linux, but as NI did something non-standard/proprietary with their drivers, you may want to try another device and see if you have the same degraded performance.

Hmmm, well, I'm just trying out an old Fast Tack Pro, and it does just the same. Really weird : some kind of periodic sound drops. The thing is, that I'm noticing that it happens particularly between Wine FXs and the USB card (be it NI or M-Audio). It doesn seem to happen with Linux native plugs. Now, what can it be? Wine RT permissions, or something like that?
Soli Deo Gloria is online now   Reply With Quote
Old 06-17-2020, 12:01 PM   #16
lilith93
Human being with feelings
 
lilith93's Avatar
 
Join Date: Apr 2018
Location: Karlsruhe
Posts: 387
Default

What happens if you put some Diva instances in Reaper? Do you also get xruns?
__________________
https://soundcloud.com/lilith_93

Debian - Buster / XFCE
lilith93 is offline   Reply With Quote
Old 06-17-2020, 03:48 PM   #17
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

No, I don't... I 'm playing fast notes with 3 instances of Diva ("Dream Synth" category, "3EE Syupa So" patch) and the sustain pedal pressed. That makes up to 73% of total CPU (what a beast, my God), but there is no sign of xruns... It seems to be Wine-related. But, the thing is that the PCI card wasn't as prone to those sound drops as the USB ones.



Does Wine staging need a dedicated raise of RT priority in Rtirq? If so, how is it done?
Soli Deo Gloria is online now   Reply With Quote
Old 06-18-2020, 02:14 AM   #18
lilith93
Human being with feelings
 
lilith93's Avatar
 
Join Date: Apr 2018
Location: Karlsruhe
Posts: 387
Default

At least it seems to be possible:

https://wiki.winehq.org/Wine-Staging...ment_Variables
__________________
https://soundcloud.com/lilith_93

Debian - Buster / XFCE
lilith93 is offline   Reply With Quote
Old 06-18-2020, 12:23 PM   #19
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

Well, I reverted to the PCI card, but the xruns happen with it, too. But they're mainly related to Kontakt. I open a project with many instances of Synth 1 and other Win fxs and it behaves good. Maybe Wine in combination with disk streaming is not a good combo. What puzzles me is that Reaper's meters show plenty of overhead in terms of resources.



What I get with Kontakt are periodic realtime peaks. Even if I record at 128 latency, I get many interrupts even with the transport and metronome sound - it all shuts down for a moment -. But the used CPU resources are meager, so, there is some buggy aspect of Wine that is acting as a bottleneck here. Unfortunately, unless some wizard comes up with a magic recipe to allow Wine to perform reasonably well, I think I have reached the limit.


Anyway, leaving aside Kontakt and some other intensive effects such as Spline EQ, I have already reached my initial goal with Linux... A working MIDI/Audio environment, with many native options and light Win fxs running. I can keep the Win 7 dual boot for the heavy tasks, for now...
Soli Deo Gloria is online now   Reply With Quote
Old 06-18-2020, 12:25 PM   #20
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

Quote:
Originally Posted by lilith93 View Post

I can't say I really understand how to follow that page's guide...
Soli Deo Gloria is online now   Reply With Quote
Old 06-18-2020, 12:46 PM   #21
Klangfarben
Human being with feelings
 
Join Date: Jul 2016
Location: Los Angeles, CA
Posts: 1,105
Default

This guy has patched both Wine and the Kernel to get better real time performance with Wine. Looks very promising although it is in pretty early Alpha right now. The fact that he was able to do this in 3 weeks is pretty impressive.

Unfortunately, patching the kernel every time you switch kernels is kind of a deal breaker for me so I'm hoping there might be a way around this in the future. Not sure if he is on the forum here or not?

https://github.com/nine7nine/pkgbuilds_nspa
Klangfarben is online now   Reply With Quote
Old 06-18-2020, 04:24 PM   #22
Peevy
Human being with feelings
 
Peevy's Avatar
 
Join Date: May 2008
Location: Ireland
Posts: 544
Default

It looks like you've hit a bit of a wall with the combination of or at least one of your system or audio components. Many here have been able to run kontakt via linvst pretty successfully including myself. I've also got a ka6 interface & my latest project has about 16 instances of kontakt with other windows & linux plugins. Are you're samples running of an ssd, have you tried other distros?

Ive been using manjaro for almost 2 years now with the only problems coming from the odd buggy version of wine staging which i was able to roll back to a previous version. There's always a risk running win plugins on linux, which is why even though i do it myself i wouldn't really recommend it. If you can get away with only using native linux plugins that's definitely the way to go. Unfortunately some of my projects require high quality sampled instruments & there's very few available for linux.
__________________
System: Mobo-Asus Prime Z370P II, CPU-i7 8700K, RAM-48gb DDR4 3000mhz, GPU AMD RX580 OS: Manjaro Linux
Soundcard:
Komplete Audio 6 Monitors: Adam A5X
Peevy is offline   Reply With Quote
Old 06-18-2020, 06:20 PM   #23
WyattRice
Human being with feelings
 
WyattRice's Avatar
 
Join Date: Sep 2009
Location: Virginia
Posts: 1,985
Default

Quote:
Originally Posted by Soli Deo Gloria View Post


Now, take a look at this :







Off topic. May I ask what theme is that you are using?
Thanks!
WyattRice is offline   Reply With Quote
Old 06-19-2020, 08:02 AM   #24
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

Quote:
Originally Posted by Klangfarben View Post
This guy has patched both Wine and the Kernel to get better real time performance with Wine.
https://github.com/nine7nine/pkgbuilds_nspa

Wow! I'll be taking a close look at that development! Something like that is badly needed... I 'll write to the guy to ask about it - from a first look at his Git page, I don 't understand at all how can it be tested -.


Quote:
Originally Posted by Peevy View Post
It looks like you've hit a bit of a wall with the combination of or at least one of your system or audio components. Many here have been able to run kontakt via linvst pretty successfully including myself. I've also got a ka6 interface & my latest project as about 16 instances of kontakt with other windows & linux plugins. Are you're samples running of an ssd, have you tried other distros?

I've been using manjaro for almost 2 years now with the only problems coming from the odd buggy version of wine staging which i was able to roll back to a previous version. There's always a risk running win plugins on linux, which is why even though i do it myself i wouldn't really recommend it. If you can get away with only using native linux plugins that's definitely the way to go. Unfortunately some of my projects require high quality sampled instruments & there's very few available for linux.

I tried to install the snapshot of AV Linux, but I had problems with it (something related to UEFI and the grub, I didn't understand completely), so I 've got that pending. Regarding other distros, I'm not too keen on distro hopping, mainly because I fear other environments will add an additional layer of complexity to what I 've already learned in Ubuntu. Nevertheless, I could give an opportunity to Manjaro at some point, as I've read good things about it.


If you don't mind, maybe I 'll write to you via private message, to ask a few things about your setup...


Quote:
Originally Posted by WyattRice View Post
Off topic. May I ask what theme is that you are using?
Thanks!

That theme is my own personal variation of the Default Commala 5 Theme. I've got it listed as "Default Commala 5 JRTheme", probably a variation itself that I downloaded at some point, but the color scheme is in many ways of my own. I also changed some icons to the Reaper v4 version ones, since they were visually more comfortable for my taste. If you're interested in it, I can obviously share it - I never did it because it's basically a personal tweak of the already great Commala one -. I liked Commala mainly because it derives from the official V4 theme, which is the only one I have ever liked, honestly. I don 't really like the V5 and V6 ones at all... And this theme is mostly all I need, with only a few missing things for my taste...
Soli Deo Gloria is online now   Reply With Quote
Old 06-21-2020, 09:20 AM   #25
lilith93
Human being with feelings
 
lilith93's Avatar
 
Join Date: Apr 2018
Location: Karlsruhe
Posts: 387
Default

Maybe have a look here:

https://www.kvraudio.com/forum/viewt...f=259&t=547831
__________________
https://soundcloud.com/lilith_93

Debian - Buster / XFCE
lilith93 is offline   Reply With Quote
Old 06-22-2020, 05:52 AM   #26
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

Thanks for pointing me to that bridge! I had seen it somewhere but somehow I didn't pay attention to it, since it seems to be rather new and there are not many comments about it on the web. I'll contact the dev and begin testing it...
Soli Deo Gloria is online now   Reply With Quote
Old 06-22-2020, 04:18 PM   #27
nspa
Human being with feelings
 
Join Date: Jun 2020
Posts: 14
Default

Quote:
Originally Posted by Klangfarben View Post
This guy has patched both Wine and the Kernel to get better real time performance with Wine. Looks very promising although it is in pretty early Alpha right now. The fact that he was able to do this in 3 weeks is pretty impressive.
Hi, that's me. I noticed traffic from here to my github.

Honestly, it's not impressive at all, really. The performance problems with wine, especially for the proaudio case; have been known about for many years... There used to be some patches for getting around the worst of it - but they are incompatible with modern versions of Wine.

it's also not impressive, because most of my patchwork is already out there in the wild (Steam Proton uses some of it, for example). I just understand a few fundamental problems with wine, relating to our usecase - So i've snatched up stuff that i know will help... I suppose the only part that is impressive -- is that i have a working patch that actually implements PROCESS_PRIOCLASS_REALTIME mapped to linux RT priorities (not perfect yet/WIP, but I've never seen any implemenetation, beyond the patch that mine is based on.).

I'm also fairly familiar with linux and wine, in general. that all said, my background isn't computer science. (although, over the years I have contributed to numerous FOSS projects).

Quote:
Originally Posted by Klangfarben View Post
Unfortunately, patching the kernel every time you switch kernels is kind of a deal breaker for me so I'm hoping there might be a way around this in the future. Not sure if he is on the forum here or not?

https://github.com/nine7nine/pkgbuilds_nspa
There's currently no way around it. The futex-multiple-wait kernel patch has had one RFC / review on LKML -- recently, it's been rewritten and is being reviewed again... No timeline on when it makes it into mainline linux... You might be waiting a while, but yes - the hope is that upstream will merge the feature, eventually.

the kernel support is a hard requirement for my wine branch. you can't emulate / move system calls out of wineserver without it -- the poor performance of VSTs in wine, especially ones like NI kontakt, is due to wineserver being hammered by system calls and as it is single-threaded; that causes serious problems -- it's exactly why they often buckle, stutter and freeze under relatively low DSP load in Jack...

(the above is exactly "the wall" that the OP is hitting).

well, and the fact that wine schedules threads as SCHED_OTHER and threads largely aren't prioritized in any meaningful/useful way... -- your background wine task, for the most part gets as much cpu time as your VSTs important threads. even with wine-staging -- you can't actually prioritize all of the threads correctly (it catches some, but not all)... everything tends to be contended.

anyway, even if i get all of the kinks ironed out -- as i've noted on my github -- we need a re-implementation of one of my legacy patches, to get the kind of performance out of wine that is needed for some plugins... it's a bit beyond my current knowledge to re-implement, unfortunately.

and even if that was implemented -- sometimes, tricks are still needed to get the most out of wine. For example, a few years ago -- even with the most performant version of wine, I had 4 wineservers running, 2 of which were dedicated to just running 2 instances of Kontakt (or sometimes GuitarRig). while the other two, were for the rest of my plugins...

for most average users, something like this would be non-trivial to do. -- as it required multiple wine installations, winelib VST hosts rebuilt/linked against each wine installation. (to funnel the VSTs to the correct wineserver.).

anyway, my point is that it's very hard to get the performance out of wine needed to run heavy VSTs, especially if you plan to run lots of them.
nspa is offline   Reply With Quote
Old 06-23-2020, 06:55 AM   #28
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

Quote:
Originally Posted by nspa View Post
...the poor performance of VSTs in wine, especially ones like NI kontakt, is due to wineserver being hammered by system calls and as it is single-threaded; that causes serious problems -- it's exactly why they often buckle, stutter and freeze under relatively low DSP load in Jack...

(the above is exactly "the wall" that the OP is hitting).

Hi Nspa, and thanks for your detailed insights and work! It was clear from my observations, that as long as you require from Kontakt a little processing effort, something is fundamentally flawed regarding Wine. I see periodic overloads in Kontakt's cpu meter, even when playing relatively uncluttered passages, but those overloads are not reflected in Reaper's performance meter, which has plenty of overhead.


There is a number of success stories regarding Linux and Kontakt, but I don't know which instruments are favored by those users (if you want to clarify it in your case, Peevey, it will be interesting). Something like LASS, the legacy Berlin Woodwinds, or specially Cinesamples 'Abbey Road Pianos, bring wine to its knees from the beginning in my setup.


Fortunately, I have a good performance with other much lighter instruments. I am able to run without problem projects with many Synth 1 instances, the Valhalla plugins and other Win instruments/FXs without a noticeable effort, so that in itself is a success for me and enables my currrent work with Linux. There are already many quality instruments/FXs with Linux versions (Surge, Dexed, Helm and the likes), and I think it will be only a matter of time before we can run other heavy things without a hitch...



Quote:
Originally Posted by nspa View Post
for most average users, something like this would be non-trivial to do. -- as it required multiple wine installations, winelib VST hosts rebuilt/linked against each wine installation. (to funnel the VSTs to the correct wineserver.).


anyway, my point is that it's very hard to get the performance out of wine needed to run heavy VSTs, especially if you plan to run lots of them.

In conclusion, do you think I could test your development? Would it be useful for my usecase? Is it too esoteric of a setup, or I could try it out with your guide? I would like to be a beta tester, but only if the installation/tweaking of the system is reasonably viable for a newbie who dares to change different aspects of the system but is not a programmer himself.

Last edited by Soli Deo Gloria; 06-23-2020 at 07:16 AM.
Soli Deo Gloria is online now   Reply With Quote
Old 06-23-2020, 07:33 AM   #29
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 4,568
Default

A question that pops into my mind on the subject of higher priority WINE.

If you increase WINE's priority to be RT, does that not steal CPU clock cycles that REAPER running in Linux would have gotten and used, and if so would that not ding the performance of REAPER itself?
__________________
Glennbo
Hear My Music - Click Me!!!
--
Glennbo is offline   Reply With Quote
Old 06-23-2020, 07:56 AM   #30
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

Well, Glennbo, I assume you're asking the question to Nspa. Anyway, from my experience so far, I can see that Reaper has plenty (and I mean plenty) of resources available - as far as the Performance Meter shows - when I bring the system to its knees with a single Kontakt instance.

You're probably right in your reasoning, but the problem, I guess, is the profound unbalance between Reaper's available resources and Wine's struggles with a single Kontakt process. That's where Nspa's development is pointing out, I think.
Soli Deo Gloria is online now   Reply With Quote
Old 06-23-2020, 08:10 AM   #31
nspa
Human being with feelings
 
Join Date: Jun 2020
Posts: 14
Default

Quote:
Originally Posted by Soli Deo Gloria View Post
Hi Nspa, and thanks for your detailed insights and work! It was clear from my observations, that as long as you require from Kontakt a little processing effort, something is fundamentally flawed regarding Wine. I see periodic overloads in Kontakt's cpu meter, even when playing relatively uncluttered passages, but those overloads are not reflected in Reaper's performance meter, which has plenty of overhead.
you are trying to run kontakt in a build of wine that has no real synchronization, nor is it setting RT priorities properly. All of those spikes you see are due to that... don't get me wrong, kontakt is a beast and will still use high cpu / dsp, depending on what you have loaded, but those crazy spikes aren't present in my spin of wine.


Quote:
Originally Posted by Soli Deo Gloria View Post
There is a number of success stories regarding Linux and Kontakt, but I don't know which instruments are favored by those users (if you want to clarify it in your case, Peevey, it will be interesting). Something like LASS, the legacy Berlin Woodwinds, or specially Cinesamples 'Abbey Road Pianos, bring wine to its knees from the beginning in my setup.
a lot of those people aren't doing anything super crazy with kontakt. kontakt has plenty of lite instruments, but if you start getting into abbey roads, the giant, etc -- it's another story.

I often have kontakt loaded right up. abbey roads drums, scarbee, the giant, strings, etc -- all on key splits, on one midi channel. heavily stacked multi-instruments - so triggering lots of voices/instruments all at once (live playing)... Reaktor is often thrown into the mix too (it also can be quite heavy). this simply does not work on vanilla wine or staging.

Quote:
Originally Posted by Soli Deo Gloria View Post
Fortunately, I have a good performance with other much lighter instruments. I am able to run without problem projects with many Synth 1 instances, the Valhalla plugins and other Win instruments/FXs without a noticeable effort, so that in itself is a success for me and enables my currrent work with Linux. There are already many quality instruments/FXs with Linux versions (Surge, Dexed, Helm and the likes), and I think it will be only a matter of time before we can run other heavy things without a hitch...
yeah, many lite vsts just aren't heavily multi-threaded and don't put so much pressure on wine.

Quote:
Originally Posted by Soli Deo Gloria View Post
In conclusion, do you think I could test your development? Would it be useful for my usecase? Is it too esoteric of a setup, or I could try it out with your guide? I would like to be a beta tester, but only if the installation/tweaking of the system is reasonably viable for a newbie who dares to change different aspects of the system but is not a programmer himself.
Well, my github provides no guide, beyond a few notes on setting environment variables for my build features.

The reason for this is pretty simple - I'm only a month in, hacking on wine. the other thing is; they are Archlinux packages -- anyone on Arch or an arch-based distro; can simply clone the repo, cd into the package directories, then execute 'makepkg -si' -- it then builds and installs like any other package.

I can't really provide packages for other distros. I'm an Arch lifer (11 years in) and I don't have any time or desire to maintain packages for other distro... most of my efforts here, are for my own use -- but I also know that others may want to use my patchwork -- so I'm sharing it.

it may be a bit advanced as a newbie for you to put together -- but for anyone who can build packages, patch sources, etc -- it's really not hard. my Archlinux's source packages show exactly how I'm building wine-nspa and linux-nspa -- it also shows exactly what patches are applied and in what order, even all of the commands used. (because pkgbuilds are just glorified shell scripts, essentially.).

I think you would need to wait until some brave soul packages it for your distro, unfortunately.
nspa is offline   Reply With Quote
Old 06-23-2020, 08:26 AM   #32
nspa
Human being with feelings
 
Join Date: Jun 2020
Posts: 14
Default

Quote:
Originally Posted by Glennbo View Post
A question that pops into my mind on the subject of higher priority WINE.

If you increase WINE's priority to be RT, does that not steal CPU clock cycles that REAPER running in Linux would have gotten and used, and if so would that not ding the performance of REAPER itself?
No, not really. Reaper's critical threads are affected just like Kontakt.

my patchset rewires wine itself -- all PROCESS_PRIOCLASS_REALTIME process threads or THREAD_PRIORITY_TIME_CRITICAL threads within wine or apps running in wine are grabbed and re-prioritized, same goes for any of the fsync threads (used for synchronization) that are intended for RT... I hook all of these things.

So it's not a matter of kontakt stealing from Reaper - in Reaper, you would just set the buffering threads to THREAD_PRIORITY_TIME_CRITICAL... Reaper and the VSTs benefit from having better synchronization + their critical threads handled by wine-nspa.

Last edited by nspa; 06-23-2020 at 08:34 AM.
nspa is offline   Reply With Quote
Old 06-23-2020, 08:47 AM   #33
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 4,568
Default

Over my head. Thanks for explaining it. I only use Kontakt with it's stock library in a supporting role to audio tracks, and use it without any issues the exact same way as I used it in Windows.

I just assumed there is a finite amount of CPU power, and that two real time processes might fight each other for CPU time. I suppose how powerful of a CPU would factor in too.
__________________
Glennbo
Hear My Music - Click Me!!!
--
Glennbo is offline   Reply With Quote
Old 06-23-2020, 09:13 AM   #34
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

Quote:
Originally Posted by nspa View Post
I think you would need to wait until some brave soul packages it for your distro, unfortunately.

Hmmm, I see... But, what about Manjaro? Is it viable with it? I 've read that it is indeed some kind of "newbie-friendly" Arch, to put it in simple words (well, if the term "newbie-friendly" could be really applied to any Linux environment up to this point, which I seriously doubt). If it could enable to run all the Komplete goodies on it, I could eventually dual-boot with it...
Soli Deo Gloria is online now   Reply With Quote
Old 06-23-2020, 09:57 AM   #35
nspa
Human being with feelings
 
Join Date: Jun 2020
Posts: 14
Default

Quote:
Originally Posted by Soli Deo Gloria View Post
Hmmm, I see... But, what about Manjaro? Is it viable with it? I 've read that it is indeed some kind of "newbie-friendly" Arch, to put it in simple words (well, if the term "newbie-friendly" could be really applied to any Linux environment up to this point, which I seriously doubt). If it could enable to run all the Komplete goodies on it, I could eventually dual-boot with it...
yes, i suspect my packages work fine with Manjaro. it's arch-based and as long as it's developers haven't done anything stupid with linux or wine packaging -- it should install fine... someone would just need to verify that and tell me, as i only test with Archlinux 'proper'.

yeah, no distros are newbie friendly, at least not for proaudio. lol.
nspa is offline   Reply With Quote
Old 06-23-2020, 10:03 AM   #36
Klangfarben
Human being with feelings
 
Join Date: Jul 2016
Location: Los Angeles, CA
Posts: 1,105
Default

Quote:
Originally Posted by nspa View Post
my patchset rewires wine itself -- all PROCESS_PRIOCLASS_REALTIME process threads or THREAD_PRIORITY_TIME_CRITICAL threads within wine or apps running in wine are grabbed and re-prioritized, same goes for any of the fsync threads (used for synchronization) that are intended for RT... I hook all of these things.

So it's not a matter of kontakt stealing from Reaper - in Reaper, you would just set the buffering threads to THREAD_PRIORITY_TIME_CRITICAL... Reaper and the VSTs benefit from having better synchronization + their critical threads handled by wine-nspa.
I also wanted to thank you for such great information and for the work you are putting in. I had a couple questions if you have the time to answer.

First, I know you are only about a month into this, but from what you've done so far and been able to accomplish, what would you say the prognosis is for getting similar/on par performance with Kontakt on Windows in Linux?

Second, I'm using Manjaro. Obviously not the same as Arch, but does have full access to the AUR. Once you have this in a semi-ready for public consumption state, do you have any plans to put this up on AUR or are you just going to stick to your github?

Again, thanks so much for what you are doing. I know you pretty much consider this a hack right now, but for those of us trying to migrate over to Linux full time, this is a really big deal. A lot of plugins I can live without but there just isn't a replacement for Kontakt and the library content.
Klangfarben is online now   Reply With Quote
Old 06-23-2020, 10:06 AM   #37
nspa
Human being with feelings
 
Join Date: Jun 2020
Posts: 14
Default

Quote:
Originally Posted by Glennbo View Post
Over my head. Thanks for explaining it. I only use Kontakt with it's stock library in a supporting role to audio tracks, and use it without any issues the exact same way as I used it in Windows.

I just assumed there is a finite amount of CPU power, and that two real time processes might fight each other for CPU time. I suppose how powerful of a CPU would factor in too.
yeah, it doesn't sound like you are doing heavy lifting with Kontakt. glad it works for you, as you like to use it.

sorry for the technical explanation. it's hard to explain in layman terms... yes, finite resources -- but a system that is setup properly is going to have everything prioritized correctly, wine-nspa attempts to handle wine's threading, synchronization and RT priorities correctly...

for example, on my own system - wine's highest priority threads run just below Jack. so they are very high priority, but lower than Jack's audio callback threads -- this way they don't interrupt audio, but they still get lots of CPU time and are prioritized above most RT threads on my linux system. (minus, audio device and some kernel threads that run at 99 RT priority)... so just like Jack's audio threads don't get interrupted by wine's RT threads -- my system doesn't interfere with wine's RT threads.

this all takes a bit of engineering / planning.
nspa is offline   Reply With Quote
Old 06-23-2020, 03:24 PM   #38
nspa
Human being with feelings
 
Join Date: Jun 2020
Posts: 14
Default

Quote:
Originally Posted by Klangfarben View Post
I also wanted to thank you for such great information and for the work you are putting in. I had a couple questions if you have the time to answer.

First, I know you are only about a month into this, but from what you've done so far and been able to accomplish, what would you say the prognosis is for getting similar/on par performance with Kontakt on Windows in Linux?
Well, I'm a month in -- but with prior dealing with these sorts of issues with wine / proaudio.

My own expectation is to dramatically improve performance in Wine, and yes, for Kontakt too. As to whether or not it's possible to achieve Windows level performance? I would say that's unlikely. The reasons for that are complicated - after all, we are running this software in a non-native environment and we don't have NT kernel. Wine can't do things like wait-on-multiple-objects - that would require that Wineserver was multi-threaded. So there are technical challenges here. some are not easy to solve (far beyond my abilities).

regardless of that, it's still possible to get reasonable performance. I think once I get the threading / priorities all worked out (i kind of had a breakthrough, lastnight. but still a few todo's), then I can move onto other things; like setting priorities from within ntdll, rather than wineserver (which causes xruns, afaict)... and i can start looking at other optimizations - like moving certain calls out of wineserver (that hurt performance) and other things... So i believe that there is lots of room for performance improvements.


Quote:
Originally Posted by Klangfarben View Post
Second, I'm using Manjaro. Obviously not the same as Arch, but does have full access to the AUR. Once you have this in a semi-ready for public consumption state, do you have any plans to put this up on AUR or are you just going to stick to your github?

Again, thanks so much for what you are doing. I know you pretty much consider this a hack right now, but for those of us trying to migrate over to Linux full time, this is a really big deal. A lot of plugins I can live without but there just isn't a replacement for Kontakt and the library content.
Yeah, i very well might maintain packages on the AUR (I used to maintain AUR packages, for several years; custom kernel packages, nvidia driver and some other RT related goodies from RedHat)... But that would be after I feel that I've gotten things to where I want to, at least in terms of more broad consumption... Currently, I'm still experimenting, so it's not there yet / for AUR...

Yes, it's a series of hacks - as I slowly pull together something viable. I'm making fairly steady progress though. But there is a steep learning curve to much of what I am working on... and as someone who is not a software engineer - that makes it even harder, as I'm sure you can imagine.

Thankfully, a couple of folks from codeweavers have been helpful (devs I've contacted about their code, that I'm modified, or used parts of) and if I get into a pinch -- the wine-devel mailing list has always been a friendly place for me. help is usually pretty good. lots of talented software engineers lurk on that list, even if not upstream wine developers.

and yes, I can't live without Kontakt, either. or NI stuff, in general. Aside from AAS Lounge Lizard EP-4 (best electric piano VST, imho), I use NI almost exclusively. hence why I am hacking wine. lol... so yes, i understand where you are coming from.

as an aside, after a few year hiatus from this kind of thing - i find it both hilarious and sad that so many linuxaudio devs have put so much work into VST bridges and integration with Wine -- yet none have bothered with trying to fix the real problems with wine's performance. it's crazy. i don't get it.
nspa is offline   Reply With Quote
Old 06-23-2020, 07:35 PM   #39
osxmidi
Human being with feelings
 
Join Date: Feb 2014
Posts: 581
Default

Well, I think wine needs a lot done to it.

d2d1 is one of them and xembed is another.

Also threads and futexes.

There is Wine Staging esync and Wine Staging tkg https://github.com/Kron4ek/Wine-Builds/releases with wineserver mods but I couldn't notice that much difference, maybe a 5% difference or something like that.

I think it should have been done by now by the main Wine devs that understand the Wine internals and work with them everyday, and Wine Staging esync was done by the main Wine staging dev.

But, if someone else understands the Wine internals, then go for it.

There is also an instance problem with Wine where more instances slow performance and that's probably Wines thread priorities etc.

Also believe it or not, The gpu/drivers can have an effect on Wines performance and Wines video diplay can drag down performance on older cards like on my old core 2 testing laptop for instance.

I was testing Kontakt (on my i7 system) with a large Piano library that I forget the name of and it was spiking to 100% in a periodic sort of way and it turned out that my system rt priorities were not setup and after that the spiking stopped.

Also, what are the cpus that are being used,

An i7 is a different case to a Core Duo.

When the cpu load starts hitting around say 40% then it might interfere with the audio buffer filling speed and therefore spikes and xruns and stuttering might occur.

Last edited by osxmidi; 06-23-2020 at 07:53 PM.
osxmidi is offline   Reply With Quote
Old 06-24-2020, 06:45 AM   #40
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Buenos Aires, Argentina
Posts: 1,031
Default

Quote:
Originally Posted by osxmidi View Post
...I was testing Kontakt (on my i7 system) with a large Piano library that I forget the name of and it was spiking to 100% in a periodic sort of way...
This is exactly my situation with an I7-3770k from 2013, which I have loaded with 40+ Kontakt track projects many times on Windows 7, with hundreds of FXs. While being a relatively "old" machine for the current standards in the US and Europe (it's always strange to me that in this computational world, "old" can be applied to such short periods of time), I see in Reaper's performance meter that I have many, many resources available but the spikes do occur the same in that periodic fashion you observe with Wine. Up to now, I have been bridging everything with Linvst, but I agree that the real bottleneck seems to be Wine.




Quote:
Originally Posted by nspa View Post
regardless of that, it's still possible to get reasonable performance. I think once I get the threading / priorities all worked out (i kind of had a breakthrough, lastnight. but still a few todo's), then I can move onto other things; like setting priorities from within ntdll, rather than wineserver (which causes xruns, afaict)... and i can start looking at other optimizations - like moving certain calls out of wineserver (that hurt performance) and other things... So i believe that there is lots of room for performance improvements.


Well, I'll be taking a look at Manjaro, and see if I can install it and get used to its basics alongside my current Ubuntu Studio install (with which I already feel comfortable). If I see that it's viable to have both systems installed on my main machine, I'd like to beta-test your development, really. In that case, if you don't mind, I'll go on via private message. As time goes by, if things turn out well, all the experience gained with all of this will be reflected in the first posts of this thread, which I plan as a kind of easy (well, "easy") summary of Linux audio optimizations.



Quote:
Originally Posted by nspa View Post
as an aside, after a few year hiatus from this kind of thing - i find it both hilarious and sad that so many linuxaudio devs have put so much work into VST bridges and integration with Wine -- yet none have bothered with trying to fix the real problems with wine's performance. it's crazy. i don't get it.

I agree, and as osxmidi comments, wine devs have strangely missed the focus on this most important topic. Besides, there is a serious, underlying problem with Linux : almost 30 years onwards from its conception, there still seems to be a certain - unconscious? - delight in difficulty just for the sake of it. It always puzzles me that for every simple question on Linux forums, you find on many occasions a hard time finding a straightforward solution. The console-centric paradigm seems to be some kind of - unconscious? - gate-keeping to keep "forever" things as they are : a little, little niche in the desktop computing world. Forgive me about this, but although many technical explanations can be given about Linux's ways, I always get the gate-keeping impression in the end. After all, Linux rules the world with Internet servers, supercomputers and even somehow via Android on the smartphone realm. So, let them keep the desktop field private, to put it somehow...



Maybe in the future, as more and more newbies like me keep entering, little by little, there is a tiny, almost microscopic hope of a really friendly Linux environment. If they iron out all the bugs of Snap and the likes, maybe it will also be a step in that direction. But, in my case, as I profoundly dislike the direction Microsoft is taking with Windows 10, here I am... Apple is not an option for me here in Argentina, and I don't really expect a truly easy Linux experience, at least in my lifetime. Nevertheless, here comes my support to the Linux project, always reckoning that things could - and should - be way, way easier.



Sorry for the rant mode; it was a little relief after all these geeky times with Ubuntu Studio. Now, let's continue working...

Last edited by Soli Deo Gloria; 06-24-2020 at 06:57 AM.
Soli Deo Gloria is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:18 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.