minutia press.
The eighth note

I spent a good two weeks working with my wife to put a band method book she's authored into electronic form. Along the way, I met some great open-source tools and rediscovered some old tool friends as well.

The issue with a book like this is that there are 8 different instruments that want to play the same pitch, but they read different notes to do that. I think I understand how band instruments got into this situation, but it's more confusing than it should have been.

The basis of the book is that the eighth note is the unit of rhythm that students should be taught, and that longer durations, like quarters, halves, wholes, are taught as tied eighth notes. This way, students always count "1 + 2 + 3 + 4 +" and they can't rush the longer notes. On to the tech geeky stuff...

Lilypond is an amazing open-source tool for typesetting music. Unlike Finale, which I like for other reasons, Lilypond engraves music based on a plain-text description of the score. So it's not WYSIWYG, but the text description of the score can be edited and processed by any tool. So here's what I did.

The master for the book is authored primarily in LaTeX/TeX but the pitches are written using do, re, mi and so on, without reference to how the pitches are notated. The macro processor m4 is then used to generate an instrument-specific version of the book. For each instrument, an m4 file contains macro definitions for the pitches that expand each pitch into the right clef, octave, and note for that instrument.

Lilypond's lilypond-book then extracts the music segments from the LaTeX file, generates images for the music, and rewrites the LaTeX file to include the images automatically. Because each music snippet is processed separately, I used m4 to impose consistent style across snippets. LaTeX and TeX then take over and generate the document.

I admit unbound admiration for Lilypond. It's the right approach for this sort of thing; the code seems relatively bug-free; the user list was responsive to the one problem I did have with the program. The m4 processor is an old friend: while at Rice, a course I took on "systems programming" had us implement m4. The rules for the macro processor are simple (think Othello instead of Chess), and we had to address issues of storage management, I/O, termination, etc.

Oh, I also learned that I can work on a project like this with my wife without either of us getting mad at the other.