Tuukka Verho wrote:
Hi!

I noticed that musicxml2ly can't handle files that don't have <voice> tags
telling which voice a note belongs to. It seems that sigle voice scores don't
necessarily have them. I made a modification that makes the script assume that
notes without <voice> tags belong to voice 1. Previously such situations caused
an exception.

Additionally, the script expects that notes in the input file have <type> tags
telling the type of the note. That isn't always the case, so I added some code
to calculate the type of the note by its duration. The number of dots is also
determined by the duration.

        else:
-           return 0
+           tolerance_exp = -4  # means that notes that are 1/32 or less shorter
than 1/4 are quarter notes etc.
+           return int (math.ceil (-math.log(self._duration) / math.log(2)  -
2**tolerance_exp))

Since music notation uses exact rational numbers, using math.log () is usually forbidden, and it's better to use exact arithmetic. Can you doublecheck whether or not exact arithmetic applies to your case, please add an explanation comment why you're using floating point numbers?


--

Han-Wen Nienhuys - [EMAIL PROTECTED] - http://www.xs4all.nl/~hanwen

LilyPond Software Design
 -- Code for Music Notation
http://www.lilypond-design.com



_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to