The tempo formula (19200 / bpm) assumes that a note size of 1 in the note macro is equivalent to a 1/16 note. However, this is note always the case. Let's take a look at a part of the Template.musicxml in the repo:
The most important thing to notice here is the <duration> tag. We can see that the rest spans the entire measure; this is proven both by the fact of it being the only child <note> and when opening the file in Musescore.
Currently, Muse2pokecrystal just takes the listed bpm, applies it to the set tempo formula and assumes that <duration>4</duration> is not a whole note.
The Fix
There is an xml tag called <divisions>, a child of the <attributes> tag. By default, this tag holds a value of 1. As I understand it, we can find the smallest note in a score by doing (1/4) / divisions. A value of 1 indicates that a quarter note is the smallest note in the entire score. A value of 4 means the smallest note is a sixteenth note.
A modified formula that takes this into account though you may want to check my algebra:
(19200 / bpm) * (4 / divisions)
Other Implications
While this slightly increases complexity of the tempo formula (it's getting it's own function in the refactor anyway), properly implementing this and pairing it with #12 will allow more complex songs with a much wider note length range.
The Issue
The tempo formula (
19200 / bpm
) assumes that a note size of1
in the note macro is equivalent to a1/16
note. However, this is note always the case. Let's take a look at a part of theTemplate.musicxml
in the repo:The most important thing to notice here is the
<duration>
tag. We can see that the rest spans the entire measure; this is proven both by the fact of it being the only child<note>
and when opening the file in Musescore.Currently, Muse2pokecrystal just takes the listed bpm, applies it to the set tempo formula and assumes that
<duration>4</duration>
is not a whole note.The Fix
There is an xml tag called
<divisions>
, a child of the<attributes>
tag. By default, this tag holds a value of 1. As I understand it, we can find the smallest note in a score by doing(1/4) / divisions
. A value of 1 indicates that a quarter note is the smallest note in the entire score. A value of 4 means the smallest note is a sixteenth note. A modified formula that takes this into accountthough you may want to check my algebra:(19200 / bpm) * (4 / divisions)
Other Implications
While this slightly increases complexity of the tempo formula (it's getting it's own function in the refactor anyway), properly implementing this and pairing it with #12 will allow more complex songs with a much wider note length range.