Skip to Content
The Alchemy Project

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): IDs 0–79 (MUS_*) loop as BGM, and requesting the active track is a no-op across indoor doors. IDs 80–99 play as jingles, 100+ (SE_*) play as SFX, and high sentinels fade out or keep the current BGM. Each sound ID binds to one of 8 SongTable players: 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 check battle_music.c instead.
  • IWRAM mixer and driver split: Reconstructed MusicPlayer2000 (m4a) routines live in common/sdk/sound and compile with old_agbcc. Camelot's 352-samples-per-frame IWRAM mixer keeps its inner loop resident_mixer.s inside system/ so it shares the -fcall-used-r4 register contract.

File map

PathRole
sound.c, stubs.ssySoundPlay, BGM volume ramps, post-jingle fade-back, and stubs
sounds.h, sound_driver_symbols.hMUS_* and SE_* enums, 8-player assignments (SongTable), and reverb definitions
music_rules.s, battle_music.cPriority-ordered area and flag music rules and special boss battle themes
resident_mixer.s, system/channel_update_entry.sCamelot's custom 352-samples-per-frame IWRAM mixer (-fcall-used-r4)
common/sdk/soundReconstructed MusicPlayer2000 (m4a) routines compiled with old_agbcc (SDK notes)
soundMIDI songs (songs/*.mid), 8-bit PCM WAV samples (direct_sound_samples/*.pcm8.wav), voice groups, and song_table.s

Source files

src/sound/

FileDescription
sound.cThe 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.

include/sound/

FileDescription
sound.hThe 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.hThe sound driver's command masks, sound controls and the functions and globals it shares with the rest of the game.
stubs.hThe sound module's stub calls: playing sounds and music, and the driver's update each frame.