Christian Marcus Cepel writes: | Maybe I'm nuts, but I was invisioning my parser looking for the first | alpha character in the file as the first tune, and then for the first | alpha character after groups of more than one EOL marker. Seem's | completely straightforward and easy, and in no way dependant or easier or | harder than if an X: line is included. (I've not mentioned the one | exception I can think of, which is the % token.
Yeah; you're nuts! ;-) The real reason for wanting a rule for "start of tune" is that ABC is routinely used for including tunes in email messages. This is a very important part of ABC's niche, and ABC software that can't extract a tune from an email message is seriously crippled. One of the original function of the X: line was to make it very easy for a program to ignore everything in a file that's not ABC. It has turned out that a lot of users casually omit the X: line. The way that a lot of software deals with this is by using a slightly more complex recognition scheme: Ignore everything until you see a line that starts with "X:" or "T:", and then start accumulating lines in the tune buffer. Along the way, look for a "K:" line. When you hit a blank line, the tune is complete. If there was no "K:" line, it wasn't a tune, and can be discarded or treated as text. It also turns out to be very useful to do something slightly more complex: Also recognize "P:" as the start of a tune. The reason is that there is ABC around that also omits "T:" lines in some tunes. The canonical example is a classical work with a T:title line at the start of a "work", and then "P:" lines for the sections. It's common to give such sections their own X: lines, so that ABC software can pull them out and deal with them separately. This usage wasn't really in the original ABC docs, but it's an obvious approach that works with a lot of current ABC software. For example: X: 1 T: Symphony No. 3 in Gm P: Andante K: Gm ... X: 2 P: Adagio K: Bb ... X: 3 P: Minuet K: Cm ... P: Trio K: Eb ... X: 4 P: Allegro K: Gm ... This works just fine with abc2ps, and produces output that looks like what orchestral musicians are used to seeing on paper. The X: lines make it easy to extract the sections and print them separately. There would probably also be a lot of V: lines, and you could also select on these. For example, you might ask to have X:3 V:2 printed, giving you the Minuet&Trio second violin part. To subscribe/unsubscribe, point your browser to: http://www.tullochgorm.com/lists.html
