DesignGddAudio Manager

Audio Manager

Status: Designed Author: user + game-designer Last Updated: 2026-03-28 System Index: #20 — Alpha, Polish Layer

Overview

The Audio Manager handles SFX playback and background music across all scenes. It listens for game events (card played, damage dealt, enemy death, phase transitions) and plays corresponding sounds. Music tracks loop per scene with crossfade on transitions. Audio is managed through Godot's AudioBus system with separate buses for SFX, Music, and UI sounds.

Player Fantasy

"The game feels alive." Card slaps, impact sounds, and tense boss music elevate the experience from "functional prototype" to "game I want to play again." Audio is the cheapest way to add juice.

Detailed Design

Core Rules

  1. Audio Manager is an autoloaded singleton — persists across scenes.
  2. Three audio buses: Music, SFX, UI. Each independently volume-controlled.
  3. SFX triggered by game event signals. No direct calls from gameplay systems.
  4. Music per scene — crossfade on scene transitions.
  5. SFX are non-positional (2D game, no spatial audio needed).

Audio Buses

BusPurposeDefault Volume
MasterOverall volume100%
MusicBackground music70%
SFXGameplay sounds (card, combat, enemy)100%
UIMenu clicks, button hovers80%

SFX Event Map

EventSoundBus
Card played (Attack)Sword swing / impactSFX
Card played (Skill)Shield raise / buff soundSFX
Card played (Power)Magical charge-upSFX
Card played (Assist)Gentle chime / healSFX
Card played (Chain)Chain link / combo soundSFX
Damage dealt to enemyHit impact, varies by damage amountSFX
Damage dealt to playerPain thud, screen feedbackSFX
Block absorbed damageShield clangSFX
Enemy deathDefeat soundSFX
Player deathSomber toneSFX
Status effect appliedDebuff: dark tone, Buff: bright toneSFX
Turn endedClick / confirmationUI
Phase transitionWhoosh / tension shiftSFX
VictoryFanfareSFX
DefeatLow, somber stingerSFX
Button clickClickUI
Button hoverSoft tickUI
Card hoverPaper rustleUI
Rally addedCoin / energy chargeSFX
Rally spentEnergy releaseSFX

Dice Game SFX Events

EventSoundBusNotes
Dice rollWooden clack, satisfyingSFXPlayer clicks Roll
Dice lockQuick click/snapSFXLocking a die
Dice unlockSoft clickSFXUnlocking a die
Dice rerollWhoosh + settleSFXUsing reroll
Dice flipFlip soundSFXEnemy flips all dice
Score/ConfirmChime, satisfyingSFXConfirming hand
Enemy hitImpact thudSFXDamage to enemy
Enemy hit (heavy)Heavy impactSFXBig damage
Enemy deathDefeat crashSFXEnemy dies
Player damagePain thudSFXTaking damage
Block absorbShield clangSFXBlock stops damage
Enemy: Steal RerollSneering soundSFXReroll stolen
Enemy: Lock HoldLock clickingSFXHolds locked
Enemy: Burn DiceFire sizzleSFXDice destroyed
Enemy: Flip AllMagic whooshSFXAll dice flipped
Enemy: SnipeSniper shotSFXHighest die halved
Enemy: GravityGravity crushSFXDice become 1-3
Enemy: ChaosMagic swirlSFXDice shuffled
Turn startTension builderSFXNew turn begins
Combat winVictory fanfareSFXBattle won
Combat loseDefeat stingerSFXBattle lost

Music Tracks

SceneTrack StyleLoop
Main MenuCalm, invitingYes
LobbyLight, anticipatoryYes
MapAdventurous, medium tempoYes
Combat (basic)Energetic, medium intensityYes
Combat (elite)Higher intensity variantYes
Combat (boss)Epic, high intensityYes
RewardBrief triumphant, then calmYes
VictoryTriumphant fanfare (5-10s), then calm loopStinger + loop
Game OverSomber (5-10s stinger)Stinger only

Music Crossfade

transition_to_track(new_track, duration=1.0):
    tween current_music volume to 0 over duration/2
    swap track
    tween new_music volume to target over duration/2

Interactions with Other Systems

SystemDirectionInterface
Combat SystemListensCombat events (card played, damage, phase change, victory/defeat)
Game State ManagerListensScene transitions for music changes
Settings SystemReadsVolume levels per bus
All UIListensButton interactions for UI sounds

Formulas

Damage Sound Scaling

# Bigger hits = louder/more impactful sound variant
if damage >= 15: play("hit_heavy")
elif damage >= 8: play("hit_medium")
else: play("hit_light")

Edge Cases

CaseResolution
Multiple SFX simultaneouslyGodot handles polyphony natively. Allow up to 8 simultaneous SFX.
Music track missingLog warning, continue without music. Don't crash.
Scene change during SFX playbackSFX finish playing (short, <1s). Music crossfades.
Volume set to 0Still process events, just no audible output. No CPU waste.
Web export audio restrictionsBrowsers require user interaction before audio. Resume AudioServer on first click.

Dependencies

Upstream

SystemDependency TypeInterface
Combat SystemHardEvent signals for SFX triggers
Game State ManagerHardScene transitions for music
Settings SystemSoftVolume preferences

Downstream

None — output only.

Tuning Knobs

KnobDefaultSafe RangeAffects
master_volume1.00.0-1.0Overall volume
music_volume0.70.0-1.0Music loudness
sfx_volume1.00.0-1.0SFX loudness
ui_volume0.80.0-1.0UI sound loudness
crossfade_duration1.0s0.5-3.0sMusic transition smoothness
max_simultaneous_sfx84-16Polyphony limit

Acceptance Criteria

#CriterionVerification
1Card play triggers appropriate SFXAudio test: play Strike, assert sword sound plays
2Music plays per scene and loopsAudio test: enter combat, assert combat music loops
3Music crossfades on scene transitionAudio test: combat → reward, assert smooth transition
4Volume sliders affect correct busesIntegration test: set SFX to 0, assert SFX silent, music audible
5Web export handles audio unlockIntegration test: web build, first click enables audio
Built with LogoFlowershow