Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Radom jump cuts to audio

  • Radom jump cuts to audio

    Posted by Jean Piche on October 30, 2010 at 3:50 am

    Hello,

    I am trying to make random (or marker-based) jumps into a video layer by examining an audio signal with an amplitude threshold. In other words, when the kick drum hits, the video playback head moves to a new place in the layer and plays at regular speed until another kick drum hits.

    I have looked at Dan (Ebberts)’ s fine toots but I can’t seem to adapt any of them for my purpose.

    Anyone know of a simple way to acomplish this?

    Any leads much appreciated!

    Sébastien François replied 14 years, 2 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    October 30, 2010 at 10:53 pm

    Play with this time remapping expression. Set threshold to something that makes sense for your audio level and set beatDur to the approximate maximum duration of one beat (this is used to make sure the expression doesn’t jump too close to the clip’s Out Point).


    threshold = 25.0;
    beatDur = 1;

    audioLev = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");

    above = false;
    frame = timeToFrames();
    while (frame >= timeToFrames(inPoint)){
    t = framesToTime(frame);
    if (above){
    if (audioLev.valueAtTime(t) < threshold){
    frame++;
    break;
    }
    }else if (audioLev.valueAtTime(t) >= threshold){
    above = true;
    }
    frame--;
    }
    if (! above){
    t = time - inPoint;
    }else{
    t = time - framesToTime(frame);
    }
    seedRandom(frame,true);
    start = random(inPoint,outPoint-beatDur);
    start + t;

    Dan

  • Jean Piche

    October 31, 2010 at 3:13 am

    Dear Dan,

    Many thanks for this script that does exactly what I need to do. You are definitely the champion of AE scripting.

    I do program quite a bit myself but, for some reason, I seem to have a serious JavaScript blockage. Perhaps it is the difficulty of passing variable values from one evaluation to the next…

    In any case, many many thanks. I will spending tomorrow trying to figure out how you did this!

  • Sébastien François

    February 24, 2012 at 1:22 pm

    I confirm, this script does what I was looking for for a while! Thanx Dan, I use your expressions very often.

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