+def try_parse_comment (str):
+ global nobarlines
+ if (str[0] == '%'):
+ if str[0:5] == '%MIDI':
+#the nobarlines option is necessary for an abc to lilypond translator for
+#exactly the same reason abc2midi needs it: abc requires the user to enter
+#the note that will be printed, and MIDI and lilypond expect entry of the
+#pitch that will be played.
+#
+#In standard 19th century musical notation, the algorithm for translating
+#between printed note and pitch involves using the barlines to determine
+#the scope of the accidentals.
+#
+#Since ABC is frequently used for music in styles that do not use this
+#convention, such as most music written before 1700, or ethnic music in
+#non-western scales, it is necessary to be able to tell a translator that
+#the barlines should not affect its interpretation of the pitch.
+ if (string.find(str,'nobarlines') > 0):
+ nobarlines = 1
+ elif str[0:3] == '%LY':
+ p = string.find(str, 'voices')
+ if (p > -1):
+ voices_append(str[p+7:])
+ voices_append("\n")
+ p = string.find(str, 'slyrics')
+ if (p > -1):
+ slyrics_append(str[p+8:])
+
+#write other kinds of appending if we ever need them.
+ return str