Sunday 16 May 2021

Linux Audio: ALSA & PulseAudio - My First Linux Headache

I have been using Linux full time for about 9 months and it has been both a breath of fresh air and a steep learning curve. I had a basic knowledge of Linux, enough to get me by and enough to know I wanted to use it full time.

After using Linux Mint without any major dramas, this week I hit my first stumbling block. It was enough to make me question briefly if I had made the right choice. Being an Apple user for over 20 years I knew their hardware and operating systems inside out and being a relatively newbie to Linux I am still finding my feet and occasionally feel out of my depth.

I was trying my hand at music production using Reaper – a digital audio workstation - and purchased a USB MIDI keyboard (my second actually) and struggled to get the two to work properly.

Playing the keyboard it was hit and miss if the sound came out all the time. Rapidly pressing the same note it wouldn’t always play. Like I said I bought a keyboard prior to this – an Akai LPK25 – which suffered the same problem as this Korg NanoKey2.

After a process of elimination, I realised it wasn’t my rather aged hardware or my on-board sound, nor were either keyboard at fault. The problem lies with Linux itself and the way it handles audio. After some rather heavy reading on how audio works in Linux, it came down to a problem with PulseAudio.

Linux uses ALSA – Advanced Linux Sound Architecture - as a base for audio. It is built in to the kernel, but to use it within a desktop environment you use an additional layer called PulseAudio. It is this additional layer that causes audio delays. 

Latency is a big problem with Linux audio and eliminating this can be awkward. You can use a low latency kernel – although this didn’t make any difference for me - or even a real time kernel - but that requires a specific distro.

JACK is another option, but getting JACK to work can be tricky and a bit hit and miss. I couldn’t get JACK to work with ALSA, but JACK with PulseAudio didn’t solve my skipping audio issue.

I finally got ALSA working on its own and tweaking the settings in Reaper (the Periods and RT Priority) overcame my missing note problem. 

I am not going to say it is 100% perfect, but it certainly perfectly useable. I am sure further tweaks could improve my situation and even the possibilities of killing PulseAudio temporarily to free up more resources.

This is my first real problem with Linux. It pains me to say this, but it doesn’t happen in Windows and if your audio drivers do cause this issue you can install ASIO easily to overcome it. Mac has Core Audio which doesn’t suffer from latency issues either.

You can install ASIO via Wine in Linux, but I didn’t want to go down this route as that can cause more issues to resolve.

For me ALSA is working at present and that is good enough for me. It has been a huge learning curve and quite a stressful experience, but I am all the wiser now.

Written by Simon Royal. Follow me at

No comments: