MIDIUtil icon indicating copy to clipboard operation
MIDIUtil copied to clipboard

Issue with deInterleaveNotes

Open ledm opened this issue 1 year ago • 0 comments

Hi,

first - thanks for much, I fricking love this tool and I use it all the time for sonifying climate change data. It's so good.

I've found a minor issue with deInterleaveNotes: https://github.com/MarkCWirt/MIDIUtil/blob/8f858794b03fcbfdd9d689ac39cf0f9a6792e416/src/midiutil/MidiFile.py#L884

which occasionally breaks. Under some circumstances (which I don't fully understand why), it tried to pop an item from an empty list. My solution is to hardwire the empty list into an elif case:

                 if len(stack[noteeventkey]) > 1:
                        event.tick = stack[noteeventkey].pop()
                        tempEventList.append(event)
                    elif len(stack[noteeventkey]) == 1:
                        stack[noteeventkey].pop()
                        tempEventList.append(event)
                    else:
                        pass

Thanks again for a great package!

ledm avatar Mar 04 '24 10:03 ledm