// cargo run --example lab
Small things running live in your browser, each one a few dozen lines of Weft and a little Rust. Nothing here is a video.
// 01 · sound × maths
In DSCH, dynamics and durations can ramp through several set points (mf > pp), so the compiler has to interpolate between them. curves is where I checked that maths, and it ended up applying Lagrange interpolation. Here it is beside a B-spline, both evaluated in Rust: watch how they treat the points differently as they drift.
Interpolation
Lagrange passes through every point, but with more points it swings between them. Try eight.
// 02 · sound × languages
J. S. Bach's five-voice Fugue in C♯ minor from Book I of the Well-Tempered Clavier (BWV 849), transcribed into DSCH. Press play: this is the MIDI file the DSCH compiler wrote, rendered on a concert grand. The roll is drawn from the same file by a small MIDI reader in Rust, and the score lights up note by note as it plays.
More about the language on the DSCH page, or download Fugue.mid (9 KB) and play it in anything that speaks MIDI. For the real thing, hear BWV 849 performed.
// 03 · gpu
Weft's eleven fragment-shader presets, behind this whole section. Pick one, recolour it, change its speed. Move the pointer: they follow it.
preset
palette
shader(preset: "synthwave", speed: 0.6)// 04 · data
Two series from the Reserve Bank, by way of DBnomics, joined on their dates. The site fetches them when it builds, and the browser refreshes them through the site's own relay at /api/weft-relay. It's the ausmetrics idea in four lines of template.
More on ausmetrics.