Last active
September 25, 2022 17:28
-
-
Save jneen/2019c9f6910aa1bcaa646a99e1eaf1b9 to your computer and use it in GitHub Desktop.
extract clip start times from an ableton project file in 30fps format at 225bpm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# .als file | |
FILE="$1"; shift | |
SCRIPT="$(cat <<RUBY | |
\$_.scan(%r[<CurrentStart Value="(.*?)"/><Name Value="(.*?)"/>]) do |start, name| | |
frame = (start.to_f * 8).round | |
seconds, frame = frame.divmod(30) | |
minutes, seconds = seconds.divmod(60) | |
hours, minutes = minutes.divmod(60) | |
stamp = [hours, minutes, seconds, frame].map { |n| sprintf("%02d", n) }.join(':') | |
puts "#{stamp} #{name}" | |
end | |
RUBY | |
)" | |
gzip -d <"$FILE" |\ | |
xmllint --xpath '//AudioClip/CurrentStart | //AudioClip/Name' - |\ | |
ruby -ne "$SCRIPT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
225 bpm means 32nd notes line up exactly with 30fps frames.
30fps * 60 seconds per minute / 8 frames per beat = 225bpm