Sound is off until a visitor turns it on, and the toggle remembers. With it on, the things that already move make a sound when they land: a stamp thumps, a hit key pops, a caused SFX goes pow, the pile knocks wood and booms for more blocks, the page wipe flips. Nothing makes a sound on its own, and a first visit plays nothing at all (no gesture has unlocked audio yet).
Every voice#
knockBlocks hitting each other in the pile, each seat of TIDY, the 404's dominoes.stampA stamp landing: the THUNK at its thump.popThe hit key's KeyPop; an SFX caused by an arrival.powAn SFX caused by an impact: POW!, KRAK!, ZAP!boomMORE BLOCKS dropping onto the pile.flipThe page wipe.printTIDY done; the press run's own voice (it stays silent on a first visit).
When it plays#
- Off by default (D-H4). The
SoundTogglesetsdata-mk-soundand remembers it inlocalStorage; the engine opens its audio context inside that click. - The volume sets the gain: Quiet mutes, Studio plays at 0.7, Press and Rave at 1.
- Reduced motion does not mute. Sound is not motion.
- Polite: at most six voices at once; knocks keep a per-block cooldown and at most five per 120 ms, and a fast scrub of the pile plays only its two loudest knocks; a hidden tab suspends the context.
- Tiny: the engine and every voice are 4 KB gzipped; only the four wood knocks are files (under 5 KB together, CC0); every other voice is synthesised.
The bus#
Moments dispatch mk:sfx on the document with what happened, and the engine picks the voice; a voice in the event wins (the page wipe sends flip). Only the pile calls the engine itself, for its knocks, the print when TIDY is done and the boom of MORE BLOCKS.
| Kind | Voice | Sent by |
|---|---|---|
stamp | stamp | a stamp's thump |
impact | pow | an SFX with cause="impact" |
press | pop | KeyPop, the page wipe (with voice: "flip") |
arrive | pop | an SFX with cause="arrive" |
import { dispatchSfx } from "@maxgrits/overprint-react/motion";
dispatchSfx({ word: "THUNK!", kind: "stamp" });import { SoundToggle } from "@maxgrits/overprint-react/sound";
<SoundToggle appearance="labelled" />