Audio System

Overview

The audio system uses miniaudio for cross-platform audio playback. It supports loading and playing audio files with volume, pitch, looping, and basic 3D spatialization.

Adding Audio in the Editor

AudioSource

To add sound to an entity:

  1. Select the entity in the Scene Hierarchy
  2. In the Inspector, click Add Component > AudioSource
  3. Set the audio clip path, volume, pitch, and other properties

AudioListener

Attach an AudioListener component to your camera entity to define the listener position for 3D spatial audio. There should be exactly one AudioListener in the scene.

AudioSource Properties

FieldTypeDefaultDescription
clipPathstringPath to the audio file
volumefloat1.0Playback volume (0–1)
pitchfloat1.0Playback pitch multiplier
loopboolfalseLoop the audio clip
spatialbooltrueEnable 3D spatialization
playOnAwakeboolfalsePlay automatically when the scene starts

Supported Formats

miniaudio supports WAV, MP3, FLAC, and Vorbis out of the box.

Integration Notes

  • AudioEngine is initialized automatically by the Engine constructor
  • Sound resources are managed internally by miniaudio