Skip to main content

quarter_conversion

Function quarter_conversion 

Source
pub fn quarter_conversion(
    quarter_length: FloatType,
) -> (Vec<(DurationType, u32)>, Option<Tuplet>)
Expand description

The written note values a length is made of and the tuplet, if any, they are written inside: music21’s quarterConversion.

One value for a plain or dotted note, one for a tuplet (the written value, which the tuplet’s ratio then scales), and several for a length that can only be written as a tie — a quarter tied to a sixteenth for five sixteenths. Empty for a length that runs off the end of the note values, which is music21’s inexpressible, and for a length of nought.

The tie is found greedily, largest value first, as music21 finds it: take the largest note that fits, and look for a single dotted value covering what is left before taking another bite. A length no tie of eight values reaches is written as one note inside the tuplet quarter_length_to_non_power_of_2_tuplet finds.