// Steps: an 8-step sequencer – arrays of knobs, buttons and LEDs, a runtime index and a loop. module steps "Steps" hp 16 { desc de "8-Schritt-Sequencer: Jeder Takt geht einen Schritt weiter, Taster schalten Schritte stumm, LEN kürzt die Folge, RST beginnt von vorn." desc en "8-step sequencer: every clock moves one step on, buttons mute steps, LEN shortens the sequence, RST starts over." const N = 8 // Arrays: pitch1 … pitch8, on1 … on8, l1 … l8 – "#" in a label becomes the step number, "at … step" spaces them. knob pitch[N] "#" -2..2 = [0, 0.25, 0.583, 0.25, 1, 0.583, 0.333, 0.75] unit v size s at 8 30 step 9.3 0 button on[N] "" = on at 8 44 step 9.3 0 led l[N] green at 8 52 step 9.3 0 knob len "LEN" 1..N = N int at 40.5 70 in clk "CLK" gate at 14 100 in rst "RST" gate at 28 100 out cv "CV" pitch at 53 100 out g "GATE" gate at 67 100 state n = 0 // current step (0 = step 1) state armed = false // the first clock after start or RST plays step 1 process { t = rise(clk) if rise(rst) { n = 0 armed = false } else if t { if armed { n = (n + 1) % len } else { armed = true } } cv = pitch[n] // index at run time g = gate(high(clk) and on[n]) for i in 0..N { l[i] = n == i } // unrolled: eight assignments } }