Making music with M-Audio on Linux

M-Audio has supplied hardware and software to computer-based musicians for 20 years. Its new "make-music-now" line of products, aimed at musicians just getting into computers or PC users with an interest in music, includes a microphone, speakers, drum machine, and DJ mixer deck. Unfortunately, its bundled software, called Session, is for Windows only. Our challenge was to try out this hardware -- specifically the KeyStudio MIDI keyboard and Fast Track audio interface -- with Linux applications. We were half successful.

The KeyStudio keyboard is well made, with 49 full-size, touch-sensitive keys. The action feels a little light, but the 'touch' is OK and you soon adjust to playing forte or pianissimo. Like Fast Track, it is USB-powered. There are Pitch Bend and Modulation wheels on the keyboard to tweak the sound as you play, and Octave buttons for when you want to emulate a piccolo or double bass.

The keyboard has no built-in sound capabilities of its own; it is intended to be used with the Session software, which has a good collection of MIDI samples and effects and outputs via Fast Track, or with M-Audio's Micro USB Audio Interface, which is supplied with Session. Our plan was to try it with LMMS, Rosegarden, Timidity, and any other Linux MIDI and audio software we find.

Whether you have basic on-board sound or a surround sound card for gaming, inputs are usually limited to line-in and microphone jacks. These are adequate for VoIP phone calls or recording from tape/record decks, but not much else. They are certainly not compatible with electric guitar jacks or XLR plugs for stage mics. According to M-Audio, the Fast Track USB interface is 'ideal for recording guitar and vocals,' but it could also be used to record any line level sound source, as long as you have the correct cable.

The design is nice and simple; the front panel has three knobs, one controlling the mic input level, another controlling the input/playback mix ratio, and the third controlling the main output level (this only affects the headphone and the RCA output volume). It also sports signal and peak indicator LEDs, 1/8-inch stereo headphone output, and a stereo/mono monitoring selection button.

The rear panel of the unit consists of a balanced XLR input socket, a quarter-inch jack line/instrument input, input level switch button (line/guitar), stereo RCA outputs, USB connection socket and also a Kensington lock connector. There's no power supply needed; Fast Track takes its power from the USB port. A possible 'gotcha' is that Fast Track replaces your sound card or on-board sound system, so you need to plug a couple of speakers into the interface.

ALSA and ASIO

Typical PC sound systems are created for playback, with inputs a poor second-level task they can just about cope with. In a Microsoft Direct Sound system the signal is transferred from the sound card via PCI to the CPU and back, and during the trip it may have to queue up while the CPU does other stuff for Windows. To avoid such latency Steinberg (of Cubase fame) developed the ASIO (Audio Stream Input/Output) protocol, which allows the audio interface to connect directly with the PC hardware, reducing latency.

Under Linux we have a similar latency problem with ALSA (Advanced Linux Sound System), but there is no Linux implementation of ASIO. There are hacks involving compiling some Wine code with Steinberg drivers, but instead we turned to LMMS, the real-time kernel JACK, and Ubuntu Studio.

KeyStudio and LMMS

Though work on LMMS (Linux MultiMedia Studio) began in 2003, the project is still in its infancy. We did our testing under KDE in Kubuntu 7.10, and the version supplied by the Ubuntu repositories is 0.3.0, and it is a bit unstable but usable. LMMS is a MIDI editor with built-in recording and playback which works with 'dumb' keyboards like this one with no sound system of their own, or with hardware synths.

When you install LMMS, plug in the KeyStudio keyboard, and run LMMS, the software automatically detects the keyboard. To get started, click the Samples tab and open the instruments folder. Double-click the instrument of your choice to open it in the Beat+Baseline Editor. Click the keyboard icon, select MIDI Input, and select your keyboard. Repeat the process for MIDI output and select your sound card. Now you're ready to start playing. To record, double-click on the track in Beat+Baseline editor to bring up a Piano Roll editor with a Record Button.

LMMS comes with a decent supply of virtual instruments and some beat and bass loops. It somehow manages to avoid latency problems, and it just works. However, it cannot save a MIDI file to send to a real muso to arrange properly, and it can't create a traditional score upon which you can enter the lyrics. However, Rosegarden with LilyPond can.

KeyStudio and Rosegarden

Rosegarden is, like LMMS, primarily a MIDI editor, but unlike LMMS it is aimed at professional users and follows the normal Linux practice of linking to existing applications rather than being a standalone application. Rosegarden can link to various software synths, effects, drum simulators, and audio applications via JACK (Jack Audio Connection Kit), a software version of the cat's cradle of cables you see in real studios. Rosegarden can also link to LilyPond, which is a conventional musical notation editor that lets you print 'real music.'

However, these applications don't work well under Kubuntu. Start Rosegarden and it will tell you the JACK server isn't running and you don't have a low-latency kernel. JACK can link every bit of audio or MIDI software and hardware with ever other bit, but it won't play nice with aRts the KDE sound system; run JACK and aRts dies, so you get no audio output.

To continue, we installed Ubuntu Studio, which is a distro in its own right, but you can also install it as a meta package from a conventional Ubuntu or Kubuntu installation. As a distro it comes with a patched kernel Linux-RT (Real Time) which gives priority to media work and reduces latency. If you install Studio from normal (K)Ubuntu, install the RT kernel first. Reboot and press Escape to enter the GRUB boot menu, and choose the RT kernel. If the system loads correctly, you can install Studio.

Rosegarden is less intuitive than LMMS, but ultimately more versatile. Once you've discovered all the settings in JACK needed to make it work, then it works well with the KeyStudio keyboard. We also tested the KeyStudio with ZynAddSubFX, a virtual synth included in the Ubuntu Studio distribution. The setup configuration was simple -- just a case of creating a connection between the MIDI out device of the KeyStudio and the MIDI in device of the ZynAddSubFX using the Connection window in the MIDI settings section of JACK. Thus the MIDI from the keyboard is sent to Rosegarden, Rosegarden outputs to ZynAddSubFX, and in the Audio lists you connect ZynAddSubFX to the sound card. Performance was good, with no apparent delay in hearing a sound after striking a key.

Ubuntu Studio, JACK, and Fast Track

Buoyed by our success with the KeyStudio, we set up Fast Track USB, but this time we didn't get far. The unit's power LED lights up when plugged in, and the unit is correctly recognized by JACK and listed as Fast Track in the interface list. A problem with any audio recording on a computer is that the PC's other activities can interrupt the smooth flow of data, resulting in pops and pauses. On Linux systems these are known as Xruns, and JACK will let you know if you are suffering from them. Fast Track didn't cause any, which is good, but we were not able to record any audio in Audacity, Rosegarden, or Ardour. Out of the three, Audacity was the only one that gave any indication that something was wrong, telling us to check our interface settings whenever we attempted recording. Rosegarden and Ardour didn't throw up any errors at all, they just failed to capture or transmit any audio to or from the Fast Track.

There is an open source driver for M-Audio USB interfaces, but unsurprisingly it hasn't been updated for the recently released Fast Track yet. Until it is, it doesn't look like we'll be using Fast Track on Linux.

However, KeyStudio's support under Linux is a triumph for open standards. The keyboard uses MIDI and works with MIDI software on any platform, much as you'd expect. Fast Track uses Steinberg's ASIO, and doesn't.