Using JEdit with LilyPond on Mac OS X

June 29th, 2009

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

Baking censorship into the spec

June 12th, 2009

There is a proposal to introduce a new <nsfw> element into the HTML5 spec. The idea is to flag potentially censorable content that might get you fired or otherwise offend your fair-hearted co-workers, I suppose.

I am uncomfortable with the idea of baking in a self-censorship construct, or any kind of censorship construct, into a specification. This is poor semantics – semantic structure should define the meaning of the content and not try to impose some moral or ethical absolute. I just don’t see how this would be implemented effectively, and better to call objects what they are in my opinion. But most importantly, I don’t want to see us creep in censorship constructs into the very foundation of the web. There is something fundamental about this proposal that I find troubling.

(discovered from Zeldman)

RGBa and -webkit gradients: Yes.

May 27th, 2009

When @malarkey asked if RGBa worked with -webkit gradients, my own curiosity couldn’t resist a quick and fugly test to see. Yes indeed, it works:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
  <head>
    <title>Gradient Test</title>
    <style type="text/css" media="screen">
      body {
        background-color: green;
      }
      div {
        background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(50,50,50,0.8)), to(rgba(80,80,80,0.2)), color-stop(.5,#333333));
        width:80%;
        height:5em;
        margin:0 auto;
        padding:1em;
        text-align:center;
        color:white;
      }
    </style>
  </head>
  <body>
    <div>Hello World!</div>
  </body>
</html>

Screen shot showing green bleed-through on a -webkit gradient div

Yosemite Pics

May 25th, 2009

Some photos from last weekend’s trip to Yosemite!

Half Dome with some really cool cloud action:

Half Dome with Clouds

Woodpecker hittin’ the road:

Woodpecker Launch

I particularly like how this one came out:

Half Dome

Sequoias were ginormous:

Sequoias

View of Yosemite Falls from Glacier Point:

Yosemite Falls

Yingwen and her new hat:

Yingwen

Musicians, memory, and learning

May 21st, 2009

Great post over at Scienceblogs.com by Dave Munger titled “Musicians have better memory — not just for music, but words and pictures too

As musicians, we are constantly training ourselves to memorize. We spend hours upon hours memorizing music, and using mnemonic cues such as melodies, song form, harmony, music notation, and so on to help us memorize. Many of us start at a very early age.

Not only that, but practicing music is really doing repetitive calisthenic exercise on the parts of your brain that process technical thinking. We count over and over again (one and a two and a…), those beats are subdivided into fractions and complex mathematical iterations begin to permutate in both rhythm and harmonic elements of music performance.

It gets better: Music composition is really just another flavor of writing code. Musicians who read music are trained to read code from an early age. Musicians make excellent programmers.

So it is clear to me that music instruction is a critical component of education, and should begin consistently and from an early age. This is the best way to develop inherent technical thinking skills, improve memory, and help kids survive in an age where the people who know how to write code, or at least can think in code-like patterns, have a far greater chance of success professionally.