I am trying to calculate the onset time in seconds for any given note in Music21. So for example, if a note is in measure 3, beat 1 and in 4/4 time at 60bpm, I would need the value 8 to be returned (since the note starts 8 seconds into the piece). This is a simple calculation if the time signature and tempo are consistent throughout the piece, however the calculation becomes difficult for the general case. Is there a way to do this without iterating over all measures?
Thanks in advance for any advice!