Getting length of a selection in seconds.milliseconds
Posted: Tue Apr 07, 2026 3:08 pm
I'd like a max patch that calculates the length of a selection. Claude and Gemini can't help me.
The reason for this, I need to calculate the average tempo of a section when there is tempo automation. I need this to bring the music in Session View.
For example, if I have a 4 bars accelerando, I can't bring that to Session view. The only way I found was to calculate the average tempo of those 4 bars. Ex. : 4 bars accel from 120 to 135Bpm, when I select these 4 bars, Live tells me (bottom left) it is 7.625 sec.
I do 16 beats (4 bars) * 60 / 7.625 = 125.90 BPM average.
If I bring those 4 bars in session view, and write a tempo of 125.90, then it will play fluidly to the next scene.
This Max Patch would calculate it automatically when I select those 4 bars, because going manually takes time. I do a lot of music with tempo automation.
Thanks,
The reason for this, I need to calculate the average tempo of a section when there is tempo automation. I need this to bring the music in Session View.
For example, if I have a 4 bars accelerando, I can't bring that to Session view. The only way I found was to calculate the average tempo of those 4 bars. Ex. : 4 bars accel from 120 to 135Bpm, when I select these 4 bars, Live tells me (bottom left) it is 7.625 sec.
I do 16 beats (4 bars) * 60 / 7.625 = 125.90 BPM average.
If I bring those 4 bars in session view, and write a tempo of 125.90, then it will play fluidly to the next scene.
This Max Patch would calculate it automatically when I select those 4 bars, because going manually takes time. I do a lot of music with tempo automation.
Thanks,