Audio Events
Categories:
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
- Choosing an Event Type
- Making Sounds Vary
- Distance and Concurrency
- Firing Events
- Quick Reference
- Glossary
- See Also
Creating an Event Library
- In the Asset Browser, create a new Audio Event Library (
.aev) asset. - Add an event to it and pick a type from the dropdown.
- Give it an Event Name — this is what you fire by.
- Set its Mixing Channel so it routes to the right volume channel.
- 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
| Type | Use it for | What you author |
|---|---|---|
| Pool | Recorded sound — footsteps, impacts, voices, music stingers | A pool of sound files. One is picked at random each time. |
| Noise | Wind, static, hiss, rumble | A noise colour (White, Pink, Brownish, Blueish) and a duration. |
| Sfxr | Retro and UI sound — coins, lasers, jumps, blips | A 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
| Setting | What it controls |
|---|---|
| Distance Min / Max | Full volume within min, fading out to silence at max. Set min above zero. |
| Is 2D | Ignores position entirely — pure stereo. Use for UI and music. |
| Concurrent Event Limit | The most voices this event can have playing at once. Stops one emitter flooding the mix. |
| Event Repeat Hold | A short window after firing where the event will not re-fire. Stops a rapid trigger machine-gunning the sound. |
| Loop | Repeat 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:
| Need | Method |
|---|---|
| A sound with no position — UI, music, narration | PlayEvent2D |
| A sound at a fixed point in the world | PlayEventAtLocation |
| A sound that follows a moving object | PlayEventOnEntity |
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
| Need | Bus | Method |
|---|---|---|
| Play a non-positional sound | AudioManagerRequestBus | PlayEvent2D |
| Play at a world position | AudioManagerRequestBus | PlayEventAtLocation |
| Play attached to an entity | AudioManagerRequestBus | PlayEventOnEntity |
| Load an event library at runtime | AudioManagerRequestBus | AddAudioLibrary |
| Unload an event library | AudioManagerRequestBus | RemoveAudioLibrary |
Glossary
| Term | Meaning |
|---|---|
| Audio Event | A named sound the game fires, with its own pooling, distance and concurrency settings |
| Event Library | A .aev asset holding a set of events |
| Pool | A set of sources on one event, picked from at random per fire |
| Concurrency Limit | The maximum number of voices one event may have playing at once |
See Also
For the full API and the extension guide:
For related systems:
- The Basics: Audio Manager — loads your libraries
- The Basics: SFXR Profiles — what Sfxr events play
- The Basics: Mixing & Effects — where an event’s channel routes
Get GS_Audio
GS_Audio — Explore this gem on the product page and add it to your project.