More about converting MIDI to lilypond

I wrote a a
couple of days ago
about having tried out a new way of
converting MIDI files to lilypond. I posted the gist of the
idea to the lilypond
users’ mailing list
, and got some more suggestions of things
to try.

The idea I liked best was that the MuseScore program has an
experimental Capella import (and
lilypond export),
which would have let me avoid using the MIDI files as an
exchange format at all. Unfortunately, in its current state,
the import crashes on the capella files for Holborne.
(I did report the bug on the MuseScore tracking program.)

So I tried several other programs that import MIDI and export
lilypond, and the one that seems to work best for this
particular purpose was the rosegarden one. I
haven’t finished a whole piece, but from what I’ve done, it
looks like the work I have to do is work I couldn’t reasonably
expect a MIDI reading program to do for me.

The most time-consuming part is that the MIDI files for the Holborne
are what lilypond calls “unfolded” repeats, and I want “volta”
repeats. That is, when something is repeated, these MIDI files
play it twice (which is what you want when you’re using the MIDI
file to practice with), whereas I want to print the music once with repeat
signs around it. But otherwise, I’m just making the changes
which are necessary because I want unbarred parts.

More ebook sloppiness

I never minded stuff like this when the ebooks I was reading
were being produced by volunteer labor, but now that I’m paying
real money for them, it really irritates me.

I’m reading The
, volume 2 of The
Baroque Cycle
by Neal Stephenson, which I purchased

The chapter I’m reading takes place at a castle in Germany, and
I believe Stephenson refers to it by the german word Schloß.
However, the producers of the ebook got the code for the German
double s wrong, and so instead of a Schloß, the ebook keeps
talking about a Schloé. (Html entity 233 instead of 223.)

This book is published by “William Morrow, An Imprint of Harper
Collins Publishers” and I’m sure there are lots of people who work
for that organization who could spot a typo that bad and that
consistent, so I can only conclude that none of these proofreaders
was asked to look at the book after the people who converted the
text to the epub format were through. And that the people who did
the conversion aren’t good proofreaders.

Of course, this would be even more irritating if I weren’t
running the illegal script that turns the ereader format back into
html, which I can edit with emacs.

Truce in the browser wars (on my machine, anyway)

I wrote previously
about my efforts to find a browser to replace Firefox 3.0, which
has major memory leaks and takes over the sound system.

I seem to have settled on Firefox 3.5 for the moment.

I still like the interface on chromium-browser from google, but the linux
version was too incomplete, and so I had to keep a firefox
browser going in addition. In addition, because it was
undergoing such rapid development, I was having to restart it
every day, which is a nuisance.

They have actually gotten flash working, so you could use it to
watch youtube videos, but I’m still not able to publish my
daily blog entry. And they frequently have problems with the
interface with X windows, so that you can’t move or view the
window the way you expect.

Firefox 3.5 still has some memory leakage, and of course when
it’s using 13% of my current 8G, that would have been more than
100% of the old 1G system. But it takes at least a week to get
to be a nuisance on the current system, and by then I’ve usually
had to restart it so that I can listen to the MIDI files when I’m
transcribing music. (This is a point for Chromium; I can play
midi files from the command line even if I’ve just listened to
music on Chromium.)

Another major advantage of Firefox over chromium is that there
are all those plugins, including one that lets you use emacs to
edit text fields, and the one that lets you share your bookmarks
between all your computers.

I’ve heard people complain about problems with Firefox 3.5, but
the only one I’ve hit is that my bank site complains that I’m
using an untested browser, but then it lets me do my banking

So for now, I’m putting up with Firefox 3.5, but I’ll let you
know if chromium grows up enough to be worth another shot.

A Graphic Example

[ebook on Sony reader]

A lot of non-technical people’s eyes glaze over when you start talking
about standard, non-proprietary formats. Mike
has come up with a graphic example of why you don’t
want one company owning the format of the books you read.

Apparently Sony requires any book sold for their reader in
their store to be formatted by them (at a cost of $200). And then
when they do it, it looks like that.

This hideous example is from Sony, for the Sony readers, but
the principle is the same for any proprietary format — if they
won’t tell you how to do it, you’re stuck with them doing it for
you, and you may well not like what they do.

This is why I don’t put music in proprietary formats on

Wrote a program yesterday

It’s a pretty short program, and it doesn’t do as much as I
wish it did, but it will make a tedious and error-prone job a
little bit less tedious.

I’ve mentioned this before, but turning a website from html
into a content-manged site is a pain in the neck, and one of the
most painful things is getting the images and pdf files and such
into the media library, because that’s a terrible web-based
program, that only lets you do one file at a time.

So my program uses the python wordpresslib. It takes
one argument, which is the name of the file to upload. (The url,
username, and password
for the wordpress blog are hard-coded for my purposes.)

The program uploads the file and returns the URL for accessing
the raw file in the media library.

This isn’t really as good as you would hope for — what you’d
want is to supply a title and caption for the item and get the
link that shows the image in your post as a link to the page
page in the media library. You have to do all of that through
the web interface. But at least that web interface is a
reasonable program. The one for uploading gives you two
choices, one of which never works for me and the other one makes
you pick the filename via the browser even if you know it.

I’m glad I got programming energy for this even if it isn’t
much of a program. I think it’s important to use skills like
that pretty often. Of course I’ve been writing some PHP in the
course of the website redesign, but that’s closer to writing
html than it is to real programming.

Here’s the program if you want to use it:

#!/usr/bin/env python

# 09-Aug-20 lconrad; created
# usage: filename
# adds filename as a media object to the wordpress blog

# import library
import wordpresslib, sys

if sys.argv < 2:
print "usage: filename"

filename = sys.argv[1]
# note that it's the xmlrpc.php interface you need to specify
wordpress = ""
user = "*redacted*"
password = "*redacted*"

# prepare client object
wp = wordpresslib.WordPressClient(wordpress, user, password)

# select blog id

# upload image for post
imageSrc = wp.newMediaObject(filename)

print "Image uploaded to: %s" % imageSrc

Making one PDF of many

People who aren’t lazy enough to have figured out how to use
computers to save them work are really strange about using them to
make lots of work for other people.

The director of the West Gallery Quire sent
a mail to the list suggesting that everybody print their own music
for the workshop
next week,
but providing only a link to a page with pointers
to the individual pieces, and a list of the order it should be in.

So before breakfast this morning, I spent 20 minutes
downloading the pdf’s and writing a LaTeX program to put them in
one pdf. I know there are other ways to do this, but this got me
a title page with a list of the pieces.

I was greatly assisted in doing this fast by a latex file
posted by Peter
to the Nokia
users list.
He figured out how to put PDF’s into a page
exactly the size of the Nokia
, and posted it.

After breakfast, I put my pdf file up on my website and posted a link to it. I’m sure people are a lot more likely to print one 23 page file
than to chase 10 links and print them and put them in order.

Here’s a skeleton for how to do it to print a a PDF on letter

title{Your title here}
author{Your name}
date{today} %or use the date you want

Of course, you substitute the name of your PDF file for
filename.pdf, and you can have as many includepdf lines as you

Blogging from emacs

I wrote a few months ago about how I post these
It seems a lot harder than what I do for email.
I type one letter to set up whether I’m writing a new
mail, replying to the sender, or replying to all recipients, and
whether I want the contents of the message I’m replying to in the
reply. Then I write my reply, and press a couple of keys to
send it. All without ever leaving emacs, which is the editor
that’s in my fingers so I don’t have to think about what to do
to move the cursor or delete or reformat.

For a weblog entry, I can edit the actual text in emacs, but
then I have to paste it into my browser and add tags and categories

So a couple of days ago I was catching up on news reading, and there was a
bug reported about weblogger in the emacs help newsgroup, which
indicated that the poster, while hitting an irritating problem,
had gotten farther towards getting it to work than I had, so I
decided to try it again.

Again, I didn’t get anywhere, but I was energetic enough to
send an email someone, who pointed me at someone else, who
answered my initial questions quite calmly and pointed me at the
bug list and the mailing list that he’d set up some time ago.

So I’m basically doing some testing for the developer on a
platform (wordpress) that he doesn’t have easy access to, and I
believe that we’ll eventually get a program that I really want
to have, namely a direct interface between emacs and my blogs.

In this case, both wordpress and emacs are open source
software, and they both use a well-documented protocol, so there
aren’t any insuperable barriers to being able to write this
program that I wish I had — someone just needs to write, document,
test, and debug the code. I’m helping with the documenting and
testing; maybe I’ll at some point get into the debugging, although
I was involved in gnus for several years without ever really
touching the code.

Backing Up

I just upgraded my computer hardware, so I’m typing this on a
shiny new
with 4 cpu’s, a terrabyte of hard drive, and 8 Gigs
of memory.

Getting all the stuff from the old computer to this one is
still harder than it should be, but is easier when you upgrade
while the old system is still working.

What ought to be true is that if you move the /home directory,
install the same set of packages, and import the data from the
database, you should have a working system.

Some people claim that you can just copy /etc and /var to the
new computer and then the new system will work the same way the
old one did. I didn’t find this to be true, and I’ve been hand
moving the things from /var and /etc that I turn out to need, or
reconfiguring the new system. Part of why this is less true for
me is that the new system is a 64 bid install, and the old one
was still 32 bits.

In any case, when you have the luxury of the old system still
working is a good time to check that your backup procedure is
working, and to add things to it as you find yourself manually
moving something from the old system to the new one.

The most embarrassing hole in my procedure was that I found my
system for entering lilypond into emacs via USB keyboard didn’t
work because I’d installed a little program it needed in
/usr/bin (which should be only executables from the package
management system, and doesn’t get backed up) instead of

I don’t yet have either gallery2 or wordpress working right on
the new system, but the old system seems to have the same
problems, so it probably isn’t the backup procedure.

My own backup procedure is largely rsnapshot, along with some
scripts that back up databases and the websites that are hosted
elsewhere. This gets everything you need (as long as you tell
it the right files to back up), but is fairly large and
cumbersome, so one of the things I’m missing is recent off-site
backups. It backs up to a 1
terrabyte firewire
drive. Each backup takes up about 160
Gigabytes, but the files that are the same are hard linked, so
10 backups are only about 200 Gigabytes.

Anyway, I’m very happy with the new system, because now when
the backup procedure starts I just barely notice, instead of
having to stop what I was doing on the computer and go get a cup
of coffee.

What I should be doing on the new site

I started the site before there
was such a thing as a Content Management System for a website. I
thought I was being pretty sophisticated by having it database
would indeed not be up yet if I hadn’t done that, but there’s
still a lot of stuff about the books and about why I do what I do
that’s in basic html at, and should be moved into wordpress.

I didn’t expect it to be that hard, because I’m using the raw-html
plugin for wordpress. So I was thinking that all I had to do was
to put two html comments around my html and put it in as a
wordpress post.

This is true as far as it goes, but consider the following

Links within the html
The content of the link has to be moved to the new site, and
the link has to be updated. This is easy enough on a one-by-one
basis, but doing thirty of them at once is a pain. I think I’m
not putting most of the pictures into the WordPress media
library; it’s just too much easier to copy them to a directory
and link to them there.
Links to the page
Until you’ve put the page into wordpress, you don’t know
what the link is going to be, and you don’t want to change any
links until you’ve published the new page. This means you have
to start at the bottom of the tree, and the set of links-to
relationships between my html pages is not a simple tree graph.
Redirect the page on the old site to the one on the new
A lot of people link to the old site, and I haven’t yet
gotten around to telling them all to change it, and when I do,
they’ll take their time about changing their links, at least if
they’re anything like me. So I want to keep the pages on the
old site, but have them redirect to the new site. This is
another thing I can’t do until I’ve published the page on the
new site, but want to do right afterward, since I’m doing a fair
amount of improving things as I move them, so I don’t want
people reading the old, inferior stuff when they could be
reading the new, improved stuff.

On a cheerful note, the new site is as much easier to make
additions to as I hoped it would be. On the old site, I would
spend a morning doing the additions after I’d made several of
them, but with the new site, I just do a “make upload” when I’ve
proofread a piece and think it isn’t too embarrassing.

Some pages are now being redirected

I have the new site up at
Since I will no longer be maintaining the music portion of this
site, I am now redirecting the automatically generated pages to
the equivalent pages on the new site.

I’ll deal with the written pages as I get to them.

In general, the new central place for information about all the
pieces I’ve published is the
new By Composer Page.
Let me know what you think of it.