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:

  1. 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.

  2. 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

  3. 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.

  4. Reboot after changing the group file

  5. Start up qjackctl:

    # qjackctl &

  6. Go to 'Setup' in qjackctl and set the latency low (see Setup screenshot below)

  7. Enable the log file (see Log_File screenshot below)

  8. 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)”

  9. You can also check htop and make sure you’re running at a realtime priority (see htop screenshot below)

Setup

Log_File

htop

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.

Previous
Previous

How to quickly, reliably and easily compare Altium symbol pinout with a part's datasheet pinout

Next
Next

Recompiling a minimal real-time kernel that works