Topic 11 · Audio
Voices, priorities and virtual voices
Budget real voices, rank sounds by priority, keep frequent rows short and let endings ring out.
How Unity limits voices
- Max Real Voices is the number of voices that play at once; Max Virtual Voices is how many the system tracks, and must be larger than the number the game plays or the console warns (Audio settings).
- When active sources exceed Max Real Voices, Unity virtualizes the lowest-priority sources first, and the quieter of two equal-priority sources. A virtualized source is muted but keeps its playback position and resumes if it ranks higher again. Priority runs from 0 (highest) to 256 (lowest). WebGL has no channel limit, so the setting does not apply there (AudioSource.priority).
- Virtualize Effect in the Audio settings turns off effects and spatializers on culled sources to save CPU.
Pooling
- Pre-create a pool of AudioSources sized to the voice budget per device class, configured from an authored asset (rolloff, mixer group, priority defaults), instead of creating sources per play.
- A row's priority is authored data on the row, not a constant in code.
LONG-CLIP-ON-A-FREQUENT-ROW-IS-CUT
- A long clip on a row that fires often holds a voice in a small steal-oldest pool and is mostly cut. Measured: a 6.8 s clip on a weapon row was cut 94 % of the time, and 27 % of all voice starts were steals.
- Frequent rows get short clips (under about 1 s). Steal by priority, then age; drop a new play that ranks below every busy voice; pick the voice budget per device class with the same rule the effects budget uses (12 / 10 / 6 voices for desktop / high mobile / low mobile here). Measure steal share and pool-full share in a Play census before and after: 27 % to 4 % steals, 13 % to 1.1 % of samples with the pool full.
END-OF-RUN-RINGS-OUT
- A results or defeat transition that stops every voice cuts the death sound it just triggered. Measured: the tower death sound was cut at the results switch (1.5 s); with ring-out it played to 2.0 s. On that transition disconnect gameplay audio (no new plays) and let playing voices finish; stop everything on reset, session end and scene unload.
Related
- Audio topic: every audio page in reading order.
- Next: Music and adaptive audio.