Tag Archives: arranging

Why hosting LilyPond music projects as open source Git repositories is good

For those of you unacquainted, LilyPond is music notation software. Unlike other programs such as Sibelius or Finale, which are both great in their own right, LilyPond deals with sheet music creation as source code in text files using a simple language. You run the files in a compiler, and out come beautiful PDFs of your music. It also can create MIDI files so you can hear a quick gist of what you’re working on too.

Erbarme dich, mein Gott

From a coder’s point of view, it is great to be able to work in your favorite text editor and work in a largely similar way that one would when working on software: code, compile, test, publish. But it’s not as hard as it sounds – beginners can get started producing sheet music scores very quickly by just going through a quick tutorial. Might not work for everyone – some of us need to be able to drag and drop the notes on the staff, or that extra abstraction layer to source code may be just one bridge too far. But the price is right, and it’s worth a try.

For those of you musicians out there who use LilyPond, you understand how useful and powerful the software is. Your music source is in simple text files, easily displayed on the web, ported, and shared. Sharing is a foundation of LilyPond engravers, and there are tons of places to find free and open scores – most notably the Mutopia project.

But creating large projects, especially transcriptions, can sometimes be daunting tasks for one individual. Manually uploading corrections to a site might be tedious, and version control might not even exist.

Git is an excellent solution for version control. And GitHub is a free and excellent destination to host your Git LilyPond projects.

Now imagine people are hosting their LilyPond works on GitHub. Say it’s a transcription of some Baroque-period composition by an obscure composer, and photographic plates are available to view. You want to get it ready for your orchestra, but imagine hammering out all those notes alone. Enter open source: A team of volunteers can grab copies of the project, work on it, and merge code back in. Git handles this process elegantly, and everyone can work together on the same code base. The project is done in record time, and you can spit out parts just in time for the first rehearsal.

But wait, there’s more. Say the band director wants to try this out on the wind ensemble. Rather than starting from scratch, they can fork the project and leverage the existing code. Another person wants to grab the melodic fragments and arrange the same work for baritone sax and synthesizer – another fork. Check out code that is freely available, and rework it ad infinitum.

This might even apply to my stewing idea of crowd-developed open-source composition. I wonder what a symphonic work would look like developed by a team of composers? If we can put together things like Linux and Firefox using the open source model, why not a piece of music?

Using JEdit with LilyPond on Mac OS X

LilyPond is a wonderful way to write simple code that generates beautiful sheet music. I use TextMate for nearly all my coding. It’s a great editor for the web and I have it fully customized to write code for everything I do including CSS, HTML, XML, XSL, Ruby on Rails, and PHP. There is a decent start at a TextMate bundle for LilyPond, and it does color code my LilyPond markup and let me run the compile command straight from the text editor, but the code coloring seems to break down when I get too detailed in the code formatting. Additionally, the feature that lets you point and click on a notehead which brings me back to the editor and position the cursor exactly where the relevant code is for where I clicked seems to be difficult—if not impossible—to get configured. Without this feature, editing complex scores can be a royal pain. There has to be a better way.

Now the basic functionality for LilyPond on Mac was to have it’s own text editor built in, and although primitive, it worked fine for the point and click feature. One could use a system shortcut to open the code in TextMate and all was good, so no big deal there. Unfortunately Mac OS X 10.5 seems to break LilyPond, and it’s a small enough project that no-one has stepped up yet to fix this. I’ll give it a stab sometime, but for now I need to edit some Hindemith bass parts ASAP!

After some research, I discovered there is a path forward in JEdit and a plugin called LilyPondTool. I found basic instructions at this website (which has several alternative paths available,) but there’s just a couple of specific things to mind when going the JEdit route. Here’s how to get it working on Mac OS X:

First, install LilyPond. Get the latest Mac OS X 10.4 build. Note that if a real, bona-fide, working binary appears at that link for 10.5 or 10.6, these instructions become obsolete (and your life is now easier.)

Next, install JEdit. Be sure to get the latest Mac OS X JEdit 4.3pre package and not one of the older ‘stable’ 4.2 builds.

Launch JEDit and choose Plugins > Plugin Manager. In the Plugin Manager, click on the Install tab and find LilyPondTool in the list. Click the checkbox next to LilyPondTool, click Install, and close the window when the thing finishes installing.

Now you have the LilyPondTool installed in JEdit, but it is set up probably for a Windows file system. There should now be a LilyPond > button on the JEdit toolbar that will appear. This button houses a menu for many excellent LilyPond shortcuts. Click on this menu and choose Development > Lilytool Options. This will open the Plugin editor for JEdit, and likely will miss opening the LilyPondTool options section of this panel. Easy enough to fix – just click on the LilyPondTool item in the left tray and select General from the list. Now you need to configure the application paths. These should be (unless you installed these things in weird places):

For the path to the LilyPond binary: /Applications/LilyPond.app/Contents/Resources/bin/

For the path to the external PDF viewer: /Applications/Preview.app

That should get you up and running. You should now have a Run LilyPond and a Preview Output (PDF) button on the JEdit toolbar that compiles and opens your score and lets you point and click on noteheads to instantly return the position of the relevant code. You also now have a nice IDE for LilyPond, with toolbar buttons and menu items to help you along, including a new document wizard and menu items for all the little bits of code I forget (such as ottavia brackets, thumb marks, tuplets, etc.) And the built-in MIDI player is a nice touch.

Update 2009-07-03: As you will see from the comments below, the developer has kindly set the Mac OS X default paths accordingly. Thanks!!