Tag Archives: composition

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!!

Mazurka

Mazurka for Guitar

I have been learning LilyPond for music engraving lately and I love it!

I have always been intrigued by the intersections between music and programming. LilyPond really appeals to the coder in me because you are basically writing code in a text editor, and out comes beautiful sheet music.

Here is a work I did many years ago, Mazurka, for guitar. I used this as a learning example because it presents several problems for music engraving, in a nice short work that doesn’t require one to commit to a huge ordeal. It covers basic notation issues such as fingerings, arpeggiation, a free-form cadenza, dynamics, tempo, and articulations.

The PDF of the work will remain available right here, and I’m releasing it under a Creative Commons Attribution-No Derivative Works 3.0 Unported license, so please feel free to download it, play it, and redistribute it as you wish–just always attribute the composer, and don’t alter it in any way. Enjoy, and thanks!

Oh, and if you do perform it or have any questions on interpretation, please feel free to let me know in by posting a comment.

Audio Avitars

I found the iTunes Signature Maker at the blog of Ryan Shaw this evening. Extremely cool little idea to take your iTunes playlist and make a short little audio avitar of your musical tastes. Here is mine.

The creation of the file requires you to trust a Java applet to scan your iTunes collection and make hashes out of some of your favorite music. The applet is signed by Thawte, which checks out, but the usual cautions should still apply here. You can set some parameters such as the number of tracks to pick from and how long each segment should be. Here’s what it came up with for me, which I found particularly interesting:

Title Artist Album Starting At Ending At
Trauermusik San Francisco Symphony Mathis der Maler, Trauermusik, Symphonic Metamorphosis 0:35.2 0:38.4
The Battle of Evermore Led Zeppelin IV 5:30.6 5:35.0
Summertime Miles Davis   2:24.2 2:29.0
Postcards Yellowjackets Four Corners 0:12.0 0:16.0
The Firebird Suite Igor Stravinsky   1:55.4 1:57.8
Panama Van Halen   2:37.1 2:42.7
47. Erbarme Dich, Mein Gott Johann Sebastian Bach Bach: St. Matthew Passion – CD 2 6:30.8 6:36.0
01 – Requiem Aeternum Wolfgang Amadeus Mozart Requiem K626 3:27.5 3:30.3
String Quintet, Op.77 – 1. Allegro con fuoco The Chamber Music Society of Lincoln Center Dvorak Serenade 4:05.2 4:08.8
05 E Alex Wilson Studios / Telltale Weekly Digital Pitch Pipes 0:00.0 0:06.0

I like how it finishes with a reference pitch that I use to tune to every time I practice. It makes a nice blend that tapers off into the solo E a nice touch. It was my first run of the applet, but I’m going to go with it.

Finale PrintMusic: Can’t RTFM?

This is such a simple thing, and I call this a major oversight on the part of the software vendor: I kept getting errors when trying to access the user manual or tutorials from within Finale PrintMusic 2006, getting errors that read something like “Could not open PMTOC.pdf”. I found the file after a quick search via Spotlight on my machine and it launched into Preview as this is the default Mac OS X handler for PDF. I got a table of contents, but it was only that. None of the links worked and it was essentially useless. I then noticed that the entire documentation was broken out into separate files. Linking to other local files apparently isn’t supported in Preview, or it doesn’t use the same protocol as Adobe Reader. Would have been better to make one PDF document, where anchors are supported in both Reader and Preview.

I hate Adobe Reader (and when the hell did they start calling it “Reader” instead of “Acrobat Reader”), but I suspected that this wasn’t going to work otherwise. There was no readme file to suggest that Acrobat was a requirement, so I’m guessing at this point. I grudgingly went and downloaded the Acrobat Reader from the Adobe site and installed it, and I’d like to take a moment to lament on Acrobat Reader’s strange installer: You download a download utility and it downloads another installer. Geeks will say “WTF? OK, whatever…” Non-geeks will just wonder what happened and why they still can’t open PDFs. Just make one installer, or one binary app that can be dragged to one’s hard drive.

And now everything works fine, except I have an extra PDF-reading program that I hoped I would never need.

Documentation has always been a tough subject. We have seen the demise of printed manuals. Electronic equivalents have been formatted to PDF, HTML, Flash, and so on, and sent to browsers, PDF readers, operating system help programs, or displayed within the programs own constructs. Vendors often will switch the tools they use, and wildly, between software version releases. It’s nutty how many ways it can exist, and I don’t know of any solution to this madness or even if there is one. My favorite method is the style that is used by PHP, complete and updated frequently as it lives online, with printer-friendly formatting and downloadable archives, and a number of freely-available tools that make it easy to use including Dashboard and Konfabulator Widgets.