Of Macros And Drum Machines

by Dave Phillips

This week in my random survey of activity on the mail-lists for Linux sound & music software I'll look at two very different software drum machines and a keystroke macro that enters LilyPond music notation into an Open Office text document. And if that isn't enough I've included four thrilling screenshots and links to three entertaining audio files to entice and maintain your interest. Read on for more...


Traffic on the LilyPond mail-list is always interesting to me. LilyPond's flexibility inspires its users to demand much from the program, so there's a lot of code on display for inspection and correction via the list. I have a good basic understanding of LilyPond, and I can usually find a how-to in the program documentation, but I've run into a few thorny notation problems not addressed by the docs. I asked on the list, received some smart solutions, all problems solved.

Recently I discovered a solution I didn't realize I was searching for, Sam Hartmann's OOoLilyPond macro for OpenOffice.org.

Figure 1: OOoLilyPond

As a teacher I have many uses for Open Office (and my Linux-friendly Deskjet 6540 printer). I format and print lyrics and lead sheets, blank staff and tablature paper, performance announcements and set lists, and of course LilyPond-created scores. Program and printer both get a good workout in a typical week here at Studio Dave.

I don't use method books with my students. I prefer to compose exercises and other study materials for the individual student, resulting in a lot of "custom-made" paper-work. Some students have asked for lesson materials in more permanent form, and some have suggested that I write an instructional guide. I've considered using Open Office for such purposes, but I've been discouraged by what appeared to be a cumbersome process of creating and importing the necessary images. LilyPond's lilypond-book utility provides a mechanism for integrating text and music notation, but the process is indirect and requires input in LaTeX, Texinfo, or HTML.

Thanks to the OOoLilyPond macro my discouragement has evaporated. OOoLilyPond provides a simple interface for inserting LilyPond-formatted music notation directly into an Open Office text document. Figure 1 illustrates the how and its resulting what. I invoke the macro, the OOoLilyPond dialog panel opens, I enter my LilyPond notation code. I click on the LilyPond button (not seen in Figure 1), and the rendered notation is entered into the document at the cursor location. Sweet, and I am euphoric with joy.

The macro had trouble with large complex chunks of code, but I would use the lilypond-book utility for those examples anyway. However, for quick work and brief passages OOoLilyPond is the perfect tool.

My tests were run with Open Office 2.0.4 and LilyPond 2.8.6, your mileage may vary with other versions (LilyPond 2.8.4 did not work for me, probably due to template differences). See the OOoLilyPond Web site for details regarding download, installation, and configuration.


Linux Audio Announce is the official mail-list for declaring the arrival of new programs, the maintenance of old ones, and any other relevant newsworthy items such as awards and honors given and received in the world of Linux sound and music software. Among the announcements for new applications I've found some gems I'd like to share with my readers. In this entry we'll look at two drum machines/rhythm programmers, Ollie Glass's Breakage and Stephen Cameron's Gneutronica.


Figure 2: Breakage v20

Designers of software drum machines often venture into the domains of random and chance occurrence in an attempt to loosen the mechanical output of their programs. The drum machines themselves can't help it, they'll play with absolute rigidity and never vary from the beat. Alas, that's not how a human musician plays, so programmers have looked for and discovered ways to disturb the machine's rigid timing, along with ways to affect accents and pitch, to make the machine's output sound more like a human drummer. For example, Hydrogen includes "humanization" controls for setting amounts of swing rhythmic distortion, accent variation, and timing offset. Judicious adjustments of these and similar controls can make your percussion tracks come alive.

Breakage resembles a typical software drum machine with step-sequencer/pattern editor, samples browser/loader, and the expected transport controls. The Swing control in the sequencer panel adds a measure of humanization, but Breakage goes much further than that, adding controls for pattern morphing and a neural network accompaniment trainer, control types definitely not found in typical drum machines. Before seeing and hearing those additions in action we must consider some setup and configuration requirements.

Breakage is a Java-based application. I ran version v20 under Sun's JDK 1.5.4 and 1.6.0 with excellent results. Breakage's audio realization depends on ChucK, a "strongly-timed, concurrent, and on-the-fly audio programming language". I'll profile ChucK in a future article, but for now you'll have to be content with its Web link and the knowledge that it provides the audio engine for Breakage. If you're running Linux you'll also need up-to-date installations of ALSA and JACK, and with these necessary parts in place you're ready to start the program.

Breakage opens with a single window displaying all the program's parts and functions. The pattern editor will be running its loop for the four default percussion instruments (bass drum, snare, open and closed hi-hat). Add and delete beats in the pattern editor grid with single mouse clicks, adjust tempo and pitch in the Sequencer panel, all in realtime. Name your pattern, then save it to the Patterns database (to reload or delete any pattern).

Neat interface amenities: Load a pattern from the database, then select (but don't load) another pattern. The pattern grid will display unfilled red circles that represent the target beats of the selected (but not yet loaded) pattern. When you load the selected pattern the circles will fill. For a more active display use the Morph tool. Use the default settings to fade from the current pattern to one selected in the Morph drop-down list. Over the play of four pattern lengths the target circles will fill in gradually while the source pattern events fade away (Figure 2). A cool and musical feature, not mere eye-candy.

If you know nothing about neural networks, have no fear. Just follow the exercise suggested in the Introduction to Breakage's documentation or work through the Tutorial example. It took me a while to figure out how to use the neural network in conjunction with my patterns (well, I like to think I figured it out), but the results were worth the effort. I ran the trainer at its default parameter values, then I opened an empty pattern and started writing kick and snare drum parts (in realtime of course). Breakage responded to each edit by adding a new hi-hat part. The combined parts sounded good, due in large part to Breakage's musically sensible use of accents and volume change.

I've uploaded two examples of Breakage in action. Breakage - NN demonstrates the effect described in the previous paragraph, training a neural network to improvise a hi-hat part. Breakage - Morph shows off the morphing effect. Two measures of a starting pattern are followed by four measures of morphing into the pattern of the final two measures.

Breakage comes with some helpful user-level documentation, including a quick introduction to the program's design philosophy, a basic tutorial demonstration, and some handy example files. The Breakage documentation package is completed with a FAQ sheet and a very useful guide to the program's mouse and keyboard controls.

Breakage v22 is already available. Alas, it's not working correctly here at Studio Dave, and I need to send a report to Ollie Glass. Hopefully the problems can be repaired easily: MIDI sync has been added, and neural net training status can now be selected per channel. These and other new features lend greater flexibility to Breakage's internal and external connectivity, and I'm eager to make those new connections.


Figure 3: Gneutronica 0.33

Stephen Cameron's Gneutronica is aimed squarely at those of us who want an Olde Skool MIDI drum machine, a rhythm programmer with MIDI-only output. We don't need a percussion synthesizer or sample playback device, we prefer to let an external application do the audio heavy lifting. We want our drum machine/rhythm programmer to help us stay focused on the creation of patterns and their arrangement into a formal sequence (aka a song), all in realtime. Gneutronica is that kind of drum machine, a simple and easy-to-use rhythm programmer with flexible MIDI I/O. Plus a few other features, of course.

Gneutronica's user interface is designed to optimize the creation of patterns and provide an uncomplicated tool for sequencing your patterns into your desired song form. Since the typical drum machine workflow moves from pattern to song the default active tab is Gneutronica's pattern editor. Right-clicking in an instrument track expands the track to the view seen in Figure 3, left-clicking adds a beat to the track. Right-click a beat to remove it. Velocity is determined by the pointer position, so entering an event directly combines its note number and velocity value. I like that design, it favors a rapid workflow.

The rest of the pattern editor GUI is transparent and should be intuited quickly. If you don't know what an interface component does just let the mouse pointer linger on it to pop up an informative message box.

Figure 4: The Arranger

The Arranger is Gneutronica's song editor. Here, patterns are linked together to create a drum sequence track for the number of measures needed. Again the interface is quickly comprehended. By the way, patterns can be sequenced vertically as well as horizontally. I've enjoyed this feature in Hydrogen, it gives the composer greater flexibility when designing core patterns, and I enjoyed using it in Gneutronica.

For your listening pleasure, I've uploaded a Gneutronic groove, a simple demonstration of the program's pattern and song editors at work.

As an ALSA MIDI sequencer client Gneutronica's output can be routed to any other ALSA MIDI client, such as QSynth (seen in Figure 4). I like this flexibility, but it has some downside. Alas, since Gneutronica has no integral audio support you can't save your work as a soundfile. You can record it, of course, or you can export your song sequence as a MIDI file. Going in the other direction, Gneutronica can import pattern files and ASCII drum tablature (!).

The Gneutronica Web site is the program's documentation, a single well-written and helpful HTML Web page (included with the source package) that includes complete descriptions of Gneutronica's features. I've only introduced the program, we haven't looked at the drum set editor, support for MIDI input, or the melodic sequence editor. I guess you'll have to find out about those features on your own. Have fun, and let us know if you come up with some Gneutronically cool grooves.


Ciao for now. Tune in next week for more news from the world of Linux sound and music software, coming to you "live" from Studio Dave. Meanwhile you can check out this cool interview with Csound developer Victor Lazzarini. Good stuff.