Wednesday, January 19, 2011

Making music in Linux and beyond

By Anders Bylund | Ars Technica


You can do a lot with free open-source software, also known as FOSS. Musicians with a yen for Linux are in luck; the array of choices for creating, editing, producing, and publishing music using nothing but FOSS software is staggering.


One way to get your hands on a plethora of audio tools is to run the Ubuntu Studio distro, which comes preconfigured for real-time audio processing and includes every studio tool under the sun. Failing that, there are the ubuntustudio-audio and ubuntustudio-audio-plugins virtual packages in Ubuntu, which will install 54 and 18 specialized packages, respectively. Other alternatives include the Musix distribution and the low-end hardware distro dyne:bolic, but Ubuntu Studio has the largest toolkit in the genre and enjoys the widest support as well.


Pick your favorite multimedia distro and go nuts, or just install the applications you want to try out, one RPM or DEB package at a time.


To cover it all in useful detail would take a book, so we'll spare you most of the gory details. Instead, this article will focus on a few of the leading suites used to actually make music—multi-track MIDI sequencers with the ability to add live audio tracks such as guitar strums and voice.


You still don't know JACK


Having a lot of tools available lets you work in the grand tradition of Unix-like operating systems, chaining specialized programs together to perform complicated tasks. The pipe operator in the audio world is the JACK audio server, which lets you route inputs and outputs of myriad different flavors to whatever JACK-enabled tool you like. For example, you can use JACK to route MIDI inputs to a software synthesizer, then a flangers and a compression effect, and then on to your sequencer suite of choice. From there, you'd then pipe the finished song to a separate mixer program and an output tool to write the song to disk in your favorite audio file format. And all of this is accomplished in real time, without adding ugly latency anywhere in the process chain. That's the magic of JACK.


Don't be scared; most of these connections happened automatically
On the downside, JACK can be a beast to configure just right. It has to play well together with the underlying ALSA audio mechanism, and there is definitely a learning curve to routing your tool chains effectively. But every major music tool for Linux works with JACK, and many outright depend on it and refuse to run any other way. It's a mixed blessing, but a necessary tool at your belt.


To get a MIDI workstation running properly, you need a few things:
  • A low-latency kernel, also known as preemptive or real-time kernels. The old preemptive patches have long ben a part of the standard kernel distribution, so this is mostly a historical note unless you're running really old versions of Linux
  • Real-time priority permissions for audio applications, as explained by the Rosegarden team
  • Properly configured ALSA settings with JACK ports
  • JACK set to real-time operation and started before you fire up any of your sequencers, soft synths, or effects. The routing between these things can be done by hand, but is often handled automatically by the startup scripts of your applications
  • Either an external bank of MIDI instruments, connected via USB MIDI controllers, or the TiMidity software MIDI handler. TiMidity is a great piece of software, but be warned that it sometimes decides to eat all available processor time which is a performance-killing problem when the process has real-time execution rights
  • A MIDI keyboard isn't exactly required if you're planning to enter notes by hand or if you prefer virtual keyboards. However, most musicians probably prefer performing their parts over the more mechanical note-by-note entry method. We're not judging, though.
The purpose of introducing JACK and real-time operations is to make your audio subsystem more responsive. You want to hear a note exactly when you press the B-flat key, not some unspecified interval later. Glitches can be repaired after the fact through quantization and manual tinkering, but then you lose some of the natural imperfections that make a performance feel real—and you never even get a chance to do these things if you're using your audio workstation to perform live. Latency is a musician's worst enemy, in other words.


The JACK project keeps a list of JACK-aware applications where you can dive in to find the tools you're looking for. However, even that list is incomplete as the very JACK-friendly LMMS sequencer isn't included, and I'm sure there are other omissions. Ubuntu Studio probably has you covered either way.


Working with Ardour and Audacity


I'm not talking about a studio attitude, but about two of the finest tools in your toolbox.


Ars ran a roundup of FOSS audio editors five years ago, wherein most of the focus was placed on Ardour and Audacity. Those are still the two leading editor and multitracker packages in the game, so not much has changed.


Except, of course, that everything has changed.


Audacity still can't play or edit MIDI files, but it has removed one of the biggest knocks against it by adding JACK support. ALSA is still the default audio transport mode when you fire Audacity up, but JACK is available as an option and works very well. It's still the most user-friendly audio editor you're likely to find with full support for a plethora of sound file formats that Ardour can't handle. And the interface is as easy to use as ever—anecdotal evidence comes from a non-geek friend of mine whom I was able to guide through creating a theatrical sound effect he needed (a ship falling off the edge of the world), from downloading Audacity for the first time to a finished and usable effect, in less than 45 minutes. That was a remote assist via instant messaging.


Ardour is also chugging along, now available for Linux and Mac OS X workstations. The interface has been somewhat refined since 2005, but should still look and feel very familiar to anyone who has ever used ProTools. The big feature upcoming in version 3.0 is MIDI editing, making a full-featured workstation out of Ardour rather than a specialized multitrack mixer and wave editor.


And when SpicyMcHaggis signed off on his Ardour review in 2005, his major concern was that Ardour's professional focus requires serious market share in order to make any sense. Well, I don't know how large the total addressable market is for this type of armor-clad audio tool, but the project is trumpeting 284 paying subscribers and a healthy amount of monthly donations. The cause is alive and well.


But I'm not here to fill volumes about Audacity and Ardour. Instead, today's focus is on MIDI sequencers and the toolkits that surround them. What can I say—I'm a one-man band with a keyboard and a MIDI cable, so every musical problem looks like a MIDI events roll to me.


We love acronyms: LMMS


For many of us music hobbyists (and a fair number of more professional musicians), it's just not feasible to create songs with a full set of live instruments. But an impressive set of sounds can be generated in digital form and controlled as MIDI streams, which makes MIDI sequencers fundamental to one-man bands with ambitions beyond a ukulele by the campfire.


Linux MultiMedia Studio, or LMMS, is a comprehensive MIDI sequencer with some audio recording features, all rolled into an impressively complete user interface with tons of effects. JACK is supported, but by no means required, as LMMS also supports input/output directly through ALSA or OSS, or even the user-friendly but laggy PulseAudio framework. This is perhaps the simplest MIDI tool available to Linux users, and will remind you of Apple's GarageBand or FL Studio (formerly known as FruityLoops) to some degree.


This is by no means a complete replacement for proprietary suites such as Avid ProTools or Cakewalk Sonar, but it's a great way to get your digital feet wet. LMMS takes MIDI input from a properly connected keyboard or software keyboards like the vkeybd or vmpk Ubuntu packages. There's a handy piano roll editor for adjusting your keyboard tracks or for creating entire melodies from scratch, but no MIDI events editor or score notation input method. The addition of a drum and bassline module makes it a snap to set up a basic groove over which your melodies and recorded lyrics can soar. If you've been around the computerized music block for a while, the drum'n'bass tool brings back memories of good old SoundTracker—only infinitely more sophisticated.


In spite of its obviously Linux-focused name, LMMS is also available for Windows and Mac OS X. The Mac version is better off with the JackOSX audio interface, but the Windows version just relies on DirectSound instead. Yes, Jack exists for Windows too, but LMMS support for it on that platform is buggy and underdeveloped.


The key to making music in LMMS is to get a handle on automation. Wherever you see an adjustable value, you can probably automate how it changes across the song. For instance, right-click on the TEMPO/BPM controller and you'll be greeted with the ubiquitous "Edit song-global automation" option. Draw your tempo changes in a simplistic graphical interface, and there's your super-granular tempo change chart. The same thing works for volume controls, distortion effects, left/right pans, or the very waveform of your synth. If you see a control, you can probably automate it.


I'm gating my flanger here, yo! Click for full size.
The documentation for LMMS is pleasantly complete on a feature-by-feature basis, but the tutorials leave a lot to be desired. The best way to get acquainted with this starter kit is to roll up your sleeves and dig in on your own.


Thanks to the drum and bass editor and modular approach to song structures, LMMS lends itself to techno and trance music with ease, particularly if you create separate tracks for each instrument rather than complete rhythm sections in a single track. That way, you can add or pause individual instruments on a bar-by-bar basis, as well as apply phase shifters and flangers with precision. Armin van Buuren and Tiesto, eat your hearts out!


I never promised you a Rosegarden


If LMMS is the starter package for MIDI musicians on Linux, then Rosegarden is the fully functional, flying Batmobile. However, this package needs some tinkering under the hood with JACK routing in order to really shine, and is better suited for more experienced musical tinkerers.


This is the tool for you if you're comfortable reading and writing sheet music. Of course Rosegarden lets you play a MIDI instrument to input your notes, but you can also edit a traditional staff by hand or import existing MIDI files as a starting point. Editing modes include the piano roll you saw in LMMS, but also a MIDI events editor and the default notation editor. Rosegarden also has a percussion matrix for handling drum parts.


The hard part comes later. Click for full size.
Unlike LMMS, Rosegarden's tutorials are extremely extensive and are likely to answer just about any question you might have about working with the program. The user interface is also more intuitive than that of LMMS, assuming that you know your tenor clefs from your semiquavers. Given the reliance on standard musical notation, this program will make sense if you're transcribing sheet music into playable MIDI files, or if you're a classically trained musician.


Drum loops and the like can be produced, but not by Rosegarden itself. Instead, you're directed to external programs like the Hydrogen drum sequencer for this kind of task, or to ZynAddSubFX for polyphonic synth action if the available MIDI instruments don't tickle your fancy. For editing a rendered audio track, Rosegarden relies on Audacity by default but can also be configured to use Ardour or any other properly designed audio editor.


This is a fine example of how chaining various programs together can achieve astonishing effects with some elbow grease and know-how, and it's also one reason why this program doesn't play well with Mac or Windows systems. The expected array of helper programs just isn't available on those platforms.


Since Rosegarden was designed with score notation firmly in mind, the program seems a natural fit for composing orchestral or classical tunes where such notation is commonplace. There are a few built-in effects plugins, but more advanced effects will generally have to be handled by routing Rosegarden's instruments through other programs by way of JACK. Also, you have full control over every attribute of every note through the MIDI events editor, but automating changes over time can become a time-consuming exercise in pedantry here. Hence, more avant-garde musicians may prefer other toolkits like LMMS.


There are other sequencers in my life


It doesn't end there. In case neither LMMS nor Rosegarden float your boat, MusE falls in-between the two in terms of sophistication and ease of use. While Ardour is expanding to cover MIDI sequencing, MusE simplified things by splitting its notation-based input off into the MuseScore package. Seq24 is an ultra-simple sequencer, designed mostly for live performances. Development of Seq24 recently resumed after a two-year hiatus, breathing new life into the project. As you can see, the music side of Linux is a living, breathing thing.


For an imperfect measure of popularity, try searching the "Music Made With Linux" repository for tools names. Rosegarden yields 49 results today while LMMS and MusE hover around the 10-results mark and Seq24 hardly shows up at all. Running searches to "toolname linux song" on YouTube yields radically different results as LMMS wipes the floor with the competition. It seems like LMMS wins the popular vote in mass-market fora, perhaps because of its similarities to popular tools on Windows and Mac systems.


The audio editing powerhouse that is Ardour is expected to get MIDI editing features in version 3, which always seems to be right around the corner. And I'm still barely scratching the surface of the available tools—see the Ubuntu Studio and JACK listings above for further options.


Extracurricular activity


I can't leave you without shining a spotlight on some of the most useful and impressive tools in the Linux-based audio toolchain that aren't part of one of the big packages.


The guitar heroes out there may never buy an effects pedal again once they get a load of the multi-effects board known as Rakarrak. A picture truly says a thousand words in this case:


Feel the power! Click for full size.
JAMin is the mixing tool that allows Ardour to be a quality application without a built-in mastering board. As part of the JACK toolkit, this is the finishing tool of choice pretty much regardless of your favorite editor or sequencer.


Maybe you don't like the drum and bass patterns in LMMS and want a more complete drum machine. Hydrogen is the tool for you, and yes, you can link those beats into tracks of other applications thanks to the JACK switchboard. It's a beautiful thing.


I've seen professional DJs in the wild, beat-matching tracks on their Mixxx DJ boards. It's not two turntables and a microphone, but about as close as you can get in the digital world. This is a little bit outside the realm of creating music, but hey, you gotta present your freshly minted tunes in their best light!


Finally, if the standard rack of MIDI sounds isn't enough for you and you can't find the sounds you want in your application's built-in synthesizer plugins, there's always ZynAddSubFX. It's an infinitely customizable synthesizer that comes preloaded with hundreds of brilliant presets. If you can't find, create, or modify your way to the instrument you want here, you're probably on the wrong planet.


And if you can't imagine loading and saving your projects and configurations in a thousand different programs by hand, then you need to look at the Lash audio session manager. It isn't perfect and development is sporadic, but the tool is still very handy for complicated projects. This one could use a hand if you have one to spare.


Thanks to the inter-linking power of JACK and the efforts of the open source army of audio enthusiasts, Linux-friendly musicians have an embarrassment of riches at their disposal. The fact that some of the tools are venturing into more mainstream operating systems can only raise the profile and widespread acceptance of these tools, but you still don't get the full power out of them unless you're able to link all the pieces together. If you've never tried Audacity or LMMS and are afraid of penguin-powered change, go ahead and try out their Windows or Mac versions. Just don't be surprised if that experience then leads you down a more involved road, to the point of installing Ubuntu Studio for your musical needs.

No comments:

Post a Comment