[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some fixes to musicxml2ly

From: Han-Wen Nienhuys
Subject: Re: Some fixes to musicxml2ly
Date: Fri, 15 Sep 2006 19:33:28 +0200
User-agent: Thunderbird (X11/20060907)

Tuukka Verho wrote:

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.

-           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)  -

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 - address@hidden -

LilyPond Software Design
 -- Code for Music Notation

reply via email to

[Prev in Thread] Current Thread [Next in Thread]