Skip to content
Game Audio: Sound Effects, Music & Spatial Audio

Game Audio: Sound Effects, Music & Spatial Audio

DodaTech Updated Jun 20, 2026 6 min read

Game audio is half the experience. A game with great graphics but bad sound feels lifeless. Audio communicates feedback (you hit something), atmosphere (wind in a forest), and emotion (triumphant music after a boss fight).

In this tutorial, you’ll learn audio sources and listeners, 2D vs 3D audio, the sound design workflow, FMOD and Wwise middleware, procedural audio, audio occlusion, mixing/ducking, and asset optimization techniques used by professional game audio designers.

What You’ll Learn

  • Audio sources and listeners in Unity and Unreal
  • 2D (ambient) vs 3D (positional) audio
  • Sound design workflow: recording, editing, implementing
  • FMOD and Wwise middleware integration
  • Procedural audio generation
  • Audio occlusion and obstruction
  • Mixing, ducking, and dynamic volume
  • Audio asset optimization

Why Game Audio Matters

Audio directly affects player performance and immersion. Studies show players react 50ms faster with spatial audio in FPS games. At DodaTech, we apply game audio techniques in Doda Browser for spatial UI feedback and environmental soundscapes.

Learning Path

    flowchart LR
  A[2D Animation] --> B[Multiplayer Networking]
  B --> C[Game Audio<br/>You are here]
  C --> D[Game Optimization]
  style C fill:#f90,color:#fff
  

Audio Sources and Listeners

Every game engine has two fundamental audio objects:

ComponentRoleExample
Audio SourceEmits soundFootstep sound on the player
Audio ListenerHears soundAttached to the main camera
Audio MixerProcesses audioAdds reverb, compression, EQ
// Unity — playing a footstep sound
using UnityEngine;

public class FootstepAudio : MonoBehaviour
{
    public AudioSource audioSource;
    public AudioClip[] footstepClips;

    public void PlayFootstep()
    {
        // Pick a random clip from the array
        AudioClip clip = footstepClips[
            Random.Range(0, footstepClips.Length)
        ];
        audioSource.pitch = Random.Range(0.9f, 1.1f); // variation
        audioSource.PlayOneShot(clip);
    }
}

Expected behavior: Each footstep plays a different random clip with slight pitch variation, preventing the repetitive “machine gun” sound effect.

2D vs 3D Audio

TypeBehaviorUse Case
2D AudioSame volume everywhereMusic, UI sounds, narration
3D AudioVolume/pitch/pan based on distanceGunshots, footsteps, environmental sounds
// 3D audio setup
AudioSource source = gameObject.AddComponent<AudioSource>();
source.spatialBlend = 1f;    // Fully 3D (0 = 2D, 1 = 3D)
source.minDistance = 1f;      // Full volume within 1 unit
source.maxDistance = 20f;     // Inaudible beyond 20 units
source.rolloffMode = AudioRolloffMode.Logarithmic; // Natural falloff

Expected behavior: As the player moves away from the audio source, the sound gets quieter and pans to one ear.

Sound Design Workflow

Professional sound design follows this pipeline:

  1. Record — capture raw sounds (Foley, field recording)
  2. Edit — clean up noise, trim, normalize (Audacity, Reaper)
  3. Process — add effects (EQ, compression, reverb)
  4. Implement — import into engine, set up events
  5. Mix — balance volumes, add ducking
  6. Test — playtest with different audio setups

FMOD and Wwise Middleware

FeatureFMODWwise
CostFree (indie) / paidFree up to 200 assets / paid
Learning curveModerateSteep
Real-time mixingYesYes
Parameter controlStudio parametersGame parameters + RTPCs
Platform supportAll major platformsAll major platforms

FMOD example — playing an event from code:

using FMODUnity;

public class PlayFMODEvent : MonoBehaviour
{
    [EventRef] public string fmodEvent;

    public void PlayExplosion()
    {
        RuntimeManager.PlayOneShot(fmodEvent, transform.position);
    }

    public void SetParameter(string paramName, float value)
    {
        RuntimeManager.StudioEventInstance(fmodEvent)
            .setParameterByName(paramName, value);
    }
}

Expected behavior: The FMOD event plays with all its mixing, effects, and parameter modulation defined in the FMOD Studio authoring tool.

Procedural Audio

Procedural audio generates sound at runtime rather than playing pre-recorded clips. This is memory-efficient and creates infinite variation:

// Generate a simple beep tone procedurally
using UnityEngine;

public class ProceduralBeep : MonoBehaviour
{
    private AudioSource audioSource;

    void Start()
    {
        audioSource = gameObject.AddComponent<AudioSource>();
    }

    public void PlayBeep(float frequency = 440f, float duration = 0.1f)
    {
        int sampleRate = AudioSettings.outputSampleRate;
        int samples = (int)(sampleRate * duration);
        AudioClip clip = AudioClip.Create("Beep", samples, 1,
            sampleRate, false);

        float[] waveData = new float[samples];
        for (int i = 0; i < samples; i++)
        {
            waveData[i] = Mathf.Sin(2 * Mathf.PI * frequency *
                i / sampleRate);
        }

        clip.SetData(waveData, 0);
        audioSource.PlayOneShot(clip);
    }
}

Expected output: A sine wave tone at 440Hz (A4) plays for 0.1 seconds. Change frequency for different pitches.

Audio Occlusion and Obstruction

Occlusion muffles sound when a wall blocks the path between source and listener. Obstruction partially blocks sound. Unity’s built-in occlusion requires the Audio Spatializer SDK, but FMOD and Wwise handle it natively.

Source (behind wall) → Occlusion calculation → Muffled output
// Simple occlusion with raycast
public class SimpleOcclusion : MonoBehaviour
{
    public AudioSource audioSource;
    public LayerMask occludingLayers;
    public float occludedVolume = 0.2f;

    void Update()
    {
        Vector3 dir = audioSource.transform.position - transform.position;
        float distance = dir.magnitude;

        if (Physics.Raycast(transform.position, dir.normalized,
            distance, occludingLayers))
        {
            audioSource.volume = occludedVolume;
            audioSource.lowPassFilterEnabled = true;
        }
        else
        {
            audioSource.volume = 1f;
            audioSource.lowPassFilterEnabled = false;
        }
    }
}

Expected behavior: When an obstacle blocks the line of sight between listener and audio source, the sound becomes quieter and muffled (low-pass filtered).

Mixing and Ducking

Ducking lowers background music volume when important sounds play (dialogue, alerts):

using UnityEngine.Audio;

public class AudioDucker : MonoBehaviour
{
    public AudioMixer mixer;

    public void DuckMusic(float duckDuration = 2f)
    {
        StartCoroutine(DuckRoutine(duckDuration));
    }

    System.Collections.IEnumerator DuckRoutine(float duration)
    {
        mixer.SetFloat("MusicVolume", -20f); // Lower music
        yield return new WaitForSeconds(duration);
        mixer.SetFloat("MusicVolume", 0f);   // Restore music
    }
}

Expected behavior: When a dialogue line plays, background music volume drops for 2 seconds, then fades back.

Common Mistakes

1. Not Using Audio Mixer Groups

All sounds on the same Audio Mixer group means you can’t separately control music, SFX, and dialogue volumes.

2. Ignoring Dynamic Range

A game that’s equally loud during quiet exploration and intense combat fatigues the player. Use compression to balance dynamic range.

3. No Randomization on Repeated Sounds

Playing the exact same footstep clip creates a robotic “machine gun” effect. Randomize pitch (±10%) and select from multiple clips.

4. Overly Large Audio Files

Uncompressed WAV files bloat build size. Use Vorbis (OGG) for music, ADPCM for short SFX, and target 128-192 kbps quality.

5. Not Preloading Frequently Used Sounds

Loading audio from disk on first play causes a delay. Preload common sounds on scene start.

6. Forgetting Mobile Constraints

Mobile devices have limited audio channels. Set a max of 12-16 simultaneous voices on mobile. Prioritize important sounds.

Practice Questions

1. What’s the difference between 2D and 3D audio?

2D audio is the same volume everywhere (music, UI). 3D audio changes volume/panning based on distance from the listener.

2. What does audio ducking mean?

Temporarily lowering background audio volume when an important sound plays (dialogue, alert).

3. How does audio occlusion work?

A raycast checks for obstacles between source and listener. Obstacles cause the sound to be muffled (low-pass filter applied).

4. What is procedural audio?

Audio generated at runtime using algorithms rather than pre-recorded clips. This saves memory and creates infinite variation.

5. Challenge: Create a dynamic music system.

Use FMOD or Wwise parameters to transition between combat and exploration music. The parameter changes based on whether enemies are nearby.

Mini Project: Audio Environment

Build a scene with:

  1. A player with footstep sounds (randomized)
  2. Background ambient audio (wind, birds)
  3. A collectible that plays a pickup sound
  4. Audio occlusion when the player walks behind a wall
  5. Music that ducks when the pickup sound plays

FAQ

Should I use middleware or engine audio?
For simple games, engine audio is sufficient. For complex games with dynamic mixing, parameter control, and interactive music, FMOD or Wwise is worth the investment.
What audio format should I use?
Vorbis (OGG) for music (small file, good quality). ADPCM or uncompressed WAV for short SFX (fast decoding, low CPU). MP3 for voice-over.
How do I prevent audio clipping?
Set master volume to -3dB headroom. Use a limiter on the master bus. Normalize all assets to -1dB peak before import.

What’s Next

Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro