Skip to content

Give Each Section Its Own Visuals

A section has a visual lane, section[screen], beside its track lanes. A section with no screen write shows black. The Visual Graph explains what a visual is.

use "std/visuals" as gfx;
let verse = section(8);
verse[screen] << gfx.Noise("field");
let chorus = verse.clone();
chorus[screen] << (gfx.Noise("grain") >> gfx.Blur("haze"));
let song = arrange(#[verse, chorus]);

Open the window with screen.show_window() before song.play().

Playing the song builds every section’s visuals up front, so a cut between sections is instant and lands on its frame. An operator with the same name in two sections is one operator: a feedback trail carries across the cut. If any section’s shader fails to compile, the song’s visuals don’t take — the picture already on screen stays, and the error is shown.

Write to a position on the song’s screen lane, on a layer of its own:

song[screen].layer("hits").at(14, 2) << gfx.Edge("edges");
show(song);
section — 16 cycles
screen layers: base, hits
0..8 field (Noise) base
8..14 haze (Blur) base
14..16 edges (Edge) hits