Paper Mario’s audio system drives background music, sound effects, ambient loops, and music events. The implementation is split across several files underDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/pmret/papermario/llms.txt
Use this file to discover all available pages before exploring further.
src/audio/, with a public C API in src/audio/public.h and an EVT scripting layer in src/evt/audio_api.c. Understanding the system is useful any time you work on a map, battle, or cutscene that needs sound.
Subsystem structure
| Source file | Responsibility |
|---|---|
src/audio/snd_interface.c | Low-level sound driver interface — start/stop/adjust individual sounds |
src/audio/bgm_control.c | BGM player management, song loading, proximity mixing |
src/audio/bgm_player.c | BGM playback and sequencer update |
src/audio/sfx_control.c | Sound effect spatialization, looping sound tracking |
src/audio/sfx_player.c | SFX playback dispatch |
src/audio/mseq_player.c | MSEQ (music sequence) player |
src/audio/ambience.c | Ambient sound loop management |
src/audio/load_banks.c | Sound bank DMA loading |
src/audio/core/ | Core audio engine (AU library) |
src/evt/audio_api.c | EVT-callable wrappers for all audio functions |
BGM players
The game maintains multiple simultaneous BGM player slots. Each slot can load and play an independent song.bgm_set_song is the primary entry point:
playerIndex— which BGM player slot to use (0 is the main music player)songID— theAU_SONG_*constant identifying the trackvariation— selects an alternate arrangement (0 or 1); eachMapConfigstores asongVariationfieldfadeOutTime— milliseconds to fade out the current track before switchingvolume— target volume level
bgm_push_song / bgm_pop_song, which is used for short jingles (e.g. item get, level up) that play over the map music and then restore it.
Sound effects
SFX are managed through two layers. The low-level layer insnd_interface.c sends commands directly to the audio engine:
sfx_control.c adds spatialization and looping support:
sfxReverb field in MapConfig sets the reverb type for the current room, applied via sfx_set_reverb_mode.
Ambient sounds
Ambient loops (wind, forest, water, etc.) are loaded and played throughsrc/audio/ambience.c:
Music event framework
The music event system allows BGM sequences to trigger EVT scripts at specific points in a song. This is used for synchronising gameplay events to the music. AMusicEvent struct maps an event ID to an array of EVT script pointers. You register a table of events from an EVT script using RegisterMusicEvents. The PollMusicEvents callable (called internally) reads events from the audio engine and launches the matching script:
PollMusicEvents every frame, which calls snd_song_poll_music_events to retrieve pending events from the audio driver and fires the corresponding EVT script.
The
PollMusicEvents implementation in src/evt/audio_api.c contains a documented potential bug: the nullptr check on cur may always succeed even when the event ID was not found in the table, because cur can never become nullptr when walking a sentinel-terminated list.EVT audio scripting API
All audio functions are accessible from EVT scripts through callables insrc/evt/audio_api.c.
Music control callables
Music control callables
BGM mixing and proximity
BGM mixing and proximity
Sound effect callables
Sound effect callables
Ambient sound callables
Ambient sound callables
Door and room sound callables
Door and room sound callables
Music event callables
Music event callables
Volume and global settings
Global BGM and SFX volume levels are controlled through:Battle system
Battle scripts use PlaySoundAtActor and PlaySoundAtPart for attack sounds.
World and map system
See how MapConfig carries songVariation and sfxReverb fields used by the audio system.
