Grouping with a Mixer
- Game Development course
- Intermediate
- Lesson 29/83
- 4 min
Learn sound groups and level control with an Audio Mixer.
Audio grouping with Audio Mixer
An Audio Mixer is a professional routing hub organizing hundreds of game sounds into manageable channels. Beneath a primary Master channel, sub-groups (AudioMixerGroup) like BGM and SFX are assembled.
// Routing AudioSource output to a mixer group
public AudioMixerGroup sfxGroup;
source.outputAudioMixerGroup = sfxGroup;This allows altering all sound effect volumes simultaneously through a single channel slider.
Decibel (dB) unit and parameter control
Audio Mixer volume sliders operate on a logarithmic decibel (dB) scale: 0 dB represents unity gain, while -80 dB corresponds to total silence (mute). To adjust parameters via code, call SetFloat.
// Setting SFX volume to -10 decibels
audioMixer.SetFloat("SFXVolume", -10f);Mixer buses also host DSP audio effects like Reverb or Lowpass filters directly along channel strips.
Practice Print group and volume level
Assign "SFX" to group and "-10dB" to volume. Print Group: SFX | Volume: -10dB to the console.
Starter code
using System;
class Program
{
static void Main()
{
// group ve volume değerlerini tanımlayıp yazdır
}
}Sample solution
using System;
class Program
{
static void Main()
{
string group = "SFX";
string volume = "-10dB";
Console.WriteLine("Group: " + group + " | Volume: " + volume);
}
}Expected output
Group: SFX | Volume: -10dB
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which tool enables players to adjust all sound effects simultaneously with a single slider in settings?
- MeshRenderer and Lightmap
- Audio Mixer and AudioMixerGroup Correct answer
- Particle System Collision
- Rigidbody Constraints
Explanation: Audio Mixer bundles sounds into groups, providing collective volume control through single master parameters.
2 Assign mixer output group
audioSource.____ = targetGroup;
audioSource.outputAudioMixerGroup = targetGroup;
Explanation: The outputAudioMixerGroup property is used to route an AudioSource output to a designated mixer channel.
3 Mixer concepts
| Term | Meaning |
|---|---|
Audio Mixer |
Mixer asset governing audio channels |
AudioMixerGroup |
Sub-channel group for similar audio |
Decibel (dB) |
Logarithmic volume unit (0 to -80 dB) |
SetFloat |
Method updating mixer value via code |