Frame rate fluctuation & conversion

drshakamoto's icon

Hi,
So I have two questions really

I am working on a patch that uses video delay/feedback from my computer webcam using jit.grab. I want to then use the intervals between the two video feeds to send a bang which I will use as a midi trigger. I worked out the rough interval between the feeds in sec/ms and created an equation to translate this into bangs.(this doesn't have to be exact just roughly accurate so the echo of image would reflect an echo in sound.

Max Patch
Copy patch and select New From Clipboard in Max.


However, I'm having a problem with framerate fluctuation. The output of jit.grab seems to fluctuate between 9-21 fps. Which means that the equations fails to reflect the delay. Some fluctuation is fine but such a big change throws it off. Is this normal?

A possible way around this is to convert the fps number into an integer/float and use it in the equation, so that when the framerate changes it will be incorporated into the delay-time equation. Is there a way to make this conversion?

Thanks,

Matteo Marson's icon

Hey Finn,

you could try with something like this to compute the time interval between frames

Max Patch
Copy patch and select New From Clipboard in Max.

yaniki's icon

It is rather simple to measure time between two events (for example frames in video stream):

Max Patch
Copy patch and select New From Clipboard in Max.