Skip to content

getTiedNoteValue() may return incorrect note value for ties due to forward beat iteration #46

@fanjink

Description

@fanjink

Hi,

I noticed a potential issue in the getTiedNoteValue() function when resolving tied notes in Python:

def getTiedNoteValue(self, stringIndex, track): """Get note value of tied note.""" for measure in reversed(track.measures): for voice in reversed(measure.voices): for beat in voice.beats: # <-- forward iteration if beat.status != gp.BeatStatus.empty: for note in beat.notes: if note.string == stringIndex: return note.value return -1

Problem:

The function iterates beats in forward order within each measure.

As a result, when searching for the note value to inherit for a tie, it may incorrectly pick a note that appears earlier in the measure (for example, the first beat), instead of the closest preceding note before the tie.

Expected behavior:

getTiedNoteValue() should iterate beats in reverse order (reversed(voice.beats)), so that it always returns the nearest preceding note on the same string.

Would it be possible to update the function to reflect this behavior?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions