Skip to content

Doppler Siren

A siren moving through the dark, its sound rings bunching up and turning blue ahead of it and stretching out red behind. Loops perfectly.

Background, V1 Effects3DSeamless loop, verified257 lines of codev1.0.0

In Science & maths, Music & sound, Light, glass & shine

Next: Bass PulseSurprise me

Doppler Siren preview
Starting live preview…
00:00:00:00 / 00:00:00:01

Live, running the real source at reduced resolution.

Your current settings go with it. Combine several clips and hand them over together from your sequence.

Effect controls

Presets

0.6

The siren's speed over the speed of the waves; above 1 the rings pile into a shock cone.

32
0.012
1
0.45

The preview runs the same code your AI receives. These settings travel with the hand-off.

Info

What it is

The Doppler effect made visible. A siren moves along a closed path and sends out a ring of sound at regular moments; every ring keeps its own centre, where the siren was when it left, so the rings crowd together and turn blue ahead of the siren and stretch apart and turn red behind it. Make the siren faster than the sound and the rings pile up into a shock cone. Choose the siren's speed against the sound, the number of rings, the path (circle, sweep or figure eight), the colours, the line thickness, the brightness and the size of the path.

Reuse it in your own idea

  • Physics explainer: Circling siren.
  • Sonic boom: Shock cone, sweep.
  • Nightclub backdrop: Neon figure eight.

Which part is reusable

src/doppler-siren.js is the ingredient your AI reuses. demo.js is only the example scene around it, and uses the demo harness only for the demo.

Good to know

  • Rings are drawn as lines, not as a physical pressure field; intensity does not fall off with distance as it would in air.
  • Above Mach 1 the shock cone appears only as the envelope of the rings.

Technical details

Technical details
Implementation
Three.js 0.185.1 (WebGL) · ES module src/doppler-siren.js
Exports
  • createDopplerSiren({ mach?, waves?, path?, palette?, thickness?, brightness?, radius? }) => { scene, camera, setSize(width, height), update(time, loopSeconds), dispose() }
  • createBloomPass(renderer, { width, height, glow?, exposure?, grain? }) => { render(scene, camera, output?), dispose() }
  • PALETTES: { classic, neon, gold, mono }
Dependencies (exact)
  • three@0.185.1 (source) — Renderer and a full-screen shader material.
  • apw-runtime@1.0.0 (demo) — Demo harness.
How it fits a scene

Coordinates: Screen-centred, ±1 vertically; the siren moves on a path of the chosen radius around the origin; a ring's radius is the wave speed times its age.

Lighting: Self-lit lines; the bloom provides the glow.

Timing: update(time, loopSeconds) sets the loop phase; frames render in any order.

Output
1080×1080, 30 fps, 10 s · procedural (computed from the frame number) · seamless loop — The siren's path repeats every loop and each ring's centre, radius and fade are functions of its age since it left, with rings born at fixed moments of the loop, so the last frame meets the first.
Tested
Rendered 300 frames on 2026-10-06 in Chrome 154.0.8037.97 headless on Linux 7.0.0-38-generic (x64), Node 22.14.0 (WebGL 2 via SwiftShader (software)). Same frame twice from fresh pages: identical. Loop: Frame 0 vs end state (progress 1): mean |Δ| 0.0000, max |Δ| 0 of 255.
Performance
One full-screen fragment shader looping over up to 44 rings, plus the bloom: about 3 ms a frame at 1080² on an integrated Intel GPU. Software WebGL renders in about a second a frame.
Export a video yourself
Download the source, then in the folder: npm install npm run render -- doppler-siren/1.0.0 --out my-video.mp4Needs Node 18+, ffmpeg and Chrome/Chromium. Add --params my-settings.json (from Copy settings) for your own settings.
Version
1.0.0 · sha256:dd591cfa52462ecd…
Files
License
MIT. Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder. License details
Provenance
Adapted from the owner's threejs-sketches/physics-forces/doppler-siren (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original shader: rings born at fixed moments along a periodic siren path, each with its own centre, tinted by the direction of travel, with an exact loop.
BinMore like this

Bass Pulse

Background3DSeamless loop8 seconds

Piano Keys

3D object3DSeamless loop16 seconds