sync video and audio

serenwen's icon

Hey guys,
so I have a Max patch producing some sounds, and I have to synchronize those sounds with a video. I remember there is a sync object for external sources but it's obviously not working with video so do u have any suggestion about how I can do it?
Cheers

Serena

Rob Ramirez's icon

it depends on what objects you are using to play the sounds, and how you want them to sync.

if you are using sfplay~, and the video and soundfiles are the same length, you can take the millisecond signal output of sfplay~, convert it do floats (snapshot~), convert it to seconds (divide by 1000.0), and convert it to a frame for the video (multiply by the FPS of the loaded video).

so if you're two seconds into your sound file, and your movie is 30 FPS, 2 * 30 = 60, send the message frame 60 to your qt.movie.

you should trigger the snapshot~ with the same metro you use to play the video, and set the metro interval to the FPS of your video.