Syncing frames using Soundkeys and time re-mapping

Moderators: Disciple, zlovatt

Post Reply
MrBixler
Posts: 2
Joined: May 14th, 2007, 11:41 am
Location: London
Contact:

Hi,

I have a pre-comp with lots of stills in. Each still is 1 frame long. I would like to use Trapcode Soundkeys to play the stills on the beat. I think that time-remap is needed on the pre-comp but I need help with the code, anyone know how to do this?
cob906
Posts: 28
Joined: August 8th, 2006, 3:25 pm
Location: Lewisville, TX
Contact:

What you can do is determine how many frames a beat in your music lasts and then, based upon what frame it is, you can use the modulous operator to find out which frame from your precomp should be displayed.

For example, if it takes 30 frames for a beat to pass in your music, then set the following as the code in the time-remap property of your precomp:

Code: Select all

myFrameRate = 29.97; //Set your frame rate here;
myFrameLength = (1/myFrameRate); //Find the frame length in seconds;
myBeatLength = 30; //In frames;
Math.Round(time%(myBeatLength*myFrameLength));
The code above should give you what you're looking for. Unfortunately I'm rendering something right now and I'm not sure if there are any sytax or other errors.

Let me know if it works!
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

MrBixler wrote:Hi,

I have a pre-comp with lots of stills in. Each still is 1 frame long. I would like to use Trapcode Soundkeys to play the stills on the beat. I think that time-remap is needed on the pre-comp but I need help with the code, anyone know how to do this?
In the precomp with your pics, make sure each pic is one frame long and make a sequence of them. Bring that pre-comp into your sound keys comp and turn on time-remapping.

Set Sound Key to On/Off Trigger, Falloff to None (integrate) and the Output to 0..1. Set the range bar so that it triggers on the beat you want the pics to change on.

Now apply this expression to the time remap property of the pics pre-comp:

Code: Select all

sk=Math.round(thisComp.layer("White Solid 1").effect("Sound Keys")("Output 1"));
framesToTime(sk)

You'll have to change the name of the layer to match the name of your layer that has the Sound Keys effect on it..

Here's a movie with a quick test i did:

http://www.youtube.com/watch?v=gMipmbFyIkA
Lord Scales
Posts: 8
Joined: May 1st, 2007, 1:26 pm

cob906 wrote:Code:
myFrameRate = 29.97; //Set your frame rate here;
myFrameLength = (1/myFrameRate); //Find the frame length in seconds;
myBeatLength = 30; //In frames;
Math.Round(time%(myBeatLength*myFrameLength));
Just an observation. To find the frame rate, try this:

Code: Select all

FR = 1/thisComp.frameDuration
To find the frame lenght, just:

Code: Select all

thisComp.frameDuration
[/quote]
MrBixler
Posts: 2
Joined: May 14th, 2007, 11:41 am
Location: London
Contact:

Thanks for your help everybody.
Lloydalvarez, I managed to get exactly what I'm after using your code.

Thanks again team.

Paul
Post Reply