Trying to figure out midi tick length of tuplets
I'm writing a plugin that requires knowledge of the length of every note and rest in a part. cursor.element.duration.ticks works very well, as long as the element is not a tuplet!
I've considered using the tick at the beginning of the next element to define the end of the previous element, but I'm working with multiple voices, so sometimes there is nothing (not even a rest) between the end of one element and the beginning of the next.
Any suggestions?
Comments
You can use 'globalDuration' instead of 'duration':
cursor.element.globalDuration.ticks returns the "played duration", i.e. also accounts for tuplets.
In reply to You can use 'globalDuration' by heuchi
Thank you! I just put that in my code, and it works perfectly.
While I'm on here, I might as well also ask about the other two things that are bugging me.
1. Is there an easy way to get the measure number of a chord/note or rest?
2. How do I find slurs in the score?
In reply to Thank you! I just put that by ADavis
I might be wrong, but I think neither is possible currently:
Measure numbers are not exposed to plugins.
There was a discussion about slurs going on here and I don't think anything has changed since then.