---
title: "Mixers, snapshots, ducking and loudness"
slug: /workflows/audio-mixing/
markdown: /workflows/audio-mixing.md
section: audio
tier: 2
summary: "Route sounds through mixer groups, switch moods with snapshots, duck by routing and keep master below clipping."
sources: ['https://docs.unity3d.com/6000.0/Documentation/Manual/AudioMixer.html', 'https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Audio.AudioMixerSnapshot.TransitionTo.html', 'https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Audio.AudioMixer.SetFloat.html']
canonical: https://unityworkflowlibrary.dev/workflows/audio-mixing/
read_first: /read-first.md
---

> Read first, on every prompt: [non-destructive rules](/read-first.md).

# Mixers, snapshots, ducking and loudness

> Route sounds through mixer groups, switch moods with snapshots, duck by routing and keep master below clipping.

## How the mixer works

- An [Audio Mixer](https://docs.unity3d.com/6000.0/Documentation/Manual/AudioMixer.html) is an asset with a tree of groups under an always-present Master group.
  Each AudioSource routes to a group; effects, sends and returns process the group's signal. A mixer's output can be
  routed into a group of another mixer.
- **Snapshots** capture all of a mixer's parameter values; transitioning between them changes mood or theme.
  `AudioMixerSnapshot.TransitionTo(timeToReach)` interpolates to the snapshot over that time
  ([reference](https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Audio.AudioMixerSnapshot.TransitionTo.html)).
- **Ducking** changes one group based on what another group is doing, for example lowering ambience while something
  else plays.
- **Exposed parameters and snapshots don't mix.** Per the
  [SetFloat reference](https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Audio.AudioMixer.SetFloat.html), once `AudioMixer.SetFloat` sets an exposed
  parameter, snapshots no longer control it. Do not call it in `Awake`, `OnEnable` or `AfterSceneLoad`; call it in
  `Start` or later. It returns false when the parameter is not found.
- **Settings sliders.** Expose one volume parameter per user-facing category (music, effects, voice) on the parent
  group, and drive it with `SetFloat`. Leave other parameters to snapshots.

## MIXER-GRAPH-FROM-CODE

- There is no public API to add mixer groups or effects. The Editor's internal `UnityEditor.Audio.AudioMixerController`
  does it with the calls the Audio Mixer window makes: `CreateNewGroup` + `AddChildToParent`;
  `new AudioMixerEffectController(name)` + `AssetDatabase.AddObjectToAsset` + `PreallocateGUIDs` +
  `AudioMixerGroupController.InsertEffect`; `SetValueForParameter` with names from
  `MixerEffectDefinitions.GetEffectParameters`. A Send needs `sendTarget` plus `SetValueForMixLevel(0)`: it defaults
  to -80 dB, which is silent. Read the mixer back from disk after saving.
- Shape that worked: a compressor on Master after the fader as a safety limiter (threshold -6 dB, attack 10 ms,
  release 150 ms, no make-up gain); under SFX, a Combat group carrying Duck Volume (threshold -30 dB, ratio 4,
  attack 0.05 s, release 0.6 s) and a Moments group with a 0 dB Send into that ducker. High-priority moments route to
  Moments and duck combat in the mixer, with no code timer. Keep the exposed volume parameter on the parent group so
  the settings slider still covers both children. Measured after: master peak -8.2 dBFS, 0 clipped frames.

## NEW-GAIN-FIELD-IS-DB

- A new serialized field loads as 0 on every existing row. A linear "volume" multiplier added that way silences the
  whole bank. Author per-row gain in dB (0 = unchanged) and jitter as +/- dB and +/- pitch fraction, so the default
  is today's behaviour.


## Related

- [Audio topic](/topics/audio/): every audio page in reading order.
- Next: [Spatial and 3D audio](/workflows/audio-spatial/).
