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

Reply
 
Thread Tools Display Modes
Old 10-03-2020, 07:09 AM   #1
HoppityHop
Human being with feelings
 
Join Date: Oct 2020
Posts: 6
Default Playback and recording cuts out

I'm having trouble with a Focusrite 4i4 3rd generation interface in Reaper 6. The sound cuts out after about 2min30 on playback, though the cursor continues; and recording also cuts out after a similar time (the time is not precisely the same on each occasion). This does not resolve if I wait, though it does resolve if I open the 'Audio device settings' page and click OK (without altering any setting).
The Focusrite works happily with other software (Audacity, VLC, Clementine etc); and Reaper works happily with my previous interface, an old PreSonus AudioBox USB.
I've checked other threads on this site, but can't find anything relevant.
My computer is running Linux Mint 20, Ryzen 5 2600 3.3GHz 6-core, MSI B450 Tomahawk motherboard, 8GB DDR4-3000 RAM, Samsung 860 Evo M2 SSD, ASRock Radeon RX570 graphics card.
Can anyone give a pointer to where I'm going wrong please?
HoppityHop is offline   Reply With Quote
Old 10-03-2020, 08:10 AM   #2
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 9,055
Default

First thing I'd try would be to increase the buffer size or add another period. I use 64 samples with 3 periods for my audio interface.

Also, you didn't say which one you use, but if you are using JACK try using ALSA instead which is fewer hoops for the audio to jump through.
__________________
Glennbo
Hear My Music - Click Me!!!
--
Glennbo is offline   Reply With Quote
Old 10-03-2020, 09:50 AM   #3
JamesPeters
Human being with feelings
 
Join Date: Aug 2011
Location: Near a big lake
Posts: 3,943
Default Linux settings for DAW use

I agree with Glen's recommendations, although I don't think that's the cause of this particular issue.

In Windows there are "power settings" to adjust and/or choose from a profile in the control panel, which should be done for DAW use. Linux generally doesn't have these things (although some distros have more control-panel-like things). A couple of the things you'd be doing by choosing the "high performance" power profile in Windows should also be done in Linux.

-For USB audio devices, you should check your "USB autosuspend" setting and probably just disable it entirely.

-For your "CPU frequency governor", you want that set to "performance" so that the CPU speed doesn't throttle down to a lower speed.

-For PCIe audio devices, you may also need to check your "PCIe ASPM" setting and change it to "performance".

I'm currently using Manjaro, so I can do all this using TLP (in particular I use the front-end TLP-UI which I had to add from the repo). You may have to change settings in some files, or use some other utilities, in other distros. You'll probably have to search for that information.

Other than those settings, I do the following:

-Install a lowlatency or realtime kernel, then reboot and choose that kernel from the GRUB menu. Along with this, depending on the distro, I may have to add a module for the Nvidia GPU that I'm using so that it's compatible with the realtime or lowlatency kernel. I install the proprietary Nvidia GPU driver (so that it performs better than Nouveau), and it's compatible with the "generic" kernel, but it seems to need a realtime "RT module" installed to work with lowlatency/realtime kernels. Ubuntu-based distros generally handle this for you when you install a lowlatency kernel from the repo, but Debian-based and Arch-based ones don't seem to (so don't be surprised if you boot to a GUI-less OS after switching to the lowlatency or realtime kernel, if you have an Nvidia GPU using the proprietary Nvidia driver and forget to add the "RT module" for it). I use the lowlatency or realtime kernels in the official repos, not a separate one (such as Liquorix, which seemed to increase my CPU usage and also lag behind official kernels in terms of its version number). Manjaro has a "realtime" kernel in the repo, and Ubuntu-based distros have a "lowlatency" kernel in the repo. They're both good.

(update: using Manjaro's default generic kernel as of kernel version 5.10 seems to perform as well as any lowlatency or realtime kernel for my tests at low latency while pushing the CPU to its limits. It shows as a "PREEMPT" kernel type. So I don't need to switch to a realtime kernel in Manjaro anymore.)

That's pretty much it. I don't have to do any of the other tweaks mentioned on any sites/forums to have Reaper running at low latency and high CPU (lots of plugins). It's solid. If you run external synths (not plugins) and want to connect things with Jack, you might have to change some more settings and check out other tweaks recommended on some Linux audio sites/forums. But for Reaper in general using plugins "inside Reaper" itself (and using ALSA for audio), you probably don't have to do anything else.

That USB autosuspend thing had caught me off guard. I have a 2i2 and it only seemed to work properly on one of my USB ports, otherwise giving me issues (lots of xruns, the DAW not responding after a few seconds, media players that stop working if you seek from one time to another). I think that one particular USB port was better at resuming from auto-suspend due to being the "DAC up" USB port (a port which has a separate power supply that you can adjust). I'd assumed that it was some USB port priority thing in Linux (and I didn't care to mess around with USB port priority settings in Linux) so I ignored it until when I installed Manjaro, because then even that "DAC up" port gave me problems with the 2i2. After changing that autosuspend setting, the 2i2 works properly (and is stable for DAW use) on any USB port.

One more odd thing I noticed in Manjaro: fstrim.timer wasn't set to automatically run. I'm used to seeing that in distros already enabled, but this time it wasn't. It was very easy to enable (and it persists through shutdown/restart) but that did surprise me a bit. "sudo systemctl enable fstrim.timer" gets it running. It's the TRIM command for SSD etc., so it should be running by default. A maintainer of Manjaro recently confirmed this bug is known, so it'll probably be resolved soon.

Last edited by JamesPeters; 04-05-2021 at 09:25 AM.
JamesPeters is offline   Reply With Quote
Old 10-03-2020, 10:40 AM   #4
Glennbo
Human being with feelings
 
Glennbo's Avatar
 
Join Date: Mar 2008
Location: Planet Earth
Posts: 9,055
Default

Quote:
Originally Posted by HoppityHop View Post
Reaper works happily with my previous interface, an old PreSonus AudioBox USB.
This is why I suggested trying a buffer size bump and/or an increase of periods. His old interface was working fine on the same machine.
__________________
Glennbo
Hear My Music - Click Me!!!
--
Glennbo is offline   Reply With Quote
Old 10-03-2020, 10:50 AM   #5
JamesPeters
Human being with feelings
 
Join Date: Aug 2011
Location: Near a big lake
Posts: 3,943
Default

It may depend on the device and/or USB port, how long it takes for them to "wake up".

It is definitely worth looking into what I mentioned. Would you, in Windows, let your USB ports go to sleep? Well, they're doing that in Linux...and apparently fairly aggressively at that.

Notice all the other tweaks people mention for RT performance aren't required for me? Maybe this has something to do with it. Start with the basics, what you'd do for a DAW on any OS.
JamesPeters is offline   Reply With Quote
Old 10-03-2020, 11:20 AM   #6
HoppityHop
Human being with feelings
 
Join Date: Oct 2020
Posts: 6
Default

Many thanks for your thoughts (I'm new to Reaper, and not clever with Linux either).
I am using ALSA, with 512 blocksize and 3 periods. My buffer size is the default 1200ms. Glennbo, when you say '64 samples' does this refer to the device blocksize, the buffer size, or something else?
My old interface used to create bad distortion when the computer came out of sleep — unplugging and re-plugging its USB would fix it (it's power light remained lit when the computer was in sleep mode). So I was initially pleased that the 4i4 did not do this — its power light goes out when the computer sleeps and the sound behaves normally.
I'll work through your suggestions. Thanks again.
HoppityHop is offline   Reply With Quote
Old 10-03-2020, 11:57 AM   #7
JamesPeters
Human being with feelings
 
Join Date: Aug 2011
Location: Near a big lake
Posts: 3,943
Default

I'm glad to help!

Glen is referring to the audio buffer blocksize (what you set as 512). I set mine to 64 as well, and 4 periods, for rock-solid performance even up to 90%+ CPU usage.

The 2i2 has a tendency to make a click sound through the audio outputs when changing sample rates. Because of this I set Pulse Audio (used for most audio applications in Linux) to resample everything to my preferred sample rate of 44.1 KHz (and I use Reaper at 44.1 KHz only anyway). You can do this by editing the file "/etc/pulse/daemon.conf" with root privileges. If you want to change this as well, here's what I did:

-uncomment the line:
default-sample-rate = 44100

-uncomment the line (after changing it to 44100):
alternate-sample-rate = 48000

-uncomment the line:
avoid-resampling = false

Then reboot.

By "uncomment" I mean remove the ";" at the start of the line (which indicates it's "just a comment" and not an instruction). So then it becomes an instruction to be followed.
JamesPeters is offline   Reply With Quote
Old 10-03-2020, 12:29 PM   #8
HoppityHop
Human being with feelings
 
Join Date: Oct 2020
Posts: 6
Default

Thanks for the clarification — a good guess that I needed it!
HoppityHop is offline   Reply With Quote
Old 10-03-2020, 12:37 PM   #9
JamesPeters
Human being with feelings
 
Join Date: Aug 2011
Location: Near a big lake
Posts: 3,943
Default

Lol no problem.

If you're new to Linux, a fair number of things will be confusing. You'll probably learn a lot of them soon enough. It's different from OSX and Windows enough in some ways that it can surprise you sometimes, since on the surface for day-to-day use it seems a lot like other OSes.

You'll notice a lot of recommendations for changing settings/configurations of things in Linux go sort of like this: open Terminal, use sudo (perhaps), then (instructions). I figure that's because various distros have different UI-based utilities for accomplishing tasks, and also different applications installed. And some distros don't even have some applications/utilities available to them in the repos (and/or might not have versions that work in them at all even if you download/build them yourself). So instructions for how I might prefer to change a setting in Ubuntu (with the utilities I'd use) might not work for you in Manjaro, unless you just use Terminal, since that's the "lowest common denominator" way of doing things. So that is something I found a bit frustrating, but I understood why after a while. Now I read the recommendations/instructions, figure out what all the steps are based on the syntax and package names (etc.), then decide how I want to go about doing those steps (usually I don't just use Terminal).
JamesPeters is offline   Reply With Quote
Old 10-05-2020, 03:21 PM   #10
HoppityHop
Human being with feelings
 
Join Date: Oct 2020
Posts: 6
Default

Thanks again. The overview of Terminal was most insightful (I don't mind Terminal at all, but it's usually just a copy&paste process).
In fact USB sockets seem to have solved my problem. I hadn't realised my motherboard has a choice of USB 2.0, USB 3.1 Gen 1, and USB 3.1 Gen 2 — and by plugging into a front socket I think I'd inadvertently selected USB 2.0. Moving to USB 3.1 has fixed my sound cutting out, and all is stable down to 16spls blocksize.
6 periods works better than 4 or 2. But I'm afraid I don't know what 'period' refers to (and an internet search hasn't turned up an explanation). Can you shed any further light?
I don't have a problem with any other software, so standardising to 44.1KHz may be unnecessary — though I really enjoyed tracking down the place to change it if I need to!
HoppityHop is offline   Reply With Quote
Old 10-09-2020, 03:27 PM   #11
JamesPeters
Human being with feelings
 
Join Date: Aug 2011
Location: Near a big lake
Posts: 3,943
Default

Period = block. So it's multiples of that blocksize. 6 x 16 = 96 samples total. It's not surprising that it works better with 6 periods of 16 samples (than 4 or 2 periods of 16 samples).

The thing that does surprise me: the fact you can even use 16 samples blocksize without problems. Try that same blocksize setting in a project that has any plugins running, and I suspect you'll need to increase the blocksize. 64 samples is a good starting point generally speaking if you want a stable system even with a large project (with 3 or more periods).
JamesPeters 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 09:24 AM.


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