Automate Layer Opacity with Audio in After Effects: A Practical Expression Workflow
Stop hand-keyframing opacity to the beat. Use After Effects' Convert Audio to Keyframes and a one-line expression to drive any property directly from audio amplitude—complete with tuning tips, performance caveats, and a reusable preset workflow.
14 Jun 2026, 12:24 UTC

The Problem: Manual Keyframing Doesn't Scale
You've got a music track and want a text layer, shape, or footage to pulse on every beat. The naive approach—scrubbing the timeline, dropping opacity keyframes at each transient—works for a 10-second clip. It falls apart on a three-minute song or when the client asks for a different track tomorrow. Each change means re-keyframing from scratch.
After Effects has a built-in path around this: Convert Audio to Keyframes creates a hidden layer named "Audio Amplitude" with a Slider effect that outputs the combined channel level (0–100) for every frame. You can then drive any animatable property—Opacity, Scale, Rotation, Effect intensity—directly from that slider using an expression.
How the Expression Bridge Works
An expression is a tiny JavaScript-like snippet evaluated per frame. When you Alt-click (Option-click on Mac) the stopwatch next to Opacity, you replace static keyframes with a live calculation. The expression reads the Audio Amplitude slider and maps its range to the property's range.
The core mapping function is linear(). Its signature is linear(value, inMin, inMax, outMin, outMax). It clamps and remaps linearly, so you don't need conditional logic.
Step-by-Step Implementation
- Import your audio file (WAV or AIFF preferred; MP3 works but may introduce compression artifacts).
- Drag it into a composition. Select the audio layer.
- Right-click → Keyframe Assistant → Convert Audio to Keyframes. A new layer "Audio Amplitude" appears with an Effects panel showing "Both Channels" → "Slider".
- Select the layer you want to pulse (e.g., a text layer). Press T to reveal Opacity.
- Alt-click the Opacity stopwatch. Paste the expression below and press Enter on the numeric keypad to commit.
Worked Example: Beat-Synced Opacity Pulse
linear(
thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider"),
0, 100, // input range from the slider
0, 100 // output range for Opacity (0%-100%)
)
This expression says: "Take the slider value (0-100), and map it directly to Opacity (0-100%)." When the kick drum hits, the slider spikes, Opacity jumps to 100%; in the silence between beats it falls toward 0%.
Tuning the response: Most tracks don't use the full 0-100 slider range. Open the Graph Editor for the Audio Amplitude slider, note the typical peak (say, 45), and adjust the input max:
linear(
thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider"),
0, 45,
0, 100
)
Now a slider value of 45 yields 100% Opacity, giving you a stronger visual punch without changing the audio.
Trade-offs and Limitations
- Preview performance: Every layer with this expression re-evaluates on each frame during RAM preview. On a 4K comp with 20 expression-driven layers, scrubbing can lag. Mitigation: pre-render the Audio Amplitude layer or apply the expression only to hero layers.
- Noisy audio = jittery keyframes: Compressed MP3s or live recordings often have a noise floor that keeps the slider above zero, causing a faint flicker. Fixes: run a slight Gaussian Blur on the slider keyframes, or add a threshold in the expression.
- Single-channel nuance: "Both Channels" sums left and right. For stereo-specific tricks, use "Left Channel" or "Right Channel" instead.
Verify and Reuse
- Press 0 on the numeric keypad for a RAM preview. Watch the Opacity value in the timeline—it should spike cleanly on each beat.
- Scrub manually; a yellow expression warning icon means a syntax error (usually a typo in the layer or effect name).
- For a sanity check, disable the expression, manually keyframe three beats using the waveform as a guide, then re-enable and compare. The curves should match closely.
- Save the tuned expression as an Animation Preset: select the Opacity property, choose Animation → Save Animation Preset. Name it "Audio Opacity Pulse".
Next Steps
Once the opacity pulse works, you can drive Scale, Rotation, or any effect parameter the same way—just change the output range in linear(). For more organic motion, try ease() instead of linear() to add easing curves, or feed the slider into a wiggle() amplitude for a jitter that breathes with the music. The Audio Amplitude layer is your single source of truth; every downstream expression stays in sync automatically.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.