"make it sound like a game." The SNES has a whole second processor for sound — the SPC700, with its own 64 KB of RAM, its own S-DSP, and its own instruction set, talking to the main CPU through just 4 I/O bytes. This family has two on-ramps — tracker music, and driving the DSP straight from C — then the DSP's party tricks.
Tracker music (SNESMOD) — compose in a tracker, opensnes-music converts the .it, the lib plays it:
| Example | Developer question |
|---|---|
| snesmod_music | How do I play tracker music with transport controls, and mix sound effects over it? |
| sfx_from_wav | How do I play a sound effect from a WAV file, converted by the build? |
| sfx_voices | How do I drive effects voice by voice: a looped waveform at a pitch set every frame, a stop and play on one voice in one frame, a sample sent in pieces? |
| sample_swap | How do I keep some samples resident and replace others during play, at places I choose, without a click? |
Raw APU from C (audio v2) — the lib uploads its own resident SPC700 driver; everything else is plain C:
| Example | Developer question |
|---|---|
| soundboard | How do I drive the whole audio-v2 engine from C — samples, envelopes, echo? |
| apu_switch | How do I write S-DSP programs of my own — noise drums, hardware vibrato — and hot-swap them at runtime? |
| speech_synth | How do I play BRR speech? |
Sound is a co-processor problem: you never touch the DSP registers from the 65816 directly — you hand a driver a command over the 4 I/O ports and it runs on the SPC700. SNESMOD's driver plays a compiled tracker module; the audio-v2 driver exposes voices, ADSR, BRR samples and the echo unit as C calls (audioLoadSample, audioPlaySampleEx, audioSetEcho…). Both share the same 64 KB of ARAM, so samples, the echo ring and the driver all compete for it.
(Audio examples have no screenshot — the lesson is audible. Run them with sound.)
apu_switch — two S-DSP programs, swapped at runtime Sample swap SFX from WAV SFX voices SNESMOD Music and Sound Effects soundboard — the audio v2 engine, driven entirely from C speech_synth — the SNES says "OPEN SNES… DAVEO"