Fedora Linux as a DAW pt1
I recently acquired an Alesis iO2 Portable, 2-channel USB audio interface for hooking up my MIDI keyboard to a soft synth. I had been using my onboard sound card but was finding that latency was unacceptably high.
Linux is a rather unique beast when it comes to audio (as with many things) and to the uninitiated can be quite a bewildering experience. Choosing Linux as the basis of a DAW is a bit of tradeoff. Compared with Windows, Linux is a higher performance, more stable platform for audio. Compared with Mac it’s a cheaper platform (you’re not paying for Mac hardware!). On the downside is a steeper learning curve that comes with the Linux environment - you have to get your hands dirty with Linux, there’s just no 2 ways about it.
ALSA
ALSA sits on top of Linux and is the interface that all other software interacts with the sound hardware. There is no configuration to be done here.
Jack + Pulseaudio
This where things can start to get a bit confusing. You’ll often have both of these on the same system and both seemingly doing a similar job. Why?
If you just want to run a desktop, play some MP3s etc then Pulseaudio is fine. When you need to do some heavy lifting, Jack comes in offering higher performance and much more fine-grained control over how the audio is routed.
Both can co-exist together, however both cannot use the same sound card simultaneously. Unfortunately, you won’t get a helpful message popping up to tell you there is a conflict (as you might with Windows) - you just won’t get any sound out of one, or both!
For me, I just keep Pulseaudio using my onboard sound card and Jack using the io2. Seems to work quite well.
a2jmidid
That’s ALSA to Jack MIDI daemon. The hardware presents it’s MIDI interface to ALSA but you need a way to get that over to Jack. Apparently Jack can’t do this itself, so that’s where a2jmidid comes in.
Fluidsynth + Qsynth
Fluidsynth is the soft synth and Qsynth is it’s frontend. These come with a General MIDI library of SF2 sounds. The piano sound isn’t too bad.
Setup
Fortunately the iO2 shares the same class driver as many other similar USB audio interfaces which means no drivers need to be installed. You simply plug it in and you’re ready to go. Performing a lsusb
at the command prompt gave me a list of connected USB devices, including the iO2 - simply named Alesis
Jack
- Install Jack and it’s GUI tool qjackctl (and their dependencies):
yum install jack-audio-connection-kit qjackctl
-
Add your user to the
jackusers
groupsudo usermod -a -G jackuser <username>
-
Fire up
qjackctl
- either from the command line or click the icon that should have been created in Gnome.
- Click Setup
The following screenshot shows the areas I had to modify highlighted in red:
The Server Prefix of pasuspender -- jackd
suspends Pulseaudio while Jack is running.
Frame/Period: contributes to the overall buffer size. A smaller value typically translates to lower latency. Setting this too low can result in pops and crackles in the audio, so some experimentation may be required.
Sample Rate: is self-explanatory. It defaulted to 48000
but 44100
is fine for me
Interface: it’s best to select your sound card explicitly rather than going with an auto detect option.
The following config starts and stops a2jmidid
when qjackctl
starts and stops.
Qsynth
- Install Fluidsynth and it’s GUI tool qsynth (and their dependencies):
yum install fluidsynth qsynth
-
Fire up qsynth
-
In Setup select
jack
as the MIDI driver
Connecting it up
- Back in Jack, click on Connect
- Make sure your connections look something like: This shows Qsynth’s audio output going to the system’s main input And the iO2’s MIDI input going to Qsynth
Latency
For playing piano/synth realtime with acceptable latency, I found that I needed to reduce Jack’s buffer size to 64 frames. Unfortunately, with a stock Linux kernel this low setting resulted in lots of pops and crackles in the audio due to buffer overuns. After installing a realtime kernel from Planet CCRMA I found this improved dramatically.