DallasPHP Unit Testing presentation
Yesterday I gave a presentation on unit testing to the local PHP user-group. It went over pretty well although I had to jump around a little bit more than I would have liked. Presentation and assets are dowloadable here, or check it out locally (I did it using S5 preso framework).
The discussion afterwards was good (as always), and if you’re in the area, don’t forget that they do an informal thing at NerdBooks the Saturday after meetings. So be there and be square. :^)
09:24 CST | category / entries
permanent link | comments?
Sheet Music and Midi
In my continuing investigations of sheet-music programs and midi libraries I’ve learned a few surprising things.
(Professional) Sheet Music is Hard
So most guitar people on the internet do Tablature. Tabs are relatively easy to read and write, but also very lossy compared to a good musical score. You lose note duration right away, and then you end up with thinks like “2h3p2” to describe a hammer-on / pull-off or a ligado. The upside is that you don’t even really need a program to write tabs, just pop up a text-editor.
The alternative is to use one of the sheetmusic programs. The best I’ve found (for linux) are GNU Denemo and KGuitar. These are both relatively quick / easy to input or transcribe an existing score. And once you have a score, you should be able to play it, push it to MIDI, right?
Ohhhhh, how wrong you’d be. You see, both of those are for kindof “rough-and-tumble” sheet music editing. Once you start playing with LilyPond, you realize that you’re just starting. Denemo at the least is designed for quick visual note-entry, and adding complicated things like polyphony (ie: multiple voices), ties, ligados, repeats and the like are better suited towards going directly to the
Then you get to learn about things like repeats with alternate endings, annotations (ie: what left-hand fingering to use for certain parts), lyrics… the next time you see a nicely typeset piece of music, whether it’s in a book, magazine, or written in long-hand, give a little nod of appreciation to the person who made it look so nice for you.
(Nice) Midi is Hard
Which brings me to MIDI. If you’ve got a nice complete, well-annotated piece of sheetmusic as input, a MIDI file can’t be that hard, right? Again, there’s more to the eye than you might first think. If you’ve got some time, check out the classical guitar midi guide to good MIDI files. The whole paper is intersting, but one of the simplest examples is that a C-chord when played on a guitar generally goes from top to bottom, whereas in sheetmusic, all the notes are listed as occurring at exactly the same time. So a sheetmusic → MIDI chord is “perfectly instantaneous”, which ends up sounding mechanical compared to a well-crafted MIDI file. That and about a dozen other details separates a really nice sounding MIDI performance from a mechanical “File→Save As…” effort, no matter how good your input source file might be.
I’ve heard of “MIDI performers” that take a “perfect” MIDI file as input and ~humanize~ it, doing some of the above things, but those are kindof out of the scope for right now.
In my continuing “Sheet Music Hero” quest, I’ve learned quite a bit about how to get good sheet music into the computer (Denemo + LilyPond), how to get a decent MIDI out of the sheetmusic (LilyPond → MIDI), how to read MIDI notes from a file (PyMidi / maxm / mxm and friends). What worries me is the amount of work required to do things “close to right”.
One of my earliest ideas when hacking around was to scan in a page of sheet-music, manually crop it to “measure-1.png, measure-2.png, etc”, manually pick out when the notes need to occur in each measure (ie: beat 0, beat 1/8, beat 2/4), matching those beats to pixel-regions and then play a simple “tick” noise that highlighed the proper pixels and matched the rhythm. This would help me learn a bit better how to play to play triplets in conjunction with eigth-notes and similar tricky situations.
I thought that inputting music into the computer would be quick and easy (and it is, with a program like Denemo), but getting all the extra information about ties and ligados and multiple voices is a significant undertaking. Then, trying to get a reasonable display on top of things is also difficult (because libDisplaySheetMusic.so isn’t exactly the most common library in the world). The other option would be to start with a MIDI file, but a MIDI isn’t quite high-quality enough to generate good sheetmusic from it.
So there’s unfortunately a huge divide between the goal (Sheet Music Hero) and what’s available. It’d be most useful for people to practice their own sheetmusic (which would mean the scan, crop, count route). That’s icky but practical. The more fun route would be to take existing MIDI files and autogen reasonable (simple) sheetmusic and do all the cropping / counting programmatically. That’s easier for the user, but ends up worse for learning because the generated sheetmusic wouldn’t contain all that extra information like ligados or ties (it’d end up being slightly better than the info you get from playing from tabs). The ideal does turn out to be a well-executed LilyPond file that gets auto-cropped and then follow the normal MIDI route, but with much better sheetmusic.
22:13 CST | category / entries
permanent link | comments?