when parsing an Ableton Live project file in python, how can I convert clip positions from beats to time?

477 views Asked by At

I'm attempting to parse an Ableton Live Project in Python to get the positions of clips in the arrangement view (as per http://crooked-hideout.blogspot.com/2012/01/ableton-live-set-is-gzipped-xml-ruby.html, Ableton Live project files are just gzipped XML).

However, clip positions are stored in beats, not seconds - and the project I'm working on is a long mix with plenty of master tempo automation, so I'm having troubles figuring out how to convert a beats position into a time position - anyone tried this before? Any genius ideas?

Thanks :)

1

There are 1 answers

0
Mattijs On

I would say it is a matter of counting the duration of every beat until the launch of the clip.

Say we have:

  • 1.1 Tempo at 120 BPM
  • 2.1 Clip 1 launch
  • 4.1 Tempo to 180 BPM
  • 6.1 Clip 2 launch

The calculation would be:

  • Clip 1 launch: 1 x 4 x 60/120 = 2 seconds
  • Clip 2 launch: 2 x 4 x 60/180 + 3 x 4 x 60/120 = 8.66 seconds