How to run audio through linux with about 3 milliseconds latency end-to-end using real time linux
We are succesdsfully running audio from analog->USB Soundcard->CPU-> USB Soundcard->analog in under 3 milliseconds. For Linux, this is quite a feat. Here's how to do it:
Firstly, run a PREEMPT_RT (real-time) linux kernel. Look back at this post if you want to just grab the one that works for us.
Check that you're actually running the kernel:
# uname -a
# Linux bat 4.18.16-rt9se+ #14 SMP PREEMPT RT Wed Jan 9 11:13:30 PST 2019 x86_64 x86_64 x86_64 GNU/Linux
Make sure that your username is in the audio group. (This works for ubuntu). That is, put your username on the 'audio' line of /etc/group. Look here for more info.
Reboot after changing the group file
Start up qjackctl:
# qjackctl &
Go to 'Setup' in qjackctl and set the latency low (see Setup screenshot below)
Enable the log file (see Log_File screenshot below)
Click OK, then click "Start" This will start jackd. check the qjackctl.log file and ensure that it does NOT say:
“cannot use real-time scheduling (FIFO at priority 10) ... (1: Operation not permitted)”
You can also check htop and make sure you’re running at a realtime priority (see htop screenshot below)
And... that should pretty much get you up and running with low latency and with few to no xruns. Any questions... be sure to leave a comment or shoot us an email.