BPM to frame timing

How long one beat lasts at a given tempo, and how long to hold each frame so a whole number of frames fills it exactly.

Why this is not simply beat length divided by frames

It is, for a video. Not for a GIF. The format stores a delay per frame in hundredths of a second, so the only durations available are 10ms, 20ms, 30ms and so on. At 120 BPM over eight frames a beat wants 62.5ms and the nearest a GIF can hold is 60ms. That loses 20ms a beat, or 2.4 seconds a minute.

Short delays are worse: most browsers substitute a tenth of a second for one hundredth, so a loop written at 10ms a frame plays ten times too slow. This is why Gifsync writes an MP4, where timestamps go to the microsecond.

One beat, and one frame of it

TempoOne beat4 frames8 frames12 frames16 frames
60 BPM1000.0ms250.0ms125.0ms83.3ms62.5ms
70 BPM857.1ms214.3ms107.1ms71.4ms53.6ms
80 BPM750.0ms187.5ms93.8ms62.5ms46.9ms
90 BPM666.7ms166.7ms83.3ms55.6ms41.7ms
100 BPM600.0ms150.0ms75.0ms50.0ms37.5ms
110 BPM545.5ms136.4ms68.2ms45.5ms34.1ms
120 BPM500.0ms125.0ms62.5ms41.7ms31.2ms
128 BPM468.8ms117.2ms58.6ms39.1ms29.3ms
130 BPM461.5ms115.4ms57.7ms38.5ms28.8ms
140 BPM428.6ms107.1ms53.6ms35.7ms26.8ms
150 BPM400.0ms100.0ms50.0ms33.3ms25.0ms
160 BPM375.0ms93.8ms46.9ms31.2ms23.4ms
170 BPM352.9ms88.2ms44.1ms29.4ms22.1ms
174 BPM344.8ms86.2ms43.1ms28.7ms21.6ms
180 BPM333.3ms83.3ms41.7ms27.8ms20.8ms

Below about 16.7ms, one refresh of a 60Hz screen, a frame will not be seen however exactly it is timed. Nothing in the table is quite that short. 16 frames at 180 BPM is close.

Going the other way: beats from a frame count

Divide the frame count by the beats you want and check it comes out whole. Twenty frames over eight beats gives 2.5, so some beats hold three frames and others two, a 50% swing in speed you can see. Over ten beats it gives two, even all the way round.

Line a GIF up with a song