Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Start loop from BPM question

  • Start loop from BPM question

    Posted by Armand Verhoeven on March 12, 2013 at 1:57 pm

    Guys I need your help again,

    I have a composition I like to start from a bpm…

    I have an expression for the opacity I found:
    bpm = 138;
    mag = 100;
    freq = bpm /60 /2;
    mag * Math.sin( 4 * Math.PI*freq * time);

    How do I change this to “Start” a composition?

    Regards,

    bpm = 138;
    mag = 100;
    freq = bpm /60 /2;
    mag * Math.sin( 4 * Math.PI*freq * time);

    Toby Royce replied 13 years, 1 month ago 4 Members · 4 Replies
  • 4 Replies
  • Mitch Mann

    March 12, 2013 at 4:03 pm

    Put a marker on the layer where the first beat hits. Then add that marker’s time to the time calculated in the last line of your expression. If its still not sync’ed, just nudge the marker back or forth.

  • Toby Royce

    March 22, 2013 at 2:56 am

    I’ve utilised the expression included in here (lifesaver) to animate the z position so that titles pump in & out from the camera in line with the BPM.

    however I’m also having the same issue which I think Armand is referring to ..

    I have a 4 bar loop of music at 130 BPM. Using the expression makes this loop very close to perfectly.

    The fist beat of the first bar is at 00:00:00:00 in my sequence. But wen the animation of the title in z depth begins it is around mid way through a cycle of the sin wave, rather than beginning at the bottom or top of the wave. As a result it isn’t pulsing in sync with the other elements I have looping in the sequence..

    Is there a way to control the beginning of the sin function so it begins at 00:00:00:00?

    Cheers

    Toby

    bpm = 130;
    mag = 500;
    freq = bpm /60 /2;
    z= mag * Math.sin( 1 * Math.PI*freq * time);
    [1920/2,1080/2,z]

  • Dan Ebberts

    March 22, 2013 at 5:55 pm

    You probably just need to adjust the phase angle. If you want it to start at its closest to the camera, you could do it like this:

    bpm = 130;
    phase = 270;
    mag = 500
    freq = bpm /60 /2;
    z= mag * Math.sin( 1 * Math.PI*freq * time + degreesToRadians(phase));
    [1920/2,1080/2,z]

    Dan

  • Toby Royce

    March 23, 2013 at 1:33 am

    Thanks.. that’s opened my thinking more on this.

    I did actually also find I could achieve it by using Math.cos instead of sin in the formula. but again this limits it to beginning at the position furthest from camera, so I like the precise control of the phase degree… Thanks

    Toby

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy