This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Audio Events

How to author and fire audio events — event libraries, clip pools, procedural noise and chiptones, distance falloff, and concurrency.

Base — ships in GS_Audio.

An audio event is a named sound your game can fire. You author events in an event library asset, assign the library to the Audio Manager, and then play sounds by name from anywhere — script, C++ or a trigger volume.

Everything that makes a sound behave well in a game — variation, distance falloff, a cap on how many can play at once, following a moving object — is configured on the event, not at the call site. Firing one is always just a name.

For component properties and the extension guide, see the Framework API reference.

 

Contents


Creating an Event Library

  1. In the Asset Browser, create a new Audio Event Library (.aev) asset.
  2. Add an event to it and pick a type from the dropdown.
  3. Give it an Event Name — this is what you fire by.
  4. Set its Mixing Channel so it routes to the right volume channel.
  5. Assign the library to your Audio Manager’s library list.

Libraries can also be added and removed while the game is running, which is how you would stream in a level’s sound set.


Choosing an Event Type

TypeUse it forWhat you author
PoolRecorded sound — footsteps, impacts, voices, music stingersA pool of sound files. One is picked at random each time.
NoiseWind, static, hiss, rumbleA noise colour (White, Pink, Brownish, Blueish) and a duration.
SfxrRetro and UI sound — coins, lasers, jumps, blipsA pool of SFXR profiles. The profile’s envelope sets the length.

Noise and Sfxr events need no audio files at all. They generate their sound at runtime, which makes them useful early in a project when the audio pass has not happened yet.


Making Sounds Vary

Both Pool and Sfxr events hold a pool, and pick from it at random on every fire.

This is the single highest-value thing to know about the event system. A footstep event with one clip sounds mechanical after three steps. The same event with five recorded variants sounds like walking — and the code firing it does not change at all.

For Sfxr events the pool is even cheaper to fill: generate a sound at sfxr.me, press mutate a few times, and import each result as a profile. Five mutated explosions in one pool means the explosion never repeats identically.

A pool of one is perfectly valid. It is just a sound that does not vary.


Distance and Concurrency

SettingWhat it controls
Distance Min / MaxFull volume within min, fading out to silence at max. Set min above zero.
Is 2DIgnores position entirely — pure stereo. Use for UI and music.
Concurrent Event LimitThe most voices this event can have playing at once. Stops one emitter flooding the mix.
Event Repeat HoldA short window after firing where the event will not re-fire. Stops a rapid trigger machine-gunning the sound.
LoopRepeat until stopped.

The last two matter more than they look. A collision sound fired from a physics callback can trigger dozens of times in a few frames; the concurrency limit and repeat hold are what keep that from turning into noise, without any logic on your side.


Firing Events

Three calls on AudioManagerRequestBus, all resolving the event by name:

NeedMethod
A sound with no position — UI, music, narrationPlayEvent2D
A sound at a fixed point in the worldPlayEventAtLocation
A sound that follows a moving objectPlayEventOnEntity

PlayEventOnEntity keeps tracking the entity as it moves, so it is the right choice for anything attached to a character, vehicle or projectile.


Quick Reference

NeedBusMethod
Play a non-positional soundAudioManagerRequestBusPlayEvent2D
Play at a world positionAudioManagerRequestBusPlayEventAtLocation
Play attached to an entityAudioManagerRequestBusPlayEventOnEntity
Load an event library at runtimeAudioManagerRequestBusAddAudioLibrary
Unload an event libraryAudioManagerRequestBusRemoveAudioLibrary

Glossary

TermMeaning
Audio EventA named sound the game fires, with its own pooling, distance and concurrency settings
Event LibraryA .aev asset holding a set of events
PoolA set of sources on one event, picked from at random per fire
Concurrency LimitThe maximum number of voices one event may have playing at once

See Also

For the full API and the extension guide:

For related systems:


Get GS_Audio

GS_Audio — Explore this gem on the product page and add it to your project.