How Sirenfall works
Sirenfall is a browser scene: a shelter window over a dead city in the rain. Pull the breaker and a siren tower across the blocks spins up. The siren is synthesized live in your browser. It is not a recording.
The scene at full power, during a sheet flash.
The siren
- Mechanical outdoor sirens make their tone by chopping air: a spinning rotor passes ports in a stator, and the pitch is the number of ports times the rotor speed. Sirenfall models that directly. Two port rings on one rotor turning at 103 revolutions per second give two tones, 515 Hz and 618 Hz, a 5:6 ratio.
- 5:6 is a minor third. The UK Home Office chose that interval for air raid sirens in 1940 for its psychological effect, and most dual-tone civil-defense sirens since have kept it.
- Each tone is a pulse train shaped by the chopper duty cycle, mixed with a blower undertone and soft-clipped through a horn equalizer. The spin-up growl and the long coast-down are not separate sound effects; they are what the same model does when the rotor speed ramps.
- The horn rotates at 4 RPM, one sweep every 15 seconds. Every frame, the drawn horn angle sets the audio's directivity gain, an off-axis lowpass, a true Doppler delay, and the stereo position. The siren is loudest and brightest exactly when the horn on the tower faces you.
- The distance knob runs from 150 m to 2.8 km: inverse-distance gain, air absorption as a lowpass, and a three-tap city echo. The blast shutter routes every outside sound through a lowpass that closes with it.
The city
- The skyline is painted once per window size onto an offscreen canvas at up to twice the screen resolution, then reused every frame. Five depth rows dissolve into cold haze. Buildings get floor lines, bays, side faces in perspective, and their damage: burned profiles, collapses, blast holes, boarded glass. One tower is still burning; the smoke rises from it and bends with the wind.
- Weather runs on a slow random walk through calm, building, squall, and passing. Rain speed, density, lean, the fog, the smoke, and the rain bed's gain all follow it. Lightning is mostly sheet flashes inside the low cloud, sometimes a far bolt, rarely a double strike. Thunder arrives late by distance.
- The scene draws at 30 frames per second on one canvas with no framework and no build step.
Controls
- Breaker: powers the siren. Volume, distance, lamp: knobs. Camera: a wall monitor watching the door. Wipe: clears the glass. Shutter: drops the blast shutter and muffles the world.
- Double-click the window, or press F, for fullscreen. On Android, fullscreen also locks landscape.
- Click the wall monitor, or press S, to save a picture of the current frame.
Questions
- Is the siren a recording?
- No. The siren is generated in real time by the Web Audio API in your browser. Two port rings chopped at 103 revolutions per second produce a 5:6 dual tone at 515 and 618 Hz. Nothing about the siren is sampled.
- Which parts are recordings?
- Only the rain and thunder. They are CC0 and Pixabay recordings, credited file by file in the AUDIO-CREDITS document in the source repository. Every console sound is synthesized.
- Is Sirenfall free?
- Yes. No account, no signup, no download, no cookies. Besides audio, the only network request is an anonymous page-count pixel to the author's own service.
- Does it work on phones?
- Yes, in landscape. Portrait shows a rotate prompt. Double-tap the window for fullscreen; on Android that also locks landscape. iOS stops web audio when the screen locks, so keep the screen on.
- What siren is it modeled on?
- An original rotating dual-tone outdoor warning siren in the tradition of mid-century civil-defense units: a minor third between the two tones, a supercharged chopper, and a horn that rotates at 4 RPM. It copies no specific product and uses no recording of one.
- Is the source code available?
- Yes. Sirenfall is one HTML file under the MIT license at github.com/beeswaxpat/sirenfall. The recordings carry their own licenses.
Built by Beeswaxpat. Open the window.