dmscene Demos & source

LIGHTWALL

lightwall.dmt · 100 BPM · 30 s · 960×600

feedbackretro

notes

Three light cycles ride the grid on 16th notes and leave walls of light behind them, kept alive in the feedback buffer and re-projected through a moving camera.

musicTron: slow heavy kick, 8th-note grid pulse, unison brass, driven 16th arp, PWM lead, long reverb
visualtop-down arena: three light cycles ride one grid cell per 16th, turn at cell boundaries, leave walls that persist in the feedback buffer re-projected through the moving camera; arena resets every 8 bars
filelightwall.dmt
duration0:30
video960×600 · 30 fps · h264 + audio · 2.6 MB
song100 BPM · speed 6 · rpb 4 · 7 channels
loop0
renderscale 1 · master 0.6
uniformscamx camy zoom pcamx pcamy pzoom reset flash kickE snE arpE
collectionDemos
tagsfeedbackretro
source326 lines · 13 KB · download

anatomy

10VM programs
5patterns
0palettes
0timeline events
0text / sample / texture
326source lines
7inst
0chan
1master
1frame
1pixel
0post
1fn

line composition

frame 36%pattern 30%inst 15%pixel 13%master 2%fn 2%uniform 1%title 0%song 0%order 0%

play order

001122334233

order list · 12 entries

timeline

This demo has no timeline events; it is driven by the tracker clock and per-frame programs.

resources

No external text, samples, textures or envelopes.

source

download .dmt
1# @description Three light cycles ride the grid on 16th notes and leave walls of light behind them, kept alive in the feedback buffer and re-projected through a moving camera.
2# @tags retro, feedback
3# @collection Demos
4# @music Tron: slow heavy kick, 8th-note grid pulse, unison brass, driven 16th arp, PWM lead, long reverb
5# @visual top-down arena: three light cycles ride one grid cell per 16th, turn at cell boundaries, leave walls that persist in the feedback buffer re-projected through the moving camera; arena resets every 8 bars
6# lightwall.dmt - Tron. Three light cycles ride the grid on 16th notes and leave walls of light behind them.
7# The walls persist in the feedback buffer, re-projected through the moving camera every frame.
8title LIGHTWALL
9song bpm=100 speed=6 rpb=4 channels=7 loop=0 volume=0.6
10order 0 0 1 1 2 2 3 3 4 2 3 3
12inst kick {
13 f = 42 + 320 * exp(-t * 22)
14 $p = $p + f / sr
15 out(dist(sin($p * tau) * exp(-t * 4) * 2, 1.6) * 0.85)
17inst snare {
18 n = svf(noise(), 1800 + 2500 * exp(-t * 18), 0.35)
19 n = n + r1 * 0.7
20 out((n * exp(-t * 9) + sin(tau * 160 * t) * exp(-t * 28) * 0.6) * 0.55)
22inst hat {
23 out(hp(noise(), 8000) * exp(-t * (55 - 25 * vel)) * 0.18)
25inst pulse {
26 # the grid pulse: 8th-note sub pluck
27 e = env(0.002, 0.16, 0.0, 0.05)
28 s = sqr(ph, 0.5) * 0.5 + sin(ph * tau) * 0.8 + sin(ph * tau * 2) * 0.2 * e
29 s = svf(s, 180 + 900 * e, 0.3)
30 out(s * e * 0.6)
32inst brass {
33 # massive unison brass, slow swell, bandpass bite
34 e = env(0.09, 0.5, 0.8, 0.35)
35 f = freq * (1 + 0.003 * sin(t * 5) * min(t, 1))
36 s = usaw(f, 0.22) + usaw(f * 0.5, 0.14) * 0.6
37 s = svf(s, 350 + 1400 * e + 600 * p0, 0.3)
38 s = s + r2 * 0.8
39 out(dist(s * 0.6, 1.3) * e * 0.3)
41inst arp {
42 # derezzed: driven saw, chopped
43 e = env(0.001, 0.12, 0.0, 0.04)
44 s = saw(ph) + saw(ph * 1.005) + sqr(ph * 0.5, 0.5) * 0.4
45 s = dist(s * 2, 2.5)
46 s = svf(s, 500 + 3000 * e * (0.5 + p0), 0.45)
47 out(s * e * 0.3)
49inst lead {
50 e = env(0.05, 0.4, 0.75, 0.5)
51 vib = 1 + 0.005 * sin(t * 5) * min(t * 1.5, 1)
52 f = freq * vib
53 $p = $p + f / sr
54 s = sqr($p, 0.5 + 0.3 * sin(t * 1.5)) + saw($p * 2 + 0.2) * 0.3 + sqr($p * 0.5, 0.5) * 0.4
55 s = svf(s, 700 + 2200 * e, 0.3)
56 out(dist(s, 1.2) * e * 0.28)
59master {
60 wl = verb(l, 0.86, 0.35)
61 wr = verb(r, 0.86, 0.35)
62 dl = dly(l, 0.45, 0.35)
63 dr = dly(r, 0.3, 0.35)
64 out(dist(l + wl * 0.35 + dr * 0.15, 1.15), dist(r + wr * 0.35 + dl * 0.15, 1.15))
67# channels: 0 kick 1 snare/hat 2 pulse 3 brass low 4 brass high 5 arp 6 lead
68pattern 0 rows=16 {
69 # the grid: pulses and a low brass drone
70 . | . | C-2 4 36 | C-2 5 30 S00 | . | . | .
71 . | . | . | . | . | . | .
72 . | . | C-2 4 30 | . | . | . | .
73 . | . | . | . | . | . | .
74 . | . | C-2 4 36 | . | . | . | .
75 . | . | . | . | . | . | .
76 . | . | C-2 4 30 | . | . | . | .
77 . | . | . | . | . | . | .
78 . | . | C-2 4 36 | . | . | . | .
79 . | . | . | . | . | . | .
80 . | . | C-2 4 30 | . | . | . | .
81 . | . | . | . | . | . | .
82 . | . | C-2 4 36 | . | . | . | .
83 . | . | . | . | . | . | .
84 . | . | G-1 4 30 | . | . | . | .
85 . | . | . | . | . | . | .
87pattern 1 rows=16 {
88 # drums, brass chord Cm
89 C-2 1 40 | . | C-2 4 36 | C-2 5 34 S40 | G-2 5 28 | . | .
90 . | . | . | . | . | . | .
91 . | C-6 3 22 | C-2 4 30 | . | . | . | .
92 . | . | . | . | . | . | .
93 . | D-5 2 38 | C-2 4 36 | . | . | . | .
94 . | . | . | . | . | . | .
95 . | C-6 3 22 | C-2 4 30 | . | . | . | .
96 . | . | . | . | . | . | .
97 C-2 1 40 | . | C-2 4 36 | . | . | . | .
98 . | . | . | . | . | . | .
99 . | C-6 3 22 | C-2 4 30 | . | . | . | .
100 . | . | . | . | . | . | .
101 . | D-5 2 38 | C-2 4 36 | . | . | . | .
102 . | . | . | . | . | . | .
103 . | C-6 3 22 | G-1 4 30 | . | . | . | .
104 . | . | . | . | . | . | .
106pattern 2 rows=16 {
107 # arp in: Cm -> Ab
108 C-2 1 40 | . | C-2 4 36 | C-2 5 34 S70 | G-2 5 28 | C-4 6 32 S40 | .
109 . | . | . | . | . | D#4 6 26 | .
110 . | C-6 3 22 | C-2 4 30 | . | . | G-4 6 30 | .
111 . | . | . | . | . | C-5 6 26 | .
112 . | D-5 2 38 | C-2 4 36 | . | . | G-4 6 30 | .
113 . | . | . | . | . | D#4 6 26 | .
114 . | C-6 3 22 | C-2 4 30 | . | . | C-4 6 30 | .
115 . | . | . | . | . | D#4 6 26 | .
116 C-2 1 40 | . | G#1 4 36 | G#1 5 34 | D#2 5 28 | G#3 6 32 | .
117 . | . | . | . | . | C-4 6 26 | .
118 . | C-6 3 22 | G#1 4 30 | . | . | D#4 6 30 | .
119 . | . | . | . | . | G#4 6 26 | .
120 . | D-5 2 38 | G#1 4 36 | . | . | D#4 6 30 | .
121 . | . | . | . | . | C-4 6 26 | .
122 . | C-6 3 22 | G#1 4 30 | . | . | G#3 6 30 | .
123 . | C-6 3 16 | . | . | . | C-4 6 26 | .
125pattern 3 rows=16 {
126 # lead over Fm -> G
127 C-2 1 40 | . | F-1 4 36 | F-1 5 34 SA0 | C-2 5 28 | F-3 6 32 S80 | C-5 7 32
128 . | . | . | . | . | G#3 6 26 | .
129 . | C-6 3 22 | F-1 4 30 | . | . | C-4 6 30 | .
130 . | . | . | . | . | F-4 6 26 | .
131 . | D-5 2 38 | F-1 4 36 | . | . | C-4 6 30 | D#5 7 30
132 . | . | . | . | . | G#3 6 26 | .
133 . | C-6 3 22 | F-1 4 30 | . | . | F-3 6 30 | .
134 . | . | . | . | . | G#3 6 26 | D-5 7 30
135 C-2 1 40 | . | G-1 4 36 | G-1 5 34 | D-2 5 28 | G-3 6 32 | .
136 . | . | . | . | . | B-3 6 26 | .
137 . | C-6 3 22 | G-1 4 30 | . | . | D-4 6 30 | C-5 7 30
138 . | . | . | . | . | G-4 6 26 | .
139 . | D-5 2 38 | G-1 4 36 | . | . | D-4 6 30 | G-4 7 28
140 . | . | . | . | . | B-3 6 26 | .
141 . | C-6 3 22 | G-1 4 30 | . | . | G-3 6 30 | .
142 . | D-5 2 24 | . | . | . | B-3 6 26 | B-4 7 30 44A
144pattern 4 rows=16 {
145 # break: drums out, brass swells, arp runs on
146 . | . | C-2 4 30 | C-2 5 38 SFF | G-2 5 32 | C-4 6 28 SC0 | C-5 7 30
147 . | . | . | . | . | D#4 6 24 | .
148 . | . | . | . | . | G-4 6 28 | .
149 . | . | . | . | . | C-5 6 24 | .
150 . | . | C-2 4 30 | . | . | G-4 6 28 | .
151 . | . | . | . | . | D#4 6 24 | .
152 . | . | . | . | . | C-4 6 28 | .
153 . | . | . | . | . | D#4 6 24 | .
154 . | . | G#1 4 30 | G#1 5 38 | D#2 5 32 | G#3 6 28 | G#4 7 30
155 . | . | . | . | . | C-4 6 24 | .
156 . | . | . | . | . | D#4 6 28 | .
157 . | . | . | . | . | G#4 6 24 | .
158 . | . | G#1 4 30 | . | . | D#4 6 28 | .
159 . | . | . | . | . | C-4 6 24 | .
160 . | . | . | . | . | G#3 6 28 | .
161 . | . | . | . | . | C-4 6 24 | off
164fn segd(px, py, ax, ay, bx, by) {
165 dx = bx - ax
166 dy = by - ay
167 tt = clamp(((px - ax) * dx + (py - ay) * dy) / max(dx * dx + dy * dy, 0.000001), 0, 1)
168 return len(px - ax - dx * tt, py - ay - dy * tt)
171uniform camx camy zoom pcamx pcamy pzoom reset flash kickE snE arpE
172uniform b1x b1y b1px b1py b2x b2y b2px b2py b3x b3y b3px b3py
174frame {
175 kickE = exp(-trig(0) * 6)
176 snE = exp(-trig(1) * 8) * step(0.5, vel(1))
177 arpE = exp(-trig(5) * 10)
178 # camera: publish last frame's transform so the pixel program can re-project the wall buffer
179 pcamx = camx
180 pcamy = camy
181 pzoom = zoom
182 camx = 0.25 * sin(beat * 0.07)
183 camy = 0.18 * cos(beat * 0.05)
184 zoom = 0.88 + 0.06 * sin(beat * 0.11) + 0.04 * kickE
185 # arena reset every 8 bars: walls flash and vanish
186 rb = floor(bar / 8)
187 flash = step(0.5, abs(rb - $rb)) # frame 1: walls erased, screen flashes
188 reset = max(flash, $pf) # frame 2: the flash itself is erased
189 $pf = flash
190 $rb = rb
191 # bikes advance one cell per 16th note; decide turns at cell boundaries
192 n = floor(beat * 4)
193 f = fract(beat * 4)
194 stepn = step(0.5, abs(n - $n))
195 $n = n
196 # --- bike 1
197 $x1 = $x1 + $dx1 * stepn
198 $y1 = $y1 + $dy1 * stepn
199 init = 1 - step(0.5, $i1)
200 $dx1 = mix($dx1, 1, init)
201 $x1 = mix($x1, -8, init)
202 $y1 = mix($y1, -4, init)
203 $i1 = 1
204 ax1 = $x1 + $dx1 * 2
205 ay1 = $y1 + $dy1 * 2
206 oob = max(step(11.5, abs(ax1)), step(7.5, abs(ay1)))
207 r = hash(n * 1.31 + 7.7)
208 want = max(step(r, 0.16), oob) * stepn
209 lx = -$dy1
210 ly = $dx1
211 rx = $dy1
212 ry = -$dx1
213 toL = lx * -$x1 + ly * -$y1
214 toR = rx * -$x1 + ry * -$y1
215 goL = mix(step(0.5, hash(n * 2.17 + 1.1)), step(toR, toL), oob)
216 ndx = mix(rx, lx, goL)
217 ndy = mix(ry, ly, goL)
218 $dx1 = mix($dx1, ndx, want)
219 $dy1 = mix($dy1, ndy, want)
220 b1px = b1x
221 b1py = b1y
222 b1x = ($x1 + $dx1 * f) * 0.12
223 b1y = ($y1 + $dy1 * f) * 0.12
224 b1px = mix(b1px, b1x, init)
225 b1py = mix(b1py, b1y, init)
226 # --- bike 2
227 $x2 = $x2 + $dx2 * stepn
228 $y2 = $y2 + $dy2 * stepn
229 init = 1 - step(0.5, $i2)
230 $dx2 = mix($dx2, -1, init)
231 $x2 = mix($x2, 8, init)
232 $y2 = mix($y2, 4, init)
233 $i2 = 1
234 ax1 = $x2 + $dx2 * 2
235 ay1 = $y2 + $dy2 * 2
236 oob = max(step(11.5, abs(ax1)), step(7.5, abs(ay1)))
237 r = hash(n * 1.71 + 3.3)
238 want = max(step(r, 0.16), oob) * stepn
239 lx = -$dy2
240 ly = $dx2
241 rx = $dy2
242 ry = -$dx2
243 toL = lx * -$x2 + ly * -$y2
244 toR = rx * -$x2 + ry * -$y2
245 goL = mix(step(0.5, hash(n * 2.71 + 5.1)), step(toR, toL), oob)
246 ndx = mix(rx, lx, goL)
247 ndy = mix(ry, ly, goL)
248 $dx2 = mix($dx2, ndx, want)
249 $dy2 = mix($dy2, ndy, want)
250 b2px = b2x
251 b2py = b2y
252 b2x = ($x2 + $dx2 * f) * 0.12
253 b2y = ($y2 + $dy2 * f) * 0.12
254 b2px = mix(b2px, b2x, init)
255 b2py = mix(b2py, b2y, init)
256 # --- bike 3
257 $x3 = $x3 + $dx3 * stepn
258 $y3 = $y3 + $dy3 * stepn
259 init = 1 - step(0.5, $i3)
260 $dy3 = mix($dy3, 1, init)
261 $x3 = mix($x3, 0, init)
262 $y3 = mix($y3, -6, init)
263 $i3 = 1
264 ax1 = $x3 + $dx3 * 2
265 ay1 = $y3 + $dy3 * 2
266 oob = max(step(11.5, abs(ax1)), step(7.5, abs(ay1)))
267 r = hash(n * 1.13 + 9.9)
268 want = max(step(r, 0.16), oob) * stepn
269 lx = -$dy3
270 ly = $dx3
271 rx = $dy3
272 ry = -$dx3
273 toL = lx * -$x3 + ly * -$y3
274 toR = rx * -$x3 + ry * -$y3
275 goL = mix(step(0.5, hash(n * 3.37 + 2.2)), step(toR, toL), oob)
276 ndx = mix(rx, lx, goL)
277 ndy = mix(ry, ly, goL)
278 $dx3 = mix($dx3, ndx, want)
279 $dy3 = mix($dy3, ndy, want)
280 b3px = b3x
281 b3py = b3y
282 b3x = ($x3 + $dx3 * f) * 0.12
283 b3y = ($y3 + $dy3 * f) * 0.12
284 b3px = mix(b3px, b3x, init)
285 b3py = mix(b3py, b3y, init)
287pixel {
288 tiltk = 0.72 # 3/4 view: squash world y
289 wx = camx + u / zoom
290 wy = camy + v / (zoom * tiltk)
291 # floor: faint grid in world space, arena border
292 gx = abs(fract(wx / 0.12 + 0.5) - 0.5) * 0.12
293 gy = abs(fract(wy / 0.12 + 0.5) - 0.5) * 0.12
294 grid = exp(-min(gx, gy) * 400) * 0.18
295 bx = max(abs(wx) - 1.44, abs(wy) - 0.96)
296 border = exp(-abs(bx) * 60) * (0.6 + 0.4 * kickE)
297 inArena = step(bx, 0)
298 cr = 0.01 + grid * 0.3 + border * 0.6
299 cg = 0.02 + grid * 0.6 + border * 0.9
300 cb = 0.04 + grid * 1.0 + border * 1.0
301 rgb(cr * (0.4 + 0.6 * inArena), cg * (0.4 + 0.6 * inArena), cb * (0.4 + 0.6 * inArena))
302 # walls: pull in the previous frame, re-projected through last frame's camera
303 pu = (wx - pcamx) * pzoom
304 pv = (wy - pcamy) * pzoom * tiltk
305 sx = 0.5 + pu / (2 * aspect)
306 sy = 0.5 - pv / 2
307 keep = 0.982 * (1 - reset) * step(0, sx) * step(sx, 1) * step(0, sy) * step(sy, 1)
308 cprev(sx, sy, keep)
309 # bikes: segment from last position to this one; walls are written once at full brightness
310 # and then only retained by the feedback (max, not add, so nothing accumulates)
311 d1 = segd(wx, wy, b1px, b1py, b1x, b1y)
312 d2 = segd(wx, wy, b2px, b2py, b2x, b2y)
313 d3 = segd(wx, wy, b3px, b3py, b3x, b3y)
314 w1 = exp(-max(d1 - 0.011, 0) * 260)
315 w2 = exp(-max(d2 - 0.011, 0) * 260)
316 w3 = exp(-max(d3 - 0.011, 0) * 260)
317 h1 = exp(-len(wx - b1x, wy - b1y) * 40) * (0.6 + arpE + snE)
318 h2 = exp(-len(wx - b2x, wy - b2y) * 40) * (0.6 + arpE + snE)
319 h3 = exp(-len(wx - b3x, wy - b3y) * 40) * (0.6 + arpE + snE)
320 lr = w1 * 1.0 + h1 * 1.0 + w2 * 0.15 + h2 * 0.4 + w3 * 0.95 + h3 * 1.0
321 lg = w1 * 0.45 + h1 * 0.7 + w2 * 0.85 + h2 * 1.0 + w3 * 0.95 + h3 * 1.0
322 lb = w1 * 0.05 + h1 * 0.3 + w2 * 1.0 + h2 * 1.2 + w3 * 0.3 + h3 * 0.5
323 rgb(max(cget(0), lr), max(cget(1), lg), max(cget(2), lb))
324 # reset flash (erased next frame by the two-frame reset)
325 cadd(flash * 0.7, flash * 0.8, flash * 0.9)

Click a line number to link to that line.