Beats Per Minute Timeline

Hi , since blender is a great tool for video jockyes and many other audiovisual related artists , it would be great to have a bpm time line ,i dont know nothing about scripting , but i think it is not so dificult , and it would be the bomb , this way we could sinc the animation to some beats , some step sequencer could also be cool ,a step sequencer is a mini timeline based on beats , normaly 4/4.

is there a posibility to implement this on blender somewhen ?

The python API can set markers / name them on the timeline.

A cool thing is that when you play the animation the timeline markers “bounce” as the timeline passes over them.

I started to play with it, here’s some code for you.

Very crude and simple at the moment.

No U.I / G.U.I :).

Just change the BPM variable.

Also add optional “subBeat(‘XX’)” or lines at the end of the code if you want
subdivided beats (8ths, 16ths).

Mike

import Blender
from Blender import * 

sc=Scene.GetCurrent() 
r=sc.getRenderingContext()

fps = r.fps            
print "frames fps=",fps

#
#  get the internal timeline data
#
tl=sc.getTimeLine() 


#
endframe = Blender.Get('endframe')
print 'endframe',endframe


#####################
#
# set BPM here

BPM = 120

##############

TS = 4           
#

bps = BPM / 60                # bps = beats / second
print 'bps ',bps

TICKS = (fps / bps)- 1	  # e.g 30fps / 2bps (120 bpm) =  Quarter note (beat) every 15 frames

print 'ticks = ',TICKS


#  delete all previous markers

def eraseMarkers():
	for i in range(1,endframe,1):
		#print 'delete',i
		tl.delete(i)


#   add major beats

def majBeat():
	for i in range(1,endframe,TICKS):
		tl.add(i)                          #### add a marker to the timeline
		tl.setName(i,'Q')               ##  name the marker
		#print i


#
#  "subBeats" .e.g  8th, 16th notes 
#
def subBeat(subBeatStr):
	subTickVal = eval(subBeatStr)
	print 'subTickVal',subTickVal
	subTick = TICKS / (subTickVal / TS)
	print 'subBeat: subTick = ',subTick
	for i in range(1,endframe,subTick):
		tl.add(i)
		tl.setName(i,subBeatStr)
		#print i

eraseMarkers()

#
# do the subBeats first, then major beats writes over top
#  ... crude but simple :)

#
#  if you want "sub beats ( 8, 16, etc add them here)
#  or uncomment (remove the '#' at the beggining of the line

 subBeat('8')
# subBeat('16')

majBeat()
Window.RedrawAll()
		

That looks really useful. On a simpler level here’s a formuli for calculating Beats per Minute, Frames per Beat and Frames per Second. Not sure if this is any use as you allready have the script.

FPB = FPS*60/BPM

BPM = FPS*60/FPB

Note - try to get musitions to play in 125 BPM as this is 12 frames per beet at 25 FPS. This is nice and easy to work with.

thanx man , i dont know how to import those scripts yet , can u tell me how ? and how does it work generaly ?
thanx ;D