Skip to main content
Participant
Aug 17, 2024 10:10 PM UTC
Question

AE Expression smooth timing question

Hello cows,

am new to this forum so i try to be specific as possible to save everbodys time:

I have a click sound, that translates into very clear keyframes with values between 10 and 20 at a click and I want to my graphic to be 10px further up everytime a click/keyframe value occurs

BUT

I need the animation to be linear but smooth starting and ending just halfway between the clicks so the next animation can start just in time. The clicks are not unison but vary in clicks per minute.


I already tried

ease(value, 11, 20, 0, 10)

smooth(width=0.1, samples=50)

smooth goes into the right direction but I cant change it to be precise where i need the animation to start and end and to be at 10 exact at the click.


Could somebody please point me into the right direction or am i missing something?

THANKS!

This topic is closed to new replies. Start a new post to keep the conversation going.

9 replies

Dan Ebberts
Community Expert
Community Expert
Aug 17, 2024 11:43 PM UTC

It would help if you could post a screen shot of what your clicks look like in the graph editor.

Translate
jd3s19nAuthor
Participant
Aug 17, 2024 11:47 PM UTC

Hi Dan,

 

thanks for your reply. My click looks like the attached screenshot zoomed in into a part thats straight repetetive. Later on the time in between changes sometimes.

thanks!

Translate
Dan Ebberts
Community Expert
Community Expert
Aug 18, 2024 12:33 AM UTC

It's pretty complex. It will probably look something like this:

// count previous beats

threshold = 10.0;
moveAmt = [0,-10];

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

above = false;
frame = timeToFrames(time);
n = 0;
fSave = 0;
while (frame >= 0){
  t = framesToTime(frame);
  if (above){
    if (audioLev.valueAtTime(t) < threshold){
      above = false;
    }
 
  }else if (audioLev.valueAtTime(t) >= threshold){
    if (fSave == 0) fSave = frame;
    above = true;
    n++;
  }
  frame--
}

// find the next beat

frame = Math.round(time / thisComp.frameDuration) + 1;
above = audioLev.value > threshold
while(framesToTime(frame) < thisComp.duration){
  t = framesToTime(frame);
  if (above){
    if (audioLev.valueAtTime(t) < threshold){
      above = false;
    }
  }else if (audioLev.valueAtTime(t) >= threshold){
    break;
  }
  frame++;
}
dt = time - framesToTime(fSave);
tTot = framesToTime(frame - fSave);
value + n*moveAmt + linear(dt,0,tTot,[0,0],moveAmt)
Translate