In order to replace breve note, I need to change breve into whole for the original note, and append an identical whole note right after it and tie two whole note together.
If I just use layer.addChild(note), the new note will be appended as the last note of the layer in the current measure, which is not what I want. Later on, I explore the function of pymei, and find there is a function called addChildBefore, so I thought if I append the new note before the note which is after the breve note, it will be correct. Unfortunately, it does not work, when there is only one breve note in the measure (The next note is actually in different layers or even different measures, the new note is appended before this note! I found this type of error when I test the code).
addChildAfter will perfectly solve this problem, but there is no such function in pymei.
In order to replace
breve
note, I need to changebreve
intowhole
for the original note, and append an identicalwhole
note right after it and tie twowhole
note together.If I just use
layer.addChild(note)
, the new note will be appended as the last note of the layer in the current measure, which is not what I want. Later on, I explore the function of pymei, and find there is a function calledaddChildBefore
, so I thought if I append the new note before the note which is after thebreve
note, it will be correct. Unfortunately, it does not work, when there is only onebreve
note in the measure (The next note is actually in different layers or even different measures, the new note is appended before this note! I found this type of error when I test the code).addChildAfter
will perfectly solve this problem, but there is no such function in pymei.