Old 07-23-2018, 09:02 AM   #1
audiojunkie
Human being with feelings
 
audiojunkie's Avatar
 
Join Date: Nov 2011
Posts: 86
Default ALSA vs JACK latency experiences

My understanding is audio apps run with lower latencies with JACK than with ALSA. What has been everyone's experiences with this? My initial testing seemed to confirm this, but I wanted to know what everyone else was experiencing.

Thanks!
audiojunkie is offline   Reply With Quote
Old 07-23-2018, 09:57 AM   #2
David Else
Human being with feelings
 
David Else's Avatar
 
Join Date: Mar 2012
Location: Near London, UK
Posts: 577
Default

I don't think this is the case as JACK runs on top of ALSA. I have not tested myself.
__________________
----------> Fedora Linux Distribution = Computing Joy & Freedom <----------
Learn Digital Audio Home | 'Nebula Explained' Course Out Now! | YouTube Channel | Twitter
David Else is offline   Reply With Quote
Old 07-23-2018, 11:19 AM   #3
audiojunkie
Human being with feelings
 
audiojunkie's Avatar
 
Join Date: Nov 2011
Posts: 86
Smile

Quote:
Originally Posted by David Else View Post
I don't think this is the case as JACK runs on top of ALSA. I have not tested myself.
That's what one would think logically. :-) However, there are several reports of xruns like crazy in ALSA and smooth running under JACK (and surely vice versa as well). It made me think that it may have come down to applications not being specifically "tuned" to work on ALSA, whereas JACK is tuned to work on ALSA, and apps are tuned to work on JACK. That's the only thing I can think of that might cause this. But either way, I'm trying to determine if there is any truth to it, and if Reaper works better in one verses the other.

So, what is everyone's experiences when running in ALSA vs JACK? How low can you get your latency before XRuns when using each technology?
audiojunkie is offline   Reply With Quote
Old 07-23-2018, 11:37 AM   #4
audiojunkie
Human being with feelings
 
audiojunkie's Avatar
 
Join Date: Nov 2011
Posts: 86
Default

Continuing with my research on this topic, I found the following conversation from the Mixxx Community Forums to be interesting:

https://www.mixxx.org/forums/viewtopic.php?f=1&t=460

This seems to indicate that there is NO added latency, which would indicate that JACK itself is at least equal to ALSA latency-wise. I suppose it is still possible for badly behaving apps in the JACK chain to cause latency. And it is also possible, I suppose, that when an app is tuned better for a particular technology (ie ALSA vs JACK) than another, then things could run better on one vs the other. That clears up a lot! So, it comes down to this:

Does "REAPER" run with lower latency and less Xruns when using straight ALSA, or through JACK when tested on the same REAPER project?
audiojunkie is offline   Reply With Quote
Old 07-23-2018, 11:57 AM   #5
Jack Winter
Human being with feelings
 
Jack Winter's Avatar
 
Join Date: Aug 2007
Location: Luxembourg/Spain
Posts: 1,787
Default

I think that would need testing and might even differ between systems.

FWIW, I suspect that ALSA might have the edge, as reaper then has exclusive access to device, with JACK there might be other clients and there is some code overhead.
__________________
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 07-23-2018, 01:41 PM   #6
audiojunkie
Human being with feelings
 
audiojunkie's Avatar
 
Join Date: Nov 2011
Posts: 86
Default

Quote:
Originally Posted by Jack Winter View Post
I think that would need testing and might even differ between systems.

FWIW, I suspect that ALSA might have the edge, as reaper then has exclusive access to device, with JACK there might be other clients and there is some code overhead.
It is definitely confirmed that ALSA has the edge with CPU cycles. The developers themselves have confirmed that JACK uses more CPU cycles than ALSA alone. But they strongly affirm that JACK itself causes no latency. So ALSA definitely has the edge in that area. :-)
audiojunkie is offline   Reply With Quote
Old 07-23-2018, 02:07 PM   #7
Jack Winter
Human being with feelings
 
Jack Winter's Avatar
 
Join Date: Aug 2007
Location: Luxembourg/Spain
Posts: 1,787
Default

The latency will be the same, given by buffer / samplerate (+ hardware latency), JACK doesn't add any latency as such.

Though it might make the audio processing thread run a little longer, thus bringing it closer to the deadline.
__________________
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 10-10-2018, 07:08 PM   #8
Beco
Human being with feelings
 
Join Date: Sep 2018
Location: Brazil
Posts: 5
Default How Linux Audio Works vs. Windows

There is a very good explanation about ALSA and JACK. Link below:

https://www.learndigitalaudio.com/ho...ows-audio-2017

Best Regards
Beco is offline   Reply With Quote
Old 10-10-2018, 07:31 PM   #9
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 3,946
Default

Currently I get much better performance with JACK than I do using ALSA.
__________________
Glennbo
Hear My Music - Click Me!!!
--

Last edited by Glennbo; 10-11-2018 at 05:37 PM.
Glennbo is offline   Reply With Quote
Old 10-10-2018, 10:00 PM   #10
JamesPeters
Human being with feelings
 
JamesPeters's Avatar
 
Join Date: Aug 2011
Location: Near a big lake
Posts: 2,670
Default

Let's see how that changes as of tomorrow's build.
__________________
http://petersamplification.com
Using REAPER for Linux
JamesPeters is offline   Reply With Quote
Old 10-10-2018, 10:42 PM   #11
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 3,946
Default

Quote:
Originally Posted by JamesPeters View Post
Let's see how that changes as of tomorrow's build.
I'm real curious to see the results of that test as well!
__________________
Glennbo
Hear My Music - Click Me!!!
--
Glennbo is offline   Reply With Quote
Old 10-11-2018, 02:35 PM   #12
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,437
Default

5.96+dev1011 has the ALSA updates, give that a try. I tested it on a laptop built-in audio (3 periods), a Zoom R24 USB (3 periods), and a RME HDSP PCI (2 periods) and it seems to improve the laptop built-in audio, and have no real effect on the other two.
Justin is offline   Reply With Quote
Old 10-11-2018, 03:11 PM   #13
JamesPeters
Human being with feelings
 
JamesPeters's Avatar
 
Join Date: Aug 2011
Location: Near a big lake
Posts: 2,670
Default

Realtime xruns now "calm down" by themselves after the CPU spikes stop. Thanks! Also now with my "stress test" of many instances of ReaPitch, it seems I can reliably use more plugins than before, at least as many as when I used x64 Windows. Let's see what Glennbo says...
__________________
http://petersamplification.com
Using REAPER for Linux
JamesPeters is offline   Reply With Quote
Old 10-11-2018, 05:37 PM   #14
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 3,946
Default

Quote:
Originally Posted by Justin View Post
5.96+dev1011 has the ALSA updates, give that a try. I tested it on a laptop built-in audio (3 periods), a Zoom R24 USB (3 periods), and a RME HDSP PCI (2 periods) and it seems to improve the laptop built-in audio, and have no real effect on the other two.
Well drat, if anything I'm getting worse performance from ALSA than before.

EDIT:

I now know why ALSA has never performed as well as JACK at least on my system.

Selecting JACK with 2 periods results in different reported latency in REAPER than selecting ALSA with 2 periods.

JACK with 2 periods results in 1.4/2.9ms
ALSA with 2 periods results in 1.4/1.4ms

But interestingly . . .

ALSA with 3 periods results in 1.4/2.9ms

This totally explains why using ALSA resulted in sputtering with my system when JACK with the exact same setting did not.

What it does NOT explain is why the difference in reported latency in REAPER.
__________________
Glennbo
Hear My Music - Click Me!!!
--

Last edited by Glennbo; 10-12-2018 at 08:00 AM.
Glennbo is offline   Reply With Quote
Old 10-11-2018, 06:30 PM   #15
JamesPeters
Human being with feelings
 
JamesPeters's Avatar
 
Join Date: Aug 2011
Location: Near a big lake
Posts: 2,670
Default

Ok I'll install JACK and do a comparison.

Oops I forgot I'd already installed JACK. Ok comparison done.

Performance with Reaper talking to ALSA directly is approximately the same as using JACK talking to ALSA (when using the same blocksize/numbers/samplerate). The only difference is that the output latency figure is a bit larger when using JACK.

(My test is solely playing audio and using a bunch of ReaPitch instances to max out the CPU. I get it to around 85% and it still works smoothly, and that's when I stop adding plugins.)
__________________
http://petersamplification.com
Using REAPER for Linux

Last edited by JamesPeters; 10-11-2018 at 06:37 PM.
JamesPeters is offline   Reply With Quote
Old 10-11-2018, 07:12 PM   #16
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 3,946
Default

Quote:
Originally Posted by JamesPeters View Post
Ok I'll install JACK and do a comparison.

Oops I forgot I'd already installed JACK. Ok comparison done.

Performance with Reaper talking to ALSA directly is approximately the same as using JACK talking to ALSA (when using the same blocksize/numbers/samplerate). The only difference is that the output latency figure is a bit larger when using JACK.

(My test is solely playing audio and using a bunch of ReaPitch instances to max out the CPU. I get it to around 85% and it still works smoothly, and that's when I stop adding plugins.)

You bring up something I hadn't looked at. I get asymmetrical latency numbers with JACK, which is also what I see in Windows using ASIO, but with ALSA I am getting symmetrical values, which are slightly lower on one side. This is what REAPER displays with JACK and with ALSA.

1.4/2.9ms with JACK

1.4/1.4ms with ALSA

I just tried setting ALSA to use three periods, and it now displays 1.4/2.9ms like JACK does with two periods, and after hammering on REAPER while playing back the song it seems as though that might have fixed the frazzing.

I'm also noticing that rather than saying 2/2ch like it does with JACK, it is reading 12/10ch, which makes me wonder if I can now access both cards directly from within REAPER.

Previously the only way I could get both cards to be seen by REAPER was to use Qjackctrl with it's patchbay/router, otherwise the second card would never get any audio into REAPER for times when I'm recording 4 channel acoustic drums.

Will do more testing, but I've now had the song playing in a constant loop the whole time I've been typing this in and it has not gone into frazz mode.

Three MIDI interfaces (two on the two M-Audio cards, and one USB from an Akai pad controller) plus four channel simultaneous audio inputs will be my mission for tomorrow!
__________________
Glennbo
Hear My Music - Click Me!!!
--

Last edited by Glennbo; 10-11-2018 at 07:17 PM.
Glennbo is offline   Reply With Quote
Old 10-11-2018, 07:19 PM   #17
JamesPeters
Human being with feelings
 
JamesPeters's Avatar
 
Join Date: Aug 2011
Location: Near a big lake
Posts: 2,670
Default

The lowest latency in ALSA I've gotten without the audio cutting out was 5.8ms/11ms at 44.1KHz (at 24 bits or 32 bits, no difference). That's 256 sample buffer x3. It's approximately the lowest latency setting I got using the same device in Windows 7 with ASIO. It's an Asus Xonar DX card.

With JACK (talking to ALSA) it was 5.8ms/17ms using those same buffer and sample rate settings.

I imagine I could get lower latency by stepping up the sample rate, but I don't use higher sample rates. And if I used a realtime kernel maybe I could improve that number. I'm just not tempted too much to swap kernels at the moment.
__________________
http://petersamplification.com
Using REAPER for Linux
JamesPeters is offline   Reply With Quote
Old 10-11-2018, 07:47 PM   #18
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 3,946
Default

Quote:
Originally Posted by JamesPeters View Post
The lowest latency in ALSA I've gotten without the audio cutting out was 5.8ms/11ms at 44.1KHz (at 24 bits or 32 bits, no difference). That's 256 sample buffer x3. It's approximately the lowest latency setting I got using the same device in Windows 7 with ASIO. It's an Asus Xonar DX card.

With JACK (talking to ALSA) it was 5.8ms/17ms using those same buffer and sample rate settings.

I imagine I could get lower latency by stepping up the sample rate, but I don't use higher sample rates. And if I used a realtime kernel maybe I could improve that number. I'm just not tempted too much to swap kernels at the moment.
Before I switched from Airwave (that other Air thing) to LinVST, I couldn't even get REAPER to finish initializing unless the latency was set to 512 samples, but once I started using LinVST, switched to a low latency kernel and set real time privileges for myself, I can run everything as low as I could in Windows.

I'm REALLY hoping that REAPER will see the two cards now as one device using ALSA, which is what I see using ASIO in Windows. I'm not going to mess with it tonight, but it would be GREAT if I didn't have to worry about running REAPER after launching Qjackctrl to make the routing happen that allows me to use all four inputs from the two stereo cards.

It has already bitten me once when I recorded some acoustic drums and when playing back the take realized that I had forgotten to start Qjackctrl first, so only two of the four tracks recorded anything. I had to play and record that whole drum part a second time!
__________________
Glennbo
Hear My Music - Click Me!!!
--
Glennbo is offline   Reply With Quote
Old 10-11-2018, 08:05 PM   #19
JamesPeters
Human being with feelings
 
JamesPeters's Avatar
 
Join Date: Aug 2011
Location: Near a big lake
Posts: 2,670
Default

So I just tried the Liquorix kernel and appended limits.conf with:

james - rtprio 98
james - memlock unlimited

(Yeah I'm real original with my username on my computer.)

And then I rebooted, and tested Reaper again.

I'm not able to set any lower latency with the sound card. The CPU usage increased slightly. However Reaper remains more responsive when it's loaded down at 80%+. That's the only difference I noticed. I'm probably going to undo those changes, go back to the stock MX Linux kernel.

I was getting the same low latency as in Windows already with the stock kernel, so I wasn't expecting miracles in that regard. I'm pretty sure this card wasn't really intended to be as low latency as 1.5ms/1.5ms.

(edit) man changing this stuff is fast!

I reverted to the stock kernel and removed that stuff from limits.conf. CPU usage went down in Reaper. Responsiveness is actually about the same overall. Lesson learned for that kernel. I wonder if the more recent kernels are just better at this sort of thing. I'm a bit late to the game to know.

Quote:
Originally Posted by Glennbo View Post
I'm REALLY hoping that REAPER will see the two cards now as one device using ALSA, which is what I see using ASIO in Windows.
I'm guessing you have two of "the same" audio device and their driver in Windows allows them to work (sync) together. I've seen that with M-Audio devices. Anyway that'd be great for anyone who wants that functionality, another win for Linux audio.
__________________
http://petersamplification.com
Using REAPER for Linux

Last edited by JamesPeters; 10-11-2018 at 08:27 PM.
JamesPeters is offline   Reply With Quote
Old 10-11-2018, 08:50 PM   #20
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 3,946
Default

Quote:
Originally Posted by JamesPeters View Post
So I just tried the Liquorix kernel and appended limits.conf with:

james - rtprio 98
james - memlock unlimited

(Yeah I'm real original with my username on my computer.)

And then I rebooted, and tested Reaper again.

I'm not able to set any lower latency with the sound card. The CPU usage increased slightly. However Reaper remains more responsive when it's loaded down at 80%+. That's the only difference I noticed. I'm probably going to undo those changes, go back to the stock MX Linux kernel.

I was getting the same low latency as in Windows already with the stock kernel, so I wasn't expecting miracles in that regard. I'm pretty sure this card wasn't really intended to be as low latency as 1.5ms/1.5ms.

(edit) man changing this stuff is fast!

I reverted to the stock kernel and removed that stuff from limits.conf. CPU usage went down in Reaper. Responsiveness is actually about the same overall. Lesson learned for that kernel. I wonder if the more recent kernels are just better at this sort of thing. I'm a bit late to the game to know.
Yeah, I wouldn't expect you to get real super low latency out of that card. I have that same Xonar card in my HTPC machine in my living room, because I needed the TosLink interface to connect to my receiver's TosLink inputs so it can do the D/A conversion for Dolby Digital 5.1 audio. That machine is a Windows based BeyondTV server and client.

Quote:
I'm guessing you have two of "the same" audio device and their driver in Windows allows them to work (sync) together. I've seen that with M-Audio devices. Anyway that'd be great for anyone who wants that functionality, another win for Linux audio.
Yep, they are two identical M-Audio Delta 2496 cards, with the first one acting as the clock for both itself and for the other card over SPDIF. In Windows they appear as one device with twice the inputs/outputs, and midi interfaces. In REAPER for Windows I can right click the record button and on the audio entry of the menu I see all the ins and outs of the first card followed by all the ins and outs of the second card.

I have a 4-channel template setup for my acoustic drums that gets the first two channels from the first card and the second two channels from the second card. Actually I have the same thing setup in REAPER for Linux, but it currently requires me to fire up Qjackctrl to get all four channels of input.

Here's what the routing looks like in Qjackctrl, that I am hoping can be achieved with just REAPER and ALSA.

__________________
Glennbo
Hear My Music - Click Me!!!
--
Glennbo is offline   Reply With Quote
Old 10-11-2018, 09:28 PM   #21
JamesPeters
Human being with feelings
 
JamesPeters's Avatar
 
Join Date: Aug 2011
Location: Near a big lake
Posts: 2,670
Default

For a budget card, the audio on this Xonar DX is crazy good. It's actually one of the best audio devices I've ever used on any system (not just my own), although it's very limited for features and i/o. So I'll accept the current latency and be happy. I had to know if a different kernel would allow me to lower the blocksize/buffers though. That would've bothered me if I didn't test it.
__________________
http://petersamplification.com
Using REAPER for Linux
JamesPeters is offline   Reply With Quote
Old 10-12-2018, 07:19 AM   #22
bulevardi
Human being with feelings
 
Join Date: Feb 2017
Location: Brussels
Posts: 55
Thumbs up

Never was able to connect Jack properly, always had issues with tons of stuff

However, ALSA works out of the box, works fine for me, had no problem with latency
__________________
More adventure on: http://users.telenet.be/bulevardi
bulevardi is offline   Reply With Quote
Old 10-17-2018, 08:59 PM   #23
Beco
Human being with feelings
 
Join Date: Sep 2018
Location: Brazil
Posts: 5
Default RT priority

Usually I use jack, and today I just test (with alsa) in the section audio device and set the RT priority to 50 (default hardware priority) and I had very good results.
Attached Images
File Type: png reaper audio device.png (63.1 KB, 226 views)

Last edited by Beco; 10-29-2018 at 06:11 AM.
Beco 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 10:13 AM.


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