Sound and music
This page is a guide to the games/tbs/src/sound/ folder of the Alchemy
project. It provides the high-level audio controls for Golden Sun: The Broken
Seal and ties together the music rules, custom mixer, and sound assets.
Inside sound.c, sySoundPlay drives every song, jingle, and sound
effect in the game, along with BGM volume ramps and post-jingle fade-backs. From
here, audio work connects to the shared m4a sound driver, Camelot's custom
IWRAM mixer, and the MIDI and WAV sources.
This arrangement is why town music continues to loop without interruption when Isaac steps inside a house, and why a victory fanfare fades back into the field theme. The sections below give the core notes and a complete file map. Sound ID ranges, player slots, and VBlank ducking concepts are explained in Graphics & Sound.
How it works
- ID dispatch and 8 players (
sound.c,include/sounds.h): IDs0–79(MUS_*) loop as BGM, and requesting the active track is a no-op across indoor doors. IDs80–99play as jingles,100+(SE_*) play as SFX, and high sentinels fade out or keep the current BGM. Each sound ID binds to one of 8SongTableplayers: 1 BGM, 1 jingle, and 6 SFX. - Rule-driven music (
field/music_rules.s,field/battle_music.c): Priority-ordered area and flag rules pick music before a scene overlay loads, so Vale's 5 rules cover its whole story arc and every indoor house automatically. Boss fights checkbattle_music.cinstead. - IWRAM mixer and driver split: Reconstructed MusicPlayer2000 (
m4a) routines live incommon/sdk/soundand compile withold_agbcc. Camelot's 352-samples-per-frame IWRAM mixer keeps its inner loopresident_mixer.sinsidesystem/so it shares the-fcall-used-r4register contract.
File map
| Path | Role |
|---|---|
sound.c, stubs.s | sySoundPlay, BGM volume ramps, post-jingle fade-back, and stubs |
sounds.h, sound_driver_symbols.h | MUS_* and SE_* enums, 8-player assignments (SongTable), and reverb definitions |
music_rules.s, battle_music.c | Priority-ordered area and flag music rules and special boss battle themes |
resident_mixer.s, system/channel_update_entry.s | Camelot's custom 352-samples-per-frame IWRAM mixer (-fcall-used-r4) |
common/sdk/sound | Reconstructed MusicPlayer2000 (m4a) routines compiled with old_agbcc (SDK notes) |
sound | MIDI songs (songs/*.mid), 8-bit PCM WAV samples (direct_sound_samples/*.pcm8.wav), voice groups, and song_table.s |
Source files
| File | Description |
|---|---|
sound.c | The game's own sound code over the sound driver: sySoundPlay, which takes every sound number, the music's volume and tempo ramps, the music's return after a jingle, and a sound test nothing in the game names. |
| File | Description |
|---|---|
sound.h | The game's sound over the development kit's sound driver (sdk/sound_driver.h): its state and the sound module's functions. |
sound_driver_symbols.h | The sound driver's command masks, sound controls and the functions and globals it shares with the rest of the game. |
stubs.h | The sound module's stub calls: playing sounds and music, and the driver's update each frame. |