Beat to frame converter

chapelier fou's icon

Hello !
i want to make a converter which calculates, at a given BPM, the corresponding number of frames of the duration of 1 beat. My goal is to make video loops in sync with a song. (Basically i think my question is how long, in ms, is a frame.)
Any help anyone ?

Thank you

louis

broc's icon

The number of frames per beat can be calculated as

(60/BPM)*F

where F is the framerate (number of frames per second).

Example: BPM=120, F=30 gives 15 frames per beat.

chapelier fou's icon

Hey broc, how are you ?

ok so i got several questions :

1. when i send the message getfps, the result is 14.227.... but when i use the jit.fpsgui object, it monitors a value around 59... How do you explain this ?
2. when sending the gettime message, in which format is the result ? frame number, right ?
3. is there a way of setting loop on without jumping to the looppoints ?
4. is the fps codec dependent ? or is it more complicated ?

broc's icon

Sorry, I don't have any experience with video in Max.
But I'm sure somebody else can answer your questions.

ctrlzjones's icon

... if I may jump in ...

1. two different things.
- the getfps gives you the frames/sec for the encoded movie. you you define this once in the compression dialog when you export the movie file and stays forever with it.
- the fpsgui object reflects the framerate for the reproduction of the movie. this depends on your computer power and can be anything. it has nothing to do with the movie (well the heavier the datarate the slower the reproduction framerate this is... depending on, right, your computer power)
2.
- gettime gets you the time in the bang_moment. this is not ms but the internal quicktime format and can also vary, depending on the compression.
3.
- see messages /jump/frame/time/
4.
- see 1.

chapelier fou's icon

Thank you very much.
i still have to find a solution to make perfect loops in a defined bpm.
for 3, i'll experiment, i should have missed something, but activating the loop makes an automatic jump to the start loop point.

ctrlzjones's icon

... unless you don't tell us in detail what you aim for:

you don't need to set an endpoint to make a loop. look out for the data you want to trigger with and tell the movie what to do when things are happening ...

3139.BasicMovieLooper.maxpat
Max Patch
chapelier fou's icon

Thank you for the patch (i am not that new to it...).
I'll probably end with an experimental workaround.

What i do is i have a guy filmed singing a playback.
i want to sync the video with the music, but i still want to play it really live (so parts have no defined lengths).
So the idea is i split the video in 4 or 5 parts. I make cues for this. But at the end of one part, i want like a 1 bar loop until, the next cue is triggered by hand.
I think it will work if i engage loop on when the time value exceeds the loop start points.