Canddi

Automating Keyframe Animations in After Effects (part 1)

After Effects can turn audio amplitude into keyframes and use those values to drive another layer. In this exercise, a text layer becomes more opaque as the soundtrack gets louder. It is a useful starting point for audio-reactive graphics, but it measures loudness rather than identifying musical beats or individual instruments.

Prepare a short audio example

Create a practice composition containing a short audio clip and a text layer. Keep this first composition to one audio source so the result is easy to understand. Save the project before experimenting.

Select the audio layer and press L twice quickly to reveal its waveform. Set the work area to the section you want to analyse. Choose a section with some quiet and loud moments, rather than a nearly constant level.

Convert the audio to keyframes

With the composition active, choose Animation > Keyframe Assistant > Convert Audio To Keyframes. The command creates an Audio Amplitude layer with Left Channel, Right Channel and Both Channels slider controls.

The analysis covers the work area and represents the composition’s audio sources. Selecting one audio layer is not a reliable way to isolate that track. For a single-source exercise, use a composition containing only the intended audio. Adobe describes the command in its animation-tools reference.

Expand Audio Amplitude > Effects > Both Channels > Slider. Scrub the analysed section and watch its value. These are amplitude values, not a copy of the positive and negative audio waveform, and not decibel values to paste directly into every property.

Link the text’s opacity

  1. Select the text layer and press T to reveal Opacity.
  2. Hold Alt on Windows or Option on macOS and click the Opacity stopwatch to enable an expression.
  3. Drag the expression pick whip to the Both Channels Slider on Audio Amplitude.
  4. Preview the analysed section and confirm that the opacity changes with the slider.

A direct link may leave the text faint because a slider value of 12 produces only 12% opacity. Multiplying the value can amplify the response, but it may also push louder sections to the opacity limit. A range mapping gives you more control.

Map amplitude to a useful opacity range

For an English-language project using the default layer and effect names, this example maps amplitude values from 5 to 25 onto opacity values from 20% to 100%:

a = thisComp.layer("Audio Amplitude")
    .effect("Both Channels")("Slider");
linear(a, 5, 25, 20, 100);

Replace the direct-link expression with the example. If your layer or effect names differ, use the pick whip to create the correct reference for the first statement instead of copying the names blindly.

  • At an amplitude of 5 or less, opacity is 20%.
  • At 15, opacity is 60%.
  • At 25 or more, opacity is 100%.

The numbers 5 and 25 are example thresholds, not universal audio settings. Inspect your own slider values and choose a lower and upper input value that suit the clip, keeping the lower value below the upper one. The final two numbers are the desired output opacity limits. Adobe documents linear() in its expression language reference.

Check the result and refine it

  • Text stays faint: check the slider range and lower the upper input threshold if your audio never reaches it.
  • Text stays fully visible: raise the input threshold or inspect whether the clip has little amplitude variation.
  • An expression error appears: check the layer/effect reference, quotation marks and whether Both Channels is the intended slider.
  • Motion reacts to the wrong sound: check the audio sources used for conversion. A loud voice or effect can dominate a music track.

Preview the full section at normal playback speed and judge readability as well as synchronisation. Strong reactions are not always the best result. Keep the text visible enough to read, and avoid adding rapid contrast changes merely because the audio contains sharp peaks.

The generated amplitude keyframes are a snapshot of the analysis. If you replace, trim or otherwise change the source audio, regenerate the analysis and check that your expressions reference the intended amplitude layer. Do not leave several similarly named analysis layers without checking which one drives the animation.

Once this works, continue to part 2: using paths to create Position keyframes. That lesson uses drawn geometry to control motion rather than audio amplitude.

Develop your After Effects workflow

Contact Academy Class to discuss training in keyframes, expressions and practical motion graphics.