Skip to content

Hear spatial & procedural audio

quick start Beginner ⏱ 6 min vgai 0.1.0

Prerequisites: Installed vgai and run the editor

What you'll learn

  • Run a scene with an audio listener on the camera
  • Trigger procedural sounds by moving the character
  • Understand the bus/listener model (this lesson's payoff is audible)

What you'll build: A scene where movement triggers procedural footstep and jump sounds.

Walkthrough — Hear spatial & procedural audio · generated by site/media/lessons/scenes2-batch.lesson.ts (4 steps)

The third-person scene wires procedural sounds: its character plays footstep while moving and jump on jump, mixed through the audio buses with the listener on the camera.

  1. Open a scene with spatial audio. Load examples/scenes/third-person.vscn.json.

    The third-person scene loaded
    A scene with audio.
  2. Enter play mode — the audio listener attaches to the camera. Setup creates the listener, a master gain, and music / sfx / voice buses; the listener rides the camera so spatial sounds are heard from its position.

    The scene running in play mode
    The listener is on the camera.
  3. Move with WASD to trigger footstep and jump sounds. The character’s controller plays the procedural footstep (and jump) helpers as it moves — synthesized, no asset files.

    Moving the character
    Movement triggers procedural sounds.
  4. Stop play mode. Press Stop (or Escape).

Recap

New functionality

  • Ran a scene with audio
  • Triggered procedural footstep/jump sounds by moving

New concepts & skills

  • The listener attaches to the camera; sound routes through music/sfx/voice buses
  • Procedural helpers synthesize sounds with no asset files
  • Browsers start audio suspended — resume() on first interaction

Next lesson → Manual: Audio

On Your Own!

Extend what you built:

  • Make a sound spatial and tune refDistance/rolloffFactor/maxDistance
  • Route a sound to the music bus and lower that bus's gain
  • Try other procedural helpers (impacts, weapons, ui)