Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Audio Amplitude and Motion, Position

  • Audio Amplitude and Motion, Position

    Posted by Chewbacca on March 29, 2007 at 4:39 pm

    Hey ppl,

    So i have a problem xD. I want to move a object only when the Amplitude is starting, imagine the amplitude graphic, theres a noise, the amplitude goes up and theres some more amplitude until it reach zero and go up again.

    Ok now this is what i want, when i reach the beginning of the wave(amplitude), the object moves, but the rest of the wave its stalled
    This is how i tried, its wrong i know, its kinda a algorithm.

    p_act = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);

    B = 0 //i need global, but this is the only thing i can get ;_;

    if(p_act <= 0 && B = 0) //if its zero and B(beat) is zero too, so stay put { p_act = 0 [325+p_act,150+value[1]] } if(p_act > 0 && B = 0)//if p_act > 0 this is the beginning of the wave, and it hasn’t beat yet, so BEAT IT
    {
    p_act = 20
    [325+p_act,150+value[1]]
    B = 1 //flag to 1
    }

    if(p_act > 0 && B = 1)//if p_act > 0 and already been BEATEN stay put again
    {
    p_act = 0
    [325+p_act,150+value[1]]
    }

    Tks for the coming help =D
    I’m leaving town tomorrow, and only comeback april 4, until then im here waiting 😉

    Chewbacca replied 19 years, 4 months ago 5 Members · 15 Replies
  • 15 Replies
  • Dan Ebberts

    March 29, 2007 at 5:34 pm

    A more detailed description of what it is exactly that you’re trying to do would be helpful.

    Dan

  • Chewbacca

    March 29, 2007 at 6:28 pm

    Hmmm, i will try

    I have an object(ball,square, doesn’t matter), and i want it to move(like up and down, doesn’t matter too), only when a noise begins, this noise has a start and a end, if u c the graphic of the amplitude theres a some zigzag before it ends(thats garbage to me,that still changes the position).

    Imagine a hammer beating, every beat i want to move something, so my idea was to only move the object when the beat comes and eliminate the trash(zigzag) between the start and the end.

    Example: The amplitude start at 1 sec and ends at 2 sec, so at 1 sec i mov the object like to the left, the rest of the time he stays put.

    p_act = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);
    B = 0
    if(p_act <= 0 && B = 0) {p_act = 0} if(p_act > 0 && B = 0)
    {p_act = 20
    B = 1}

    if(p_act > 0 && B = 1)
    {p_act = 0}

    [325+p_act,150+value[1]]

    I tried my best to explain ;_;
    If still u cant understand i will draw it lol. Its easier to everyone.

  • Darby Edelen

    March 29, 2007 at 7:13 pm

    [chewbacca] “if(p_act <= 0 && B = 0) //if its zero and B(beat) is zero too, so stay put"

    One note on this: = is an assignment operator and == is the comparison operator. When I first started programming this was one of the early hard lessons =)

    if(p_act <= 0 && B = 0) will always evaluate to false (0) because you're telling B to equal zero, not asking AE if B is equal to 0. Also, is AE letting you get away with not using semi-colons at the end of your assignments? Because it really shouldn't =O After those basic syntax issues, I don't think there's a good way to do what you're attempting using only keyframed audio and expressions. You might try looking into an effect from Trapcode called Sound Keys: https://www.trapcode.com/movies/beat_explode.mov

  • Dan Ebberts

    March 29, 2007 at 11:48 pm

    I think you’re leaving out some important details. It looks like you want your object to move a set distance at the start of a sound, but then not respond further to that sound. Then what? Does it stay there? What happens when the next sound comes?

    It looks to me like you’re assuming in your code that you can set a varaible (B) and it’s value will persist to subsequenct frames. It won’t. That’s not to say that what you’re trying to do can’t be done, it’s just a little tricky.

    Dan

  • Filip Vandueren

    March 30, 2007 at 12:27 am

    unless you want to do this for a 5 minute animation an 6 different layers with 800 beats…

    just animate it by hand:

    you’ll be working longer on setting the threshold of what the script thinks is a beat, and how long after the beat has ended it should move, and the feeling will never be OK.

    Just twirl open the audio amplitudes and animate,
    I know: I hate it too 😉 but sometimes setting a few keyframes gives you exactly what you need.

  • Danny Princz

    March 30, 2007 at 4:09 am

    i started writing am expresion when i needed to the exact same thing, but would up hand animating.

    the benefit of the expression is if you can use this to drive many different parameters, and if you need to change the sound/music, you dont have to reanimate.

    i was creating some animations where we were pretty sure the music was going to change, plus these animations would be used in a :30 spot and not necessarliy at the same point in time. with the expression you could just slide the audio to where you need it and bam! your done 🙂

    wish i finshed it

    who is that masked man…

  • Darby Edelen

    March 30, 2007 at 7:02 am

    I would really recommend Sound Keys again at this point, it takes all the hard work out of working with sound. You can graphically set the effect to only respond to certain frequencies at certain threshold amplitudes and set an output based on the amount above this threshold the audio reaches.

    In this manner it becomes easy to set the effect to be sensitive to any or all frequencies and (after being applied) return either 0 or 1 (or a range of other values) depending on whether the audio exceeded the threshold value.

    You can then use this value in your expressions. Takes all the labor out of it, and this is coming from someone who loves to hate on 3rd party plugs! =O

    https://www.trapcode.com/movies/beat_explode.mov

  • Danny Princz

    March 30, 2007 at 6:49 pm

    being a freelancer, i can take expressions and scripts with me… i have to count on them for what plugins are available on the amchine i might be working on

  • Darby Edelen

    March 30, 2007 at 8:30 pm

    [rendernyc] “being a freelancer, i can take expressions and scripts with me…”

    Well now we’re getting way off track, but plug-ins are very easy to… plug… in… on other peoples’ computers, you’d just better make sure you remove it when you’re done to avoid license issues =O

  • Chewbacca

    April 4, 2007 at 1:40 pm

    To wuzelwazel

    – I know that = is an assignment operator, but tks for the warning i just missed that, common typo =P
    – I will start putting semi-colon
    – I did c the Trapcode stuff but i cant find the beat that is similar, its very irregular (damn)

Page 1 of 2

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