All examples · Audio · As Markdown, for AIs

Sound made in code

What this example shows

useSound({ samples, sampleRate }) plays sound the game made itself. Here it is the idle of a two-stroke engine, a buzzy pulse with a little noise, made once and looped.

Revving does not make new sound: it plays the same loop faster with setRate, which raises the pitch the way an engine does. The browser only allows sound after the player presses something, so it starts on the first key or click.

Starting
Starting
—