The Penguin Makes Music

My fourth and final overview of open-source software for creative people involves music. In my youth I had many years of musical training, which until recently was going to waste. It’s not that I didn’t have the means – I own several electronic pianos – but I wasn’t motivated to play on a regular basis. Linux changed that, by making it easy to compose my own music, which makes things a lot more interesting.

Penguin_music

Linux has no shortage of musical tools available on-line. One thing that differs from the other areas I’ve discussed so far is that with music, one must use several tools in tandem. This is more in the spirit of the UNIX/Linux tradition of discrete components, rather than an all-in-one application such as “The Gimp” image editor or Libre-Office Suite. This allows for more flexibility but also makes things more complex. I’ll list the open-source tools I use for creating music, and you can be the judge.

* JACK

JACK (the JACK Audio Connection Kit) is a sound daemon (server) which provides the backbone of all music applications listed below. It’s like a virtual patch-board, allowing the interconnection of audio and MIDI (Musical Instrument Digital Interface) data between “JACK aware” applications. Unfortunately, not all programs are configured to use JACK, which is why it’s not yet the de facto Linux sound system. Because it takes control of your system’s audio, you will need to turn it off to play sound from your web browser, for example.

* QjackCtl

This is a graphical tool for controlling JACK without the use of typed commands. QjackCtl creates a list of audio devices, both hardware and software, that can be used as inputs and outputs. It lets the user define input and output connections between them, like a virtual patch bay. It’s not strictly necessary but makes JACK a lot easier to use.

* Fluidsynth

In order to create music on a computer, you either need to record sound from an external device, or to create sounds using a digital specification. “Sound Font 2” is a popular format for the latter; it’s been widely distributed on-line. Like JACK, Fluidsynth doesn’t have its own graphic interface. I found it interesting that Fluidsynth’s default sound fonts contain all the same instrument voices (piano, organ, guitar, trumpet, etc.) as the built-in selections on my Yamaha electronic keyboards. I’ve also found free sound fonts on-line which can produce other sounds such as percussion.

* Qsynth

This is a graphical front-end application for using Fluidsynth, much as QjackCtl is an interface for JACK. I haven’t used Qsynth extensively, except to select sound fonts (voices) for the MIDI sequencer application I’ll describe next.

* Rosegarden

This is the program I spend most of my time using. Rosegarden is a application for music composition and editing. It includes a MIDI sequencer, which can be used as an input to capture notes played on a MIDI instrument (such as my aforementioned Yamaha keyboards.) To do this, I invested in a bit of hardware, the E-mu Xmidi 1×1, a specialized cable which connects the twin round MIDI connectors on my instruments to a USB port on my computer. (I ordered one from Amazon.com for under $30.) If you’re new to this technology, I should note that a sequencer does not record sounds but notes (pitch, duration, attack, etc.) which can be mapped to any sound. This allowed me to make my piano sound like a guitar, ukelele, and an electric bass. As an alternative to Qsynth, you can install the Fluidsynth plugin, which allows you to map an instrument voice to a given track directly in Rosegarden.

Once your melodies and harmonies have been captured, you can edit them in several formats, including the standard sequencer matrix display and old-fashioned music notation. Having had classical training, the latter is my preferred method. This allows me to capture a melody on paper simply by playing it on the piano. Since I’m not very adept in improvisation, it really helps to have the music in front of me. Thus I can improve and embellish on that first performance, re-recording and re-printing it as many times as necessary.

Sadly, I had issues with bugs. In the Linux world, we install applications from the Internet using a command called “apt-get”; this fetches a version of the program created specifically for your current version of Linux. Because I use an older installation of Ubuntu (14.04) and don’t want to update until the next stable long-term Ubuntu is released next spring, I was “stuck” with Rosegarden 13.06. This worked fine for composing, but there were problems when exporting my musical tracks as sheet music. Therefore I downloaded and built a newer Rosegarden (15.12) from source code. It’s a task not for the faint hearted, but it fixed most of my problems.

* LilyPond

If you want to print out the musical scores you create in Rosegarden, the LilyPond program is the best way to do it. LilyPond is a music engraving program, which produces high-quality sheet music from the LilyPond-format (.ly extension) files you can export from Rosegarden. It’s a command line program which accepts a file called “somefile.ly” and converts it to “somefile.pdf” in Adobe Acrobat format, which allows it to be viewed onscreen or sent to a printer.

As I stated earlier, Rosegarden 13 had a bug in producing the lilypond “ly” input files. This caused the Lilypond program to become “confused” about how music was to be broken up into measures, to the point that it would sometimes make a line of music run right off the page! I was able to edit the “ly” files in a text editor to fix these issues, but that was a time-consuming annoyance that made it well worth upgrading to Rosegarden 15.

* JACK Timemachine

If you want to convert your new music into an MP3 file that can be played on your phone or iPod, there are a few more missing pieces. Rosegarden lets you play your music files over your computer’s speakers, but to hear it on another device, you need a “recorder” application such as JACK Timemachine. When you launch this program it appears as a device in the configuration list of Qjackctl. You connect the output of Rosegarden to the input of JACK Timemachine, and then play and record your piece, which is saved as an audio file in 64-bit WAV (w64) format.

* Sox and LAME

Bear with me; we’re on the home stretch. The aforementioned JACK Timemachine is a very simple program that only records music in one format. To change it into a more usable file, you need a music converter such as Sox (Sound Exchange) the “Swiss Army knife” of audio file conversion. Sox is a command-line tool that allows you to convert the w64 files into more playable formats such as WAV and OGG. Unfortunately the popular MP3 file format is patented and technically requires royalties to be paid; therefore Sox (being free of charge) does not include the MP3 plug-in. For do that you must recompile the Sox program from source with an MP3 plugin (requires a fair bit of computer expertise) or better yet, install the “LAME” MP3 encoder to do that last conversion. Why Sox can’t include this function, and yet it can be in LAME as a separate program, I have no idea. Leave that one to the lawyers.

I apologize for this long post and hope it hasn’t been too intimidating. If open-source music tools are complicated, they make up for it in their flexibility and power. Best of all, they’re free, with plenty of help available online. Remember, most of these open-source programs are also available for Windows and Mac. Happy composing!