[sdiy] Beat timing calculations

Joel B onephatcat at earthlink.net
Wed Jul 27 06:02:21 CEST 2011


I'm contemplating writing a drum machine like program and i'm not sure how to calculate the timing to trigger a note, say a 16th note pattern, for instance. Here is what I have so far:

130 bpm= bps=60/130=0.46153846 

1000ms per second * bps 
ms =461.53846  per beat division

16 beats=16*461.53846 =7,384.61536
Milliseconds per loop

but there probably has to be something to handle things that don't land on a proper digital boundary like 

33.3333333333... without throwing the tempo off with rounding or truncation errors? Also is my math correct?
-Joel

Sent from my iPhone


More information about the Synth-diy mailing list