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

Reply
 
Thread Tools Display Modes
Old 11-26-2018, 09:42 AM   #1
Sangeppato
Human being with feelings
 
Join Date: Nov 2018
Posts: 15
Default Alsa/Jack Periods and a Feature Request

Hello to everyone,
In Reaper, I've noticed something strange:
If I choose ALSA in the Device section and I set the Periods/buffer to 2 I get a reported latency of n/n (for example 2.6ms/2.6ms with a 128 buffer), while if I set it to 3, I get a latency of n/2n (2.6ms/5.3ms), which is fine.
The strange thing is that if I start Jack with 2 Periods/buffer, I'll the get the same latency as Alsa with 3 Periods, so n/2n (2.6/5.3).
This doesn't make much sense to me..

Apart from that: Justin, if you read this first of all thank you for making Reaper available on Linux!
Second, I see that if I select Jack in the settings, I've got the ability to start it when I launch Reaper with a custom command, which is awesome.. would it be possible to get the same option to stop Jack on exit?
This way I shouldn't remember to start/stop jack at all and I think it would be very useful. Thanks!
Sangeppato is offline   Reply With Quote
Old 11-26-2018, 09:52 AM   #2
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 9,055
Default

Quote:
Originally Posted by Sangeppato View Post
Hello to everyone,
In Reaper, I've noticed something strange:
If I choose ALSA in the Device section and I set the Periods/buffer to 2 I get a reported latency of n/n (for example 2.6ms/2.6ms with a 128 buffer), while if I set it to 3, I get a latency of n/2n (2.6ms/5.3ms), which is fine.
The strange thing is that if I start Jack with 2 Periods/buffer, I'll the get the same latency as Alsa with 3 Periods, so n/2n (2.6/5.3).
This doesn't make much sense to me..

Apart from that: Justin, if you read this first of all thank you for making Reaper available on Linux!
Second, I see that if I select Jack in the settings, I've got the ability to start it when I launch Reaper with a custom command, which is awesome.. would it be possible to get the same option to stop Jack on exit?
This way I shouldn't remember to start/stop jack at all and I think it would be very useful. Thanks!
I see the exact same behavior and it initially made me think and post that ALSA performance wasn't as good as JACK because using 2 periods in JACK I got not pops or crackles where using 2 periods in ALSA did.

It wasn't until I noticed that difference you mention that I realized I really get about the same performance using 3 periods with ALSA as I do using 2 with JACK.
__________________
Glennbo
Hear My Music - Click Me!!!
--
Glennbo is offline   Reply With Quote
Old 11-26-2018, 11:17 AM   #3
Jack Winter
Human being with feelings
 
Jack Winter's Avatar
 
Join Date: Aug 2007
Location: Luxembourg/Spain
Posts: 1,922
Default

This is because you are using JACK2 and it double buffers output by default. AFAIK this is needed for it's multi cpu support, click less connections, etc. This also allows the application more time to finish calculating the audio for the period, which can lead to less xruns. When it needs to send data to the soundcard, it will send the data calculated the previous period, though with the cost of increasing latency.

You can turn off this behavior in JACK2 by using the -S command line switch. JACK1 doesn't have this behavior and works the same way as reaper's alsa driver.

When trying for the lowest latency it could pay off to try both 2/3 periods and 44k1/48k to see what gives the best result. Don't forget to check the real world loopback latency with reainsert, and to configure it in reaper's Audio->Record settings so that overdubbed material is properly aligned. The loopback latency is always higher than the one given by sample rate, buffer size and periods due to things like latency in the USB stack, digital to analog conversion time, etc. Sometimes the latency is negligible but in other situations it might be significant..
__________________
Reaper for Linux Documentation (WIP). Software: Archlinux/KDE, Fabfilter FX, Komplete 8, Nebula, Schwa/Stillwell, T-racks Max/Amplitube/SVX, etc. Gear: i7-2600k/4700HQ/16GB, RME Multiface/Babyface, Behringer X32, Genelec 8040, etc. :)
Jack Winter is offline   Reply With Quote
Old 11-26-2018, 11:47 AM   #4
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 9,055
Default

For my setup, I have to use JACK because ALSA can't get a lock on my midi interfaces, and while I can get the slightly lower latency with 2 periods and no double buffering on the output, it only works without artifacts for a few tracks. Since Windows always showed asymmetrical latencies in REAPER using the genuine Avid drivers, I figure that it's not a bad thing to see the same thing in Linux with JACK.

I can still record guitars and basses while monitoring through REAPER, even if I have to push the latency up a bit by increasing the buffer size to 128 from the normal 64 samples I run. I only have to do this when I've mostly mixed a song and there are tons of plugins when I decide to re-record some part, but now that I'm veering away from using Windows plugins so much, I may not even run into that any longer. At least I can hope it will go that way. In Windows, I NEVER changed the latency in REAPER always running with a 64 samples latency, even with 100+ plugins.
__________________
Glennbo
Hear My Music - Click Me!!!
--
Glennbo is offline   Reply With Quote
Old 11-26-2018, 12:03 PM   #5
Jack Winter
Human being with feelings
 
Jack Winter's Avatar
 
Join Date: Aug 2007
Location: Luxembourg/Spain
Posts: 1,922
Default

Using double buffering on the output has the advantage that the program has more time to finish calculating audio.

Strange that alsa doesn't pick up your midi devices, probably worth a post in bugs thread?

Hopefully the plugin situation on linux will improve, and we'll have all the toys people on windows/osx enjoy. I must say that as cool as it is running windows vsts on linux, it does have a performance penalty xrun/latency wise.
__________________
Reaper for Linux Documentation (WIP). Software: Archlinux/KDE, Fabfilter FX, Komplete 8, Nebula, Schwa/Stillwell, T-racks Max/Amplitube/SVX, etc. Gear: i7-2600k/4700HQ/16GB, RME Multiface/Babyface, Behringer X32, Genelec 8040, etc. :)
Jack Winter is offline   Reply With Quote
Old 11-26-2018, 12:25 PM   #6
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 9,055
Default

Quote:
Originally Posted by Jack Winter View Post
Using double buffering on the output has the advantage that the program has more time to finish calculating audio.
I think my machine needs it, because it only takes three or four tracks before I start hearing either smears or other artifacts in the audio. With double buffering I can record a whole song's worth of tracks at 1.4/2.9ms and never have any issues. Once I start adding FX I may have to up the buffer size to 128 which gets me 2.9/5.8ms in REAPER, which is still low enough latency that I can go back and re-record a guitar or bass part while monitoring through REAPER if I need to.

Quote:
Strange that alsa doesn't pick up your midi devices, probably worth a post in bugs thread?
I suspect that it is a capture command that I issued in a terminal months ago to get midi working with JACK. I don't remember what the command was, as it was something I found on the internet, but it was needed to get midi working with JACK and it is persistent between boots, which is why I think it may be the culprit.

Even if I could get midi to work with ALSA I would need to use JACK though, as QjackCtrl's routing matrix has been the only way I've been able to get both my M-Audio 2496 cards to be accessible in REAPER.

Quote:
Hopefully the plugin situation on linux will improve, and we'll have all the toys people on windows/osx enjoy. I must say that as cool as it is running windows vsts on linux, it does have a performance penalty xrun/latency wise.
Well, I voted with my wallet today and sent some money to a company that is providing the same native plugins for Windows, OSX, and Linux. I might just start a thread about buying plugins from OverTone so that Mike will see it and know that it was his inclusion of native Linux VST plugins that got him my money!

-
__________________
Glennbo
Hear My Music - Click Me!!!
--
Glennbo is offline   Reply With Quote
Old 11-26-2018, 02:49 PM   #7
Sangeppato
Human being with feelings
 
Join Date: Nov 2018
Posts: 15
Default

Quote:
Originally Posted by Jack Winter View Post
This is because you are using JACK2 and it double buffers output by default. AFAIK this is needed for it's multi cpu support, click less connections, etc. This also allows the application more time to finish calculating the audio for the period, which can lead to less xruns. When it needs to send data to the soundcard, it will send the data calculated the previous period, though with the cost of increasing latency.

You can turn off this behavior in JACK2 by using the -S command line switch. JACK1 doesn't have this behavior and works the same way as reaper's alsa driver.

When trying for the lowest latency it could pay off to try both 2/3 periods and 44k1/48k to see what gives the best result. Don't forget to check the real world loopback latency with reainsert, and to configure it in reaper's Audio->Record settings so that overdubbed material is properly aligned. The loopback latency is always higher than the one given by sample rate, buffer size and periods due to things like latency in the USB stack, digital to analog conversion time, etc. Sometimes the latency is negligible but in other situations it might be significant..
Thank you very much, this was really helpful!
I've tried running Jack2 in synchronous mode (with jack2 the command is "jack_control eps sync true") with 3 periods/buffer instead of 2 and I get the same reported latency as before (non synchronous mode and 2 periods), but with no xruns at all, while with the previous setup I used to get some frequent and very annoying dropouts (had to increase the latency to record).
This should definitely be mentioned on the Jack page of the Arch wiki.

Quote:
Hopefully the plugin situation on linux will improve, and we'll have all the toys people on windows/osx enjoy. I must say that as cool as it is running windows vsts on linux, it does have a performance penalty xrun/latency wise.
I really hope so. Currently I haven't found a single good amp sim on linux (it looks like there isn't any) so I'm stuck with the LePou VSTs. Luckily for me they're very lightweight and work great with wine and LinVST without having an impact on latency, but a native solution would be better obviously.
Sangeppato is offline   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 03:26 PM.


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