A 48K Spectrum has no sound chip. It has one bit: bit 4 of a single output port, wired to the loudspeaker, and writing to it moves the cone to one of two positions. That is the whole of the audio hardware.
What is missing
No digital-to-analogue converter. No envelope generator. No waveform table, no channels, no volume control. The C64 of the same period had a three-voice synthesiser with filters; the Spectrum has a bit you can set or clear.
How it makes a note
By moving the cone back and forth at the right rate. Push, pull, push, pull, evenly enough and fast enough, and the air carries a tone.
The rate is the note. Middle C is 261.63 Hz, so the speaker has to change position 523 times a second — once every 6,689 T-states on the clock from unit 2. Ask the ROM’s BEEP routine for middle C and it lands within three T-states of that: its writes to the speaker arrive 6,686 to 6,688 T-states apart.
The processor is the sound chip
A sound chip takes a note and holds it while the processor gets on with something else. There is nothing here to hand a note to, which means the processor has to be present at every toggle: 523 times a second for one middle C, counted out in T-states.
The ROM’s beeper routine turns interrupts off before it starts, because an interrupt arriving mid-note would delay a toggle and bend the pitch.
So on a stock Spectrum, sound is not something happening alongside a program. It is something the program stops to do. BEEP in BASIC freezes everything until the note ends, and that is not sloppiness — there is nothing else it could do.
What people got out of it anyway
That should have been the end of it.
If the processor has to be present at every toggle, it can decide what to do at each one. Interleave toggles for two notes and two notes are what you hear. Vary the proportion of time spent high against low and you get something the ear reads as volume. Beeper engines — Octode, Stocker and their relatives — pulled multiple channels, percussion and recognisable timbres out of a bit that is only ever on or off.
There is also slightly more hardware there than “one bit” implies. The speaker bit and the cassette output bit share a pin through a voltage divider, so between them they produce four distinct voltages rather than two. Two of them sit below the point at which the speaker moves at all. The other two sit above it, close together, so with the speaker bit set, the cassette bit nudges the level a little. A program driving both bits has a small extra step to work with.
None of it was free. A game playing that kind of music is spending most of its processor on it.
What to take from this
Spectrum sound is the direct consequence of leaving sound hardware out. Everything anyone got from it was the processor being in the right place at the right moment, paid for out of the frame budget.
Sources
Sinclair Research, ZX Spectrum BASIC Programming, chapter 23, IN and OUT: port 254 drives the loudspeaker from bit 4 and the MIC socket from bit 3; chapter 19, BEEP. Chris Smith, The ZX Spectrum ULA: How to Design a Microcomputer (ZX Design and Media), chapter 20, pp. 218–222: the speaker and cassette bits switching one voltage divider to four measured levels (Table 20-2), and the loudspeaker diodes that only pass the upper two. The BEEP timings were measured in Emu198x with the official 48K ROM, running BEEP 1,0 and timing successive OUT instructions in the ROM’s beeper routine at $03B5, which begins with DI.