jbilcke-hf / clapper

Clapper.app, a video synthesizer and sequencer designed for the age of AI cinema
https://clapper.app
GNU General Public License v3.0
2.08k stars 194 forks source link

Add support for BPM in the project file and UI #83

Open jbilcke-hf opened 2 months ago

jbilcke-hf commented 2 months ago

Context

If we want to support music videos, we need at least a basic support of BPM (beats per minute)

this will help us product a nice grid alignment

Solution

Notes

If you search for BPM in the code base, you will see there are already function to detect that.

Note that to work as expected, we will need to make the duration per step variable.

Initially we were using this:

import { DEFAULT_DURATION_IN_MS_PER_STEP } from "@/constants"

But I've just pushed a PR to move this to durationInMsPerStep inside the useTimeline

this is still static, but at least now we have a way to mutate the value of durationInMsPerStep based on the detected BPM

jbilcke-hf commented 2 months ago

partially done, I've added:

However, the BPM isn't fully connected to the timeline grid yet (changing it won't change the alignment of segments yet)

and yes, later we can have BPM per-segment (with segments acting as groups)