Create a Low-Health Audio Filter in Unity, Using the Audio Mixer & Transition to Snapshots

In this post I’m going to explain how I use Audio Mixer Snapshots and the Transition to Snapshots function to create an audio filtering effect that’s controlled by a linear value, in this case the player’s health.

Here’s the end result:

Why this method?

This technique is most useful when you want to control one or more the volume, effects or parameters of Audio Mixer Groups with one, or more, in-game values.

Audio effects often use values that are not easily compatible with other linear game values, e.g. 22000hz (Lowpass filter). Using Transition to Snapshots however, we’re able to use relative weightings, which are defined in an array of float values, to mix between two or more Audio Mixer Snapshot states using TransitionToSnapshots. It’s easy to connect these float values to linear values in game.

In this example I’m using it to connect a low pass filter (20hz-20,000hz) to the player’s health(0-100).

Pros & cons of using Transition to Snapshots:

Control any audio effect or parameter without needing to directly connect it to an in-game value.

Control multiple audio parameters at once (via Snapshot states).

Use multiple inputs to control multiple Snapshots.

Create states that exist between Snapshots (unlike TransitionTo which can only transition to a single Snapshot fully over time).

Smoothly transition between states.

When this method isn’t suitable:

Depending on the application, there may be a more suitable method that achieves the same result.

What to do next

If you liked this, why not join my game audio mailing list? As well as articles like this one, you'll get my Free Game Audio Pack, which includes 35 music tracks and 50 sound effects, free for you to use in whatever you're working on right now!