Experimental Musical Codes

The two numeric codes are calculated from the first several bars of the tune as follows:
Code 1
This is similar to the so-called Gore-Breathnach codes. The notes are translated to scale-relative numbers. The tonic note from the K: line is represented as 1, and other notes are 2-7. Notes before the first bar line are ignored. The unit note length (from the L: line) is used to determine which notes to use. Only notes that fall on a multiple of this unit are used; shorter notes in between are ignored.
Code 2
This is the "first difference" of Code 1. Rather than the scale-relative notes, it represents the interval between notes. Also, the zeroes that would result from long notes are suppressed. A zero in Code 2 represents a repeated note, not a long note.
Both codes are highly experimental, and might change as I learn more about how to do such things.

There are a lot of dubious ABC coding practices that produce poor codes. One common problem is omitting the initial bar line. Musicians often make rhythmic mistakes at the start of a tune, making it very difficult for software to figure out where a tune really starts. We treat everything before the first bar line as a pickup, for the these reasons. This means that if you omit the initial bar line, your first bar will be treated as pickup notes and ignored. It also means that if you put a bar line (or repeat sign) before initial pickup notes, they will be treated as a significant part of the tune.

Another common problem is incorrect K:, L: and M: lines. These usually produce useless codes. Some more experimenting may turn up some heuristics to get around some of this, but it will probably be an ongoing problem.

Send comments and suggestions to John Chambers at MIT.