Audio Programming
Sound from code
Audio programming on vintage hardware demanded intimate knowledge of sound chips, precise timing, and clever techniques to achieve musical results.
Overview
Audio programming on 8-bit and 16-bit systems wasn’t about calling playSound()—it meant directly manipulating sound chip registers. Programmers set frequencies, waveforms, and envelopes cycle-by-cycle. The SID chip wanted specific register sequences; the AY-3-8910 had different demands; the NES’s APU another approach entirely. Understanding the hardware was essential.
Fast facts
- Level: direct hardware manipulation.
- Timing: often interrupt-driven, frame-synchronised.
- Chips: SID (C64), AY (Spectrum), Paula (Amiga), APU (NES).
- Techniques: arpeggios, envelopes, driver routines.
- Output: music, sound effects, samples.
Platform approaches
Different hardware, different methods:
- C64 SID: register writes, filter manipulation.
- Spectrum AY: simpler chip, clever envelope tricks.
- Amiga Paula: sample-based, module playback.
- NES APU: pulse, triangle, noise channels.
Common techniques
Audio programming patterns:
- Sound drivers: reusable playback code.
- Interrupt timing: consistent playback speed.
- Arpeggio: fake chords through rapid note switching.
- Volume envelopes: shape note dynamics.