Trying to figure out midi tick length of tuplets

• Apr 27, 2016 - 22:47

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 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?

Do you still have an unanswered question? Please log in first to post your question.