4 Replies Latest reply on Sep 18, 2016 4:48 PM by Rick Gerard

    Moving an object with sound e.g. Someone speaking

    JunkieDonna

      I want to know how to use sound like someone speaking to animate/move an object, like this (I'm pretty sure they're using the sound to trigger the movements) - Triforce! #2: Civ VI - YouTube

       

      Thanks to anyone who can help.

        • 2. Re: Moving an object with sound e.g. Someone speaking
          JunkieDonna Level 1

          Thanks for that, maybe I should have been more clear in my original post but that appears to only show things like the scale. In the video the scale doesn't appear to change, only the position of the upper part of the triangle. That was what I was wanting to know how to do, like change the Y/X position of an object depending on how loud or quiet the sound was.

           

          Thanks, Angus.

          • 3. Re: Moving an object with sound e.g. Someone speaking
            Roei Tzoref Adobe Community Professional

            you can do the same thing with position or any other value. just separate the dimensions first, and attach the Y axis to the audio amplitude slider. you might want to add "value-" so you can easily adjust the initial position, and for the layer to go up instead of down:

            value-thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider")

            001.gif

            • 4. Re: Moving an object with sound e.g. Someone speaking
              Rick Gerard Adobe Community Professional & MVP

              If you are using the Keyframe assistant to turn audio into keyframes you get a set of values that can be applied to anything you like. Try this:

              1. Select your audio layer and then use Animation>Keyframe Assistant>Convert Audio to Keyframes
              2. Select the Audio Amplitude layer that is created and press the U key to reveal the keyframes
              3. Select Both Channels>Slider and then turn on the graph editor
              4. Observe the low and high values of the audio and record those values on a post it note
                Screen Shot 2016-09-18 at 4.34.37 PM.png
              5. Reveal the position property of the layer you want to react to the sound and then select position, hold down the Alt/Option key or go to Animation>Add Expression and click to start an expression
              6. type t = and then drag the pickwhip from the expression controls to the Both Channels Slider property of the Audio Amplitude layer and release, then add a semicolon ; and press return
              7. type x space =
              8. From the Expression Language menu (little white circle with a black arrowhead just to the right of the pickwhip) choose Interpolation>ease(t, tMin, tMax, value1, value2)
              9. t is the value from Both Channels Slider in the Audio Amplitude layer
              10. Change tMin to the minimum value you want to use for the start of the movement from your post it note - say 2.2
              11. Change tMax to the maximum value you recorded on your post it note from the graph editor - say 12.7
              12. Change value1 to the minimum value you want to layer to move in the x direction -  say -100
              13. Change value 2 to the maximum value you want to move the layer in the x direction - say 250
              14. Add a semicolon ; at the end of the line and press return
              15. type y = value[1] to keep the y position value of your layer as it's original value (or repeat the procedure you just did for x) and add a semicolon to the end of the line and press return
              16. Set up your position array by typing [value[0] to read the current x position
              17. Add + x , y]
              18. You're done.

               

              Your expression looks like this:

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

              x = ease(t, 2.2, 12.7, -100, 250);

              y = value[1];

              [value[0] + x, y]

               

              The motion of your layer looks like this: (x motion is  in red)

              Screen Shot 2016-09-18 at 4.43.48 PM.png

              Having the graph editor properly set up and editing your expressions in right there makes it easy to see exactly what happens as you change the values.

               

              An expression like this is the first step in learning expressions. You can control any property you can find in After Effects as a number or any color you see as a color chip with an expression. You just have to learn how to use the language. Any numeric value or color is an array. The standard array is [x, y, z] with x being value[0], y being value[1] and z being value[2]. Some properties like color have 4 values, some have 2. Switches and check boxes have one value either 0 or 1 for off and on. You  can figure out the array by looking at how the values are displayed in the timeline.

               

              If you do not see numbers or a color chip, like curves or mask path keyframes, then you generally cannot control or read values from that property.

               

              To learn more about expressions please take time to type expressions in the search help field at the top right corner of AE and spend some time studying up. Basic expression skills will lighten the workload on many different kinds of projects.