Skip to content

Instantly share code, notes, and snippets.

@monsieuroeuf
Created November 16, 2012 02:13
Show Gist options
  • Save monsieuroeuf/4083314 to your computer and use it in GitHub Desktop.
Save monsieuroeuf/4083314 to your computer and use it in GitHub Desktop.
Spits out a tab delimited bunch of markers for importing into Final Cut Pro, for use with MarkerTool
#!/usr/bin/env ruby -wKU
# by Ian Haigh
# http://ianhaigh.com/
# for use with MarkerTool
# http://www.spherico.de/filmtools/markerTool/index.html
FRAME_DURATION = 0.04
require "timecode"
frame = 0.0
beat = 60.0 / 83.0 # 60s for 128 bpm
# puts "beat in seconds: #{beat}"
marker_counter = 1
while (frame < 120)
frame += FRAME_DURATION
frame=frame.round(2)
remainder = (frame + beat) % beat
if remainder <= FRAME_DURATION
# puts "#{frame}\t:\t#{frame % beat}"
in_frames = frame / FRAME_DURATION
in_timecode = Timecode.new(in_frames)
puts "#{in_timecode}\t#{in_timecode + 1}\t#{Timecode.new(1)}\tbeat_#{marker_counter}"
marker_counter+=1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment