|
08-05-2018, 01:14 AM | #1 |
Human being with feelings
Join Date: Aug 2018
Posts: 20
|
ALSA Underrun Recovery
I am using Reaper 5.94 with RME Babyface Pro and the following settings.
Audio system: ALSA Input channels: 12 Output channels: 2 Sample rate: 48000 Blocksize: 16 Bit depth: 24 Periods: 2 RT priority: 40 Auto-suspend PulseAudio: checked Disable power management if supported: checked If I open a project with a couple of tracks (ReaSynth and Helm) and press Play the current position indicator progresses at a rate of about 0.001 or 0.002 every second for a long time before playing back normally. During this time I hear 2 clicks per second with the channel meters going up and down for each click. If I press Stop, click on the audio statistics bar at the top right of the window, press OK and press Play it returns to normal immediately. Could the ALSA handling be improved so that current position doesn't progress at a snails pace with 2 clicks noises per second and take a long time to recover when there is underrun? Thanks. |
08-05-2018, 02:08 AM | #2 |
Human being with feelings
Join Date: Mar 2012
Posts: 610
|
Your blocksize is incredibly low, that is the latency, try 128 or 256.
Your sound device is USB, sometimes 'periods 3' can work better. You need to experiment a bit. I would start with periods 3 and work the blocksize up till you get no x-runs.
__________________
----------> Debian Linux Distribution = Computing Joy & Freedom <---------- |
08-05-2018, 03:39 AM | #3 |
Human being with feelings
Join Date: Feb 2008
Location: Finland
Posts: 160
|
I've found this interesting - not sure how true the "multiple of 1ms" thing is with Linux USB, but at least I think I have had better results using these. And it would explain the recommendation (which has been around for years) to use 3 periods when using a usb audio device in Linux. I assume it is no different when using Jack or Alsa directly.
https://wiki.linuxaudio.org/wiki/lis..._usb_interface |
08-05-2018, 01:31 PM | #4 | |
Human being with feelings
Join Date: Jul 2006
Posts: 20,859
|
Quote:
__________________
It's time to take a stand against the synthesizer. |
|
08-06-2018, 12:20 AM | #5 |
Human being with feelings
Join Date: Feb 2008
Location: Finland
Posts: 160
|
And another note related to these frame/period settings - just as qjackctl will allow you to type in your own entry (not just the dropdown 128/256/512, etc.), you can type these in in Reper's Alsa settings. For instance, I use ( 192 / 48000 ) * 2 = 8 with my Zoom R16 when using it in Linux.
|
08-06-2018, 03:20 AM | #6 |
Human being with feelings
Join Date: Aug 2018
Posts: 20
|
I find with USB audio on Linux that the round trip latency is a lot more than the block size and Reaper seems to indicate.
For example with 48000 Hz, 24-bit, periods 2 measuring with analog loopback cable. Block size of 48 gives around 240 samples of round trip latency (240 / 48000 = 5 ms). Block size of 16 gives around 110 samples of round trip latency (110 / 48000 = 2.3 ms). I am measuring by going to Preferences > Audio > Recording > Uncheck "Use audio driver reported latency". Then I add a track with a sine wave, remove fade-in at start of clip, loop it back using audio cable to my input and record it on second track. Then I set time units to Samples and measure the number of samples offset between the original and the recorded. That is a lot more latency than I would get if I used ASIO on Windows with 48 samples ASIO buffer size. Perhaps the USB audio stack on Linux could use some improvement for low latency? Last edited by net147; 08-06-2018 at 04:24 AM. |
08-13-2018, 02:14 PM | #7 | |
Human being with feelings
Join Date: Nov 2011
Posts: 971
|
Quote:
|
|
08-14-2018, 08:29 AM | #8 |
Human being with feelings
Join Date: Jul 2006
Posts: 20,859
|
Thanks Jack and net147. ^ Gives me some stuff to read up on.
__________________
It's time to take a stand against the synthesizer. |
08-10-2018, 03:33 AM | #9 |
Human being with feelings
Join Date: Aug 2007
Location: Luxembourg/Spain
Posts: 1,922
|
I have no clear idea about what you are doing, but alsa underruns normally indicate that you need to use a bigger block size, also try a higher number of periods.
__________________
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. :) |
08-10-2018, 07:30 AM | #10 | |
Human being with feelings
Join Date: Aug 2018
Posts: 20
|
Quote:
I am also using Arch. Was thinking of digging into the Linux USB audio driver code to try to reduce USB audio latency. |
|
08-10-2018, 09:21 AM | #11 |
Human being with feelings
Join Date: Aug 2007
Location: Luxembourg/Spain
Posts: 1,922
|
Depends on what I'm doing. Mostly I'm at 1024/2 with my rme multiface. The multiface adds very little extra latency. So the loopback latency comes out at 2 x 1024 + 95 samples. Sometimes I'm at 64/2 which comes out at about 5ms roundtrip
A good utility for testing this is actually reainsert. You can also configure reaper to compensate for the additional hardware latency. Latency with USB is a different story though... As there are no drivers made for Linux we are mostly stuck with usb class 2.0 audio, which kind of sucks.. There is quite a lot of extra latency and it seems to vary a few samples each time you restart and test again. Don't think anything can be done to fix this, but if you can do so, you'll be one of my heroes...! I don't have any values at hand, but if I find some time I could run a few loopback tests.
__________________
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. :) |
08-10-2018, 02:58 PM | #12 |
Human being with feelings
Join Date: Aug 2007
Location: Luxembourg/Spain
Posts: 1,922
|
A quick loopback test with my babyface at 44k1.
32/2 64 + 156 ~ 5.0ms 32/3 96 + 199 ~ 6.7ms 64/2 128 + 256 ~ 8.7ms 64/3 192 + 384 ~13.1ms 128/2 256 + 456 ~16.1ms 128/3 384 + 632 ~23.0ms 256/2 512 + 637 ~26.0ms 256/3 768 + 637 ~31.8ms 1024/2 2048 + 663 ~61.5ms 1024/3 3072 + 663 ~84.7ms Kinda sucks..
__________________
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. :) |
08-10-2018, 11:34 PM | #13 | |
Human being with feelings
Join Date: Jul 2006
Posts: 20,859
|
Quote:
__________________
It's time to take a stand against the synthesizer. |
|
08-11-2018, 07:22 AM | #14 | |
Human being with feelings
Join Date: Aug 2018
Posts: 20
|
Quote:
I have modified the Linux snd-usb-audio driver to reduce the latency and created an AUR DKMS package: https://aur.archlinux.org/packages/s...wlatency-dkms/ Here are my test results using Reaper v5.941 with ReaInsert (48000 Hz, 24-bit) on my RME Babyface Pro: Before (Linux 4.17.14-zen1-1-zen): 16/2 32 + 80 ~ 2.333 ms 16/3 48 + 109 ~ 3.271 ms 32/2 64 + 129 ~ 4.021 ms 32/3 96 + 166 ~ 5.458 ms 64/2 128 + 205 ~ 6.938 ms 64/3 192 + 242 ~ 9.042 ms 128/2 256 + 352 ~ 12.667 ms 128/3 384 + 496 ~ 18.334 ms 256/2 512 + 650 ~ 24.208 ms 256/3 768 + 650 ~ 29.542 ms 512/2 1024 + 634 ~ 34.542 ms 512/3 1536 + 634 ~ 45.208 ms 1024/2 2048 + 650 ~ 56.208 ms 1024/3 3072 + 650 ~ 77.542 ms 2048/2 4096 + 633 ~ 98.521 ms 2048/3 6144 + 633 ~ 141.188 ms After (Linux 4.17.14-zen1-1-zen with snd-usb-audio-lowlatency-dkms): 16/2 32 + 92 ~ 2.584 ms 16/3 48 + 103 ~ 3.146 ms 32/2 64 + 129 ~ 4.021 ms 32/3 96 + 129 ~ 4.688 ms 64/2 128 + 128 ~ 5.334 ms 64/3 192 + 128 ~ 6.667 ms 128/2 256 + 130 ~ 8.042 ms 128/3 384 + 130 ~ 10.708 ms 256/2 512 + 128 ~ 13.334 ms 256/3 768 + 121 ~ 18.521 ms 512/2 1024 + 130 ~ 24.042 ms 512/3 1536 + 124 ~ 34.584 ms 1024/2 2048 + 127 ~ 45.313 ms 1024/3 3072 + 127 ~ 66.646 ms 2048/2 4096 + 129 ~ 88.021 ms 2048/3 6144 + 129 ~ 130.688 ms Last edited by net147; 08-11-2018 at 07:23 AM. Reason: Add hardware interface name |
|
08-11-2018, 08:03 AM | #15 |
Human being with feelings
Join Date: Aug 2007
Location: Luxembourg/Spain
Posts: 1,922
|
Awesome! That's a really impressive latency reuction!
What was the problem/improvement? I have to try that out when I find some time (vacation).
__________________
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. :) |
Thread Tools | |
Display Modes | |
|
|