Page 1 of 1

Getting length of a selection in seconds.milliseconds

Posted: Tue Apr 07, 2026 3:08 pm
by lapieuvre
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,

Re: Getting length of a selection in seconds.milliseconds

Posted: Wed Apr 08, 2026 2:15 pm
by chapelier fou
It's tricky because it depends on the tempo automation curve.
If you restrict it to linear segments, maybe it's simpler to calculate ?

Re: Getting length of a selection in seconds.milliseconds

Posted: Wed Apr 08, 2026 2:24 pm
by lapieuvre
chapelier fou wrote:
Wed Apr 08, 2026 2:15 pm
It's tricky because it depends on the tempo automation curve.
If you restrict it to linear segments, maybe it's simpler to calculate ?
It's the only place I need the length, in the automation sections, because it doesn't translate in session view. Live already tells me the length, bottom left when I select something. This value is not "copy-able"?