How Beep Boop makes a sound
Beep Boop's kits are not recordings. Every drum hit and every synth note is worked out sample by sample as it plays, in C, on the audio thread, from a few numbers a sound. This is the whole path, from a step to the speaker.
A drum voice
A drum is two sources. A tone, a sine wave that starts high and falls to its own pitch, gives a kick or a tom its body. Noise, through a filter, gives a snare its rattle and a hat its hiss. The noise is a fast pseudo-random sequence, and the filter is a state-variable design that can take the low, the middle or the high of it, held between 40 and 8,000 hertz so that no setting can run it out of bounds. A clap is the same noise struck again, in bursts 10 milliseconds apart.
Each part fades by multiplying itself by one number every sample, so a fade costs one multiplication. A drum sound is the list of those numbers: fifteen of them, twelve for the tone, the noise and their fades, and three more for sounds that move. A kick drum is twelve numbers goes through one of them.
DRUMS turns each voice two ways. TONE moves the filter up to an octave and a half brighter or darker, and the pitch by up to half an octave. DECAY makes the fades a quarter as long, up to four times as long. Both are worked out once, as the hit begins, so the next hit sounds the change. A closed hat cuts off an open one, as on a real kit, with a short fade so that it does not click. A step held to accent is struck 1.35 times as hard.
A synth voice
A synth note is three oscillators summed: two that can each be a sine, a triangle, a saw or a square, and a sine an octave below them. A saw or a square has a hard edge, which on a computer folds back into the sound as harsh tones that were never played. A small correction at each edge, PolyBLEP, takes them out.
The sum goes through a low-pass filter with resonance, built so that it stays stable at any setting, and that filter opens and closes on an envelope of its own. Then the note's envelope shapes its loudness: attack, decay, sustain and release. On an accented note the sound is driven into the filter a little harder, so it brightens as well as gets louder.
Each note is tuned a hair off, at random by up to 3 cents either way, so that a chord breathes instead of standing still. SYNTH sounds up to eight notes at once, and each of the twelve pads has a voice of its own. On SYNTH, TONE moves the filter up to three octaves either way, DECAY scales the envelopes from a quarter to four times, and GLIDE slides one note into the next over up to a quarter of a second.
TEAR
SOUNDS has one knob that takes a sound from clean to destroyed. It is five processes laid along one number, each fading in over its own part of the turn.
The fold bends the wave back on itself, so a sine grows edges. The bits cut its resolution until a quiet tail falls to nothing. The hold repeats each sample for longer, so the sound loses its top. The ring multiplies it by a second tone, which makes it metallic. At the top, fragments of the last 40 milliseconds are frozen and repeated, with holes in them. Each voice carries its own 2,048 samples of memory for that, set aside before it plays, so tearing a sound allocates nothing.
At 0 TEAR is not run at all. A sound with no tear plays sample for sample as it did before TEAR existed, which a test holds the engine to.
The mix
Every drum voice is multiplied by its own level and its mix level. SYNTH, the pads and the loop are added. The sum is turned down 2 dB and passes one soft clip, a curve that rounds a peak instead of cutting it, with a ceiling 1 dB under full scale. Nothing leaves the engine louder than that.
The 2 dB was measured. At full level the first beat drove the clip to 2.6 times full scale and rounded off 14.6 percent of its samples by more than 1 dB. At 2 dB down that is 7.0 percent, and every kick keeps about 1 dB more front.
What it costs
With every voice playing at once, eight drums on every step, eight synth notes and twelve pads, the engine used 3.38 percent of real time on a Mac, and 4.80 percent with every one of them torn at full. That is a measurement on a Mac. The same number on a phone is still owed, and so is a run of every voice at once on the phone itself.
Sources
- The drum voice, its fifteen numbers, TONE, DECAY, the choke and the accent: the engine's C source and its kit, read from 1.0.4, 26 October 2026.
- The synth voice, its oscillators, filter, drift, voices and knobs: the engine's synth source, the same build.
- TEAR's five stages, their spans and its memory: TEAR's own header, the same build.
- The trim, the soft clip and the ceiling, and the measured 14.6 and 7.0 percent: the engine's mix and the headroom study of 11 October 2026.
- The cost, 3.38 and 4.80 percent: the engine's timing notes for build 643, a release build on a Mac.
More sheets
- An instrument in SwiftUIOne accent, a key lit from inside, nothing unneeded.
- Every note in keyEight rows, one scale, no wrong notes.
- A kick drum is twelve numbersHow a drum machine's kit is built.
- The audio thread never waitsNo allocation, no lock, one queue.
- PatternsDrum patterns drawn on sixteen steps.
- Tempo by genreBPM for twelve genres, on one scale.