Cut a YouTube Short on the beat: BPM to cut times in Python
Turn a music bed's BPM into cut start times for a 30-second Short. Runnable Python, plus the $0.10 Timeline render and $0.125 bed.

Cuts that land on the beat read as edited on purpose. The math is small: seconds per beat is 60 divided by BPM, and a cut every N beats is N times that. Sume's Timeline takes a list of video slots (1 to 200) with an audio spine, so once you have the times you can size each slot.
The calculation
Ask Music Router for a track at a stated tempo in the prompt, for example 'about 120 BPM, instrumental, no vocals'. The tempo the model delivers is not guaranteed, so measure it or round to the nearest cut you can see on a waveform. The script below only does the arithmetic.
bpm = 120
beats_per_cut = 4
total_s = 30
step = 60 / bpm * beats_per_cut
starts = []
t = 0.0
while t < total_s:
starts.append(round(t, 3))
t += step
print(len(starts), "slots")
print("slot length", step, "s")
print(starts)
Cost of the cut
At 120 BPM and four beats per cut, a 30-second Short has 15 slots of 2 seconds. The Timeline render bills per output minute, so 30 seconds is $0.10, the same as 60 seconds. The bed is a fixed $0.125 (read 2026-10-07).
| BPM | Slot length | Slots |
|---|---|---|
| 90 | 2.667 s | 12 |
| 120 | 2.0 s | 15 |
| 140 | 1.714 s | 18 |
Sources
Related posts
More in Developers
- Cut hold music from a call recording before STT: one concat job
Drop a hold-music stretch with one Sume timeline audio concat job that reuses the file twice via source_in and duration, then send the result to STT.
- Dart dart:io: POST /v1/images on Sume from a command-line script
A Dart script that calls Sume's image API with dart:io HttpClient, applies a 40-second timeout, and handles 200, 202 and error responses.
- Sume default queue capacity: max(3, 5 x concurrency), checked per plan
Sume's default queue capacity is max(3, concurrency x 5). Checking the rule against Free, Pro, Startup and Scale, plus the org floor and the wave hint.
- Deno: time out a Sume video submit, then retry with the same key
A fetch that times out may still have created a job. A 20-line Deno submit retries only 408, 429, 5xx and timeouts, always with one Idempotency-Key.
Written by Sume