DIVIDE BY ZERO
dividebyzero.dmt · 140 BPM · 41 s · 960×600
acidglitch
notes
A calculator boots clean, then corrupts into a neon glitch portal. Half-time dubstep with psy/goa acid lines.
| file | dividebyzero.dmt |
|---|---|
| duration | 0:41 |
| video | 960×600 · 30 fps · h264 + audio · 21 MB |
| song | 140 BPM · speed 6 · rpb 4 · 8 channels |
| loop | 0 |
| render | scale 1 · dither on · master 0.62 |
| uniforms | kickE snareE hatE bassE padE acidE glitchE chaos |
| tags | acidglitch |
| source | 402 lines · 18 KB · download |
anatomy
12VM programs
7patterns
0palettes
0timeline events
4text / sample / texture
402source lines
8inst
0chan
1master
1frame
1pixel
1post
1fn
line composition
pixel 34%pattern 33%post 13%inst 11%frame 3%master 2%fn 2%text 1%title 0%song 0%order 0%uniform 0%
play order
012323442323552323556666
order list · 24 entries
timeline
This demo has no timeline events; it is driven by the tracker clock and per-frame programs.
resources
| kind | name | info | value |
|---|---|---|---|
| text | BRAND | 9 | GLITCH-01 |
| text | KEYS | 16 | 789+456-123*0.=C |
| text | ERR | 5 | ERROR |
| text | DIV | 14 | DIVIDE BY ZERO |
source
1# @description A calculator boots clean, then corrupts into a neon glitch portal. Half-time dubstep with psy/goa acid lines.
2# @tags glitch, acid
3# dividebyzero.dmt - a calculator that boots clean, then corrupts into a neon
4# glitch portal. 140 BPM half-time dubstep with psy/goa acid lines.
5# Original code and music.
6title DIVIDE BY ZERO
7song bpm=140 speed=6 rpb=4 channels=8 loop=0 volume=0.62 dither=1
8order 0 1 2 3 2 3 4 4 2 3 2 3 5 5 2 3 2 3 5 5 6 6 6 6
10# ---------------------------------------------------------------- instruments
11inst kick {
12 f = 48 + 240 * exp(-t * 34)
13 $p = $p + f / sr
14 body = sin($p * tau) * exp(-t * 6.5)
15 click = hp(noise(), 2600) * exp(-t * 110) * 0.22
16 out(dist((body * 1.5 + click) * 0.62, 1.2))
17}
18inst snare {
19 n = svf(noise(), 1700 + 2400 * exp(-t * 20), 0.35)
20 body = sin((210 - 90 * exp(-t * 24)) * t * tau) * exp(-t * 18)
21 out((r2 * 0.55 + n * 0.75 + body * 0.3) * exp(-t * 9) * 0.75)
22}
23inst hat {
24 n = hp(noise(), 8200 + 2200 * vel)
25 out(n * exp(-t * (38 + 55 * (1 - vel))) * 0.50)
26}
27# wobble bass: LFO on the filter, then drive
28inst wobble {
29 e = env(0.005, 0.12, 0.75, 0.12)
30 rate = 3.2 + 3.8 * sin(t * 0.27 + 1.1)
31 cut = 120 + 1100 * (0.5 + 0.5 * sin(t * rate))
32 s = saw(ph) + saw(ph * 1.007) * 0.7
33 s = svf(s, cut, 0.55)
34 out(dist(s * e * 0.32, 2.2))
35}
36inst sub {
37 e = env(0.005, 0.18, 0.70, 0.15)
38 out(sin(ph * tau) * e * 0.32)
39}
40# psy/goa acid line: resonant filter, fast decay
41inst acid {
42 e = env(0.002, 0.06, 0.35, 0.04)
43 s = svf(saw(ph), 280 + 2400 * e + 500 * sin(t * 0.7), 0.72)
44 out(s * e * 0.65)
45}
46inst lead {
47 e = env(0.03, 0.25, 0.55, 0.35)
48 s = sin(ph * tau + 0.6 * sin(t * 6.0)) + 0.3 * saw(ph * 1.005)
49 s = svf(s, 1200 + 700 * sin(t * 0.4), 0.3)
50 out(s * e * 0.35)
51}
52inst glitch {
53 n = noise()
54 s = step(0.5, hash(floor(t * 90))) * n
55 out(crush(s, 3) * exp(-t * 20) * 0.55)
56}
58master {
59 dl = dly(l, 0.34, 0.30)
60 dr = dly(r, 0.51, 0.30)
61 vl = verb(l + dr * 0.18, 0.78, 0.45)
62 vr = verb(r + dl * 0.18, 0.78, 0.45)
63 ml = lp(l + dr * 0.22 + vl * 0.12, 15000)
64 mr = lp(r + dl * 0.22 + vr * 0.12, 15000)
65 out(dist(ml, 1.40), dist(mr, 1.40))
66}
68# ---------------------------------------------------------------- score
69# channels: 0 kick 1 snare 2 hat 3 wobble 4 sub 5 acid 6 lead 7 glitch
70pattern 0 rows=16 {
71 C-2 1 26 | . | . | . | D-1 4 32 | . | . | C-6 7 10
72 . | . | . | . | . | . | . | .
73 . | . | C-6 2 7 | . | . | . | . | .
74 . | . | . | . | . | D-4 5 20 | . | .
75 . | . | . | . | . | . | . | C-6 7 8
76 . | . | C-6 2 6 | . | . | . | . | .
77 . | . | . | . | . | F#4 5 18 | . | .
78 . | . | . | . | . | . | . | .
79 C-2 1 24 | . | . | . | D-1 4 30 | . | . | .
80 . | . | C-6 2 7 | . | . | . | . | C-6 7 10
81 . | . | . | . | . | A-4 5 20 | . | .
82 . | . | . | . | . | . | . | .
83 . | . | C-6 2 6 | . | . | . | . | .
84 . | . | . | . | . | C-5 5 18 | . | .
85 . | . | . | . | . | . | . | .
86 . | . | . | . | . | . | . | C-6 7 8
87}
88pattern 1 rows=16 {
89 C-2 1 36 | . | . | D-2 3 34 | D-1 4 36 | . | . | .
90 . | . | C-6 2 10 | . | . | D-4 5 22 | . | .
91 . | . | . | . | . | . | . | C-6 7 10
92 . | . | C-6 2 8 | . | . | . | . | .
93 . | D-4 2 26 | . | . | . | F#4 5 20 | . | .
94 . | . | C-6 2 9 | . | . | . | . | .
95 . | . | . | . | . | . | . | C-6 7 8
96 . | . | C-6 2 7 | . | . | A-4 5 22 | . | .
97 C-2 1 36 | . | . | D-2 3 34 | D-1 4 36 | . | . | .
98 . | . | C-6 2 10 | . | . | . | . | C-6 7 10
99 . | . | . | . | . | C-5 5 20 | . | .
100 . | . | C-6 2 8 | . | . | . | . | .
101 . | D-4 2 26 | . | . | . | A-4 5 22 | . | .
102 . | . | C-6 2 9 | . | . | . | . | C-6 7 8
103 . | . | . | . | . | F#4 5 20 | . | .
104 . | . | C-6 2 7 | . | . | . | . | .
105}
106pattern 2 rows=16 {
107 C-2 1 40 | . | . | D-2 3 40 | D-1 4 40 | . | . | .
108 . | . | C-6 2 12 | . | . | D-4 5 22 | . | C-6 7 10
109 . | . | . | . | . | . | . | .
110 . | . | C-6 2 9 | . | . | F#4 5 20 | . | .
111 . | D-4 2 34 | . | . | . | . | . | .
112 . | . | C-6 2 11 | . | . | A-4 5 20 | . | C-6 7 8
113 . | . | . | . | . | . | D-5 6 16 | .
114 . | . | C-6 2 8 | . | . | . | . | .
115 C-2 1 40 | . | . | D-2 3 38 | D-1 4 40 | . | . | .
116 . | . | C-6 2 12 | . | . | C-5 5 22 | . | C-6 7 10
117 C-2 1 28 | . | . | . | . | . | . | .
118 . | . | C-6 2 9 | . | . | A-4 5 20 | . | .
119 . | D-4 2 34 | . | . | . | . | D-5 6 16 | .
120 . | . | C-6 2 11 | . | . | F#4 5 20 | . | C-6 7 8
121 . | . | . | . | . | . | . | .
122 . | . | C-6 2 8 | . | . | . | . | .
123}
124pattern 3 rows=16 {
125 C-2 1 40 | . | . | A#1 3 40 | A#0 4 40 | . | . | .
126 . | . | C-6 2 12 | . | . | A#4 5 22 | . | C-6 7 10
127 . | . | . | . | . | . | . | .
128 . | . | C-6 2 9 | . | . | C-5 5 20 | . | .
129 . | D-4 2 34 | . | . | . | . | . | .
130 . | . | C-6 2 11 | . | . | D-5 5 20 | . | C-6 7 8
131 . | . | . | . | . | . | F-5 6 16 | .
132 . | . | C-6 2 8 | . | . | . | . | .
133 C-2 1 40 | . | . | A#1 3 38 | A#0 4 40 | . | . | .
134 . | . | C-6 2 12 | . | . | A#4 5 22 | . | C-6 7 10
135 C-2 1 28 | . | . | . | . | . | . | .
136 . | . | C-6 2 9 | . | . | C-5 5 20 | . | .
137 . | D-4 2 34 | . | . | . | . | F-5 6 16 | .
138 . | . | C-6 2 11 | . | . | A#4 5 22 | . | C-6 7 8
139 . | . | . | . | . | . | . | .
140 . | . | C-6 2 8 | . | . | . | . | .
141}
142pattern 4 rows=16 {
143 . | . | . | . | D-1 4 34 | D-4 5 24 | . | .
144 . | . | C-6 2 7 | . | . | D#4 5 20 | . | C-6 7 8
145 . | . | . | . | . | F#4 5 22 | . | .
146 . | . | C-6 2 6 | . | . | G-4 5 20 | . | .
147 . | . | . | . | . | A-4 5 22 | D-5 6 16 | C-6 7 8
148 . | . | C-6 2 7 | . | . | A#4 5 20 | . | .
149 . | . | . | . | . | C-5 5 22 | . | .
150 . | . | C-6 2 6 | . | . | D-5 5 20 | . | C-6 7 8
151 . | . | . | . | D-1 4 34 | F#5 5 24 | . | .
152 . | . | C-6 2 7 | . | . | D-5 5 20 | . | C-6 7 8
153 . | . | . | . | . | C-5 5 22 | . | .
154 . | . | C-6 2 6 | . | . | A#4 5 20 | . | .
155 . | . | . | . | . | A-4 5 22 | D-5 6 16 | C-6 7 8
156 . | . | C-6 2 7 | . | . | G-4 5 20 | . | .
157 . | . | . | . | . | F#4 5 22 | . | .
158 . | . | C-6 2 6 | . | . | D-4 5 20 | . | C-6 7 8
159}
160pattern 5 rows=16 {
161 C-2 1 40 | . | . | F-2 3 40 | F-1 4 40 | . | . | .
162 . | . | C-6 2 12 | . | . | F-4 5 22 | . | C-6 7 10
163 . | . | . | . | . | . | . | .
164 . | . | C-6 2 9 | . | . | G#4 5 20 | . | .
165 . | D-4 2 34 | . | . | . | . | . | .
166 . | . | C-6 2 11 | . | . | A#4 5 20 | . | C-6 7 8
167 . | . | . | . | . | . | C-5 6 16 | .
168 . | . | C-6 2 8 | . | . | . | . | .
169 C-2 1 40 | . | . | F-2 3 38 | F-1 4 40 | . | . | .
170 . | . | C-6 2 12 | . | . | F-4 5 22 | . | C-6 7 10
171 C-2 1 28 | . | . | . | . | . | . | .
172 . | . | C-6 2 9 | . | . | D#5 5 20 | . | .
173 . | D-4 2 34 | . | . | . | . | C-5 6 16 | .
174 . | . | C-6 2 11 | . | . | C-5 5 20 | . | C-6 7 8
175 . | . | . | . | . | . | . | .
176 . | . | C-6 2 8 | . | . | . | . | .
177}
178pattern 6 rows=16 {
179 C-2 1 40 | . | . | D-2 3 40 | D-1 4 40 | . | . | C-6 7 12
180 . | . | C-6 2 8 | . | . | . | . | .
181 . | D-4 2 30 | . | . | . | . | . | C-6 7 10
182 . | . | . | . | . | . | . | .
183 C-2 1 30 | . | . | . | . | . | . | .
184 . | . | . | . | . | . | . | C-6 7 12
185 . | . | . | . | . | . | . | .
186 . | . | . | . | . | . | . | .
187 C-2 1 40 | . | . | D-2 3 40 | D-1 4 40 | . | . | .
188 . | . | C-6 2 8 | . | . | . | . | C-6 7 12
189 . | D-4 2 30 | . | . | . | . | . | .
190 . | . | . | . | . | . | . | .
191 C-2 1 30 | . | . | . | . | . | . | .
192 . | . | . | . | . | . | . | C-6 7 10
193 . | . | . | . | . | . | . | .
194 . | . | . | . | . | . | . | .
195}
197# ---------------------------------------------------------------- visuals
198text BRAND "GLITCH-01"
199text KEYS "789+456-123*0.=C"
200text ERR "ERROR"
201text DIV "DIVIDE BY ZERO"
202uniform kickE snareE hatE bassE padE acidE glitchE chaos
204fn textline(s, px, py, sz) {
205 cx = (u - px) / sz
206 cy = (py - v) / sz
207 i = floor(cx)
208 return glyph(str(s, i), fract(cx), fract(cy)) * step(0, cx) * step(cx, strlen(s)) * step(0, cy) * step(cy, 1)
209}
211frame {
212 kickE = exp(-trig(0) * 8)
213 snareE = exp(-trig(1) * 10)
214 hatE = exp(-trig(2) * 18)
215 bassE = cenv(3)
216 padE = cenv(4)
217 acidE = cenv(5)
218 glitchE = cenv(7)
219 chaos = smooth(4.0, 36.0, t) + 0.25 * smooth(36.0, 44.0, t)
220}
222pixel {
223 # psychedelic desk / portal behind the calculator
224 rb = len(u, v + 0.02) + 0.03
225 ab = atan2(v, u)
226 bh = fract(0.56 + 0.08 * sin(t * 0.15) + 0.10 * sin(ab * 3.0 + rb * 5.0 - t * 0.6))
227 hsv(bh, 0.72, 0.16 + 0.30 * chaos)
228 br = cget(0)
229 bg = cget(1)
230 bb = cget(2)
231 rings = pow(0.5 + 0.5 * sin(rb * 14.0 - t * 1.4 + 2.0 * sin(ab * 5.0 + t * 0.7)), 8)
232 br = br + rings * 0.22 * chaos
233 bg = bg + rings * 0.10 * chaos
234 bb = bb + rings * 0.38 * chaos
236 # calculator body, warped by chaos
237 wob = 0.09 * chaos * sin(v * 13.0 + t * 3.0) + 0.04 * chaos * sin(u * 17.0 - t * 2.3) + 0.035 * chaos * sin(v * 31.0 + t * 7.0)
238 cu = u + wob
239 cv = v + 0.025 * chaos * cos(u * 11.0 + t * 1.7)
240 qx = abs(cu) - 0.36
241 qy = abs(cv) - 0.52
242 dbody = len(max(qx, 0.0), max(qy, 0.0)) + min(max(qx, qy), 0.0) - 0.10 + 0.05 * chaos * sin(cu * 21.0 + t * 5.0) * sin(cv * 17.0 - t * 4.0)
243 body = 1 - smooth(0.0, 0.014, dbody)
244 edge = exp(-abs(dbody) * 90.0) * body
246 # face: grey plastic, neon under chaos
247 baseHue = fract(0.58 + 0.25 * chaos + 0.05 * sin(t * 0.4))
248 hsv(baseHue, 0.10 + 0.55 * chaos, 0.14 + 0.22 * chaos)
249 cr = cget(0)
250 cg = cget(1)
251 cb = cget(2)
252 br = mix(br, cr, body)
253 bg = mix(bg, cg, body)
254 bb = mix(bb, cb, body)
255 br = br + edge * 0.35
256 bg = bg + edge * 0.32
257 bb = bb + edge * 0.30
259 # display window
260 disp = (1 - smooth(0.34, 0.35, abs(cu))) * (1 - smooth(0.10, 0.11, abs(cv - 0.38)))
261 if (disp > 0.001) {
262 hsv(fract(0.30 + 0.08 * chaos), 0.55, 0.08 + 0.15 * chaos)
263 dr = cget(0)
264 dg = cget(1)
265 db = cget(2)
266 br = mix(br, dr, disp)
267 bg = mix(bg, dg, disp)
268 bb = mix(bb, db, disp)
269 # eight digits across the display
270 dcell = (cu + 0.30) / 0.075
271 di = floor(dcell)
272 df = fract(dcell)
273 dv = floor(hash(di * 17.0 + floor(t * (3.0 + 18.0 * chaos))) * 10.0)
274 dgx = df
275 dgy = (0.45 - cv) / 0.14
276 dgly = glyph(48 + dv, dgx, dgy) * step(0, dcell) * step(dcell, 8.0) * step(0, dgy) * step(dgy, 1)
277 br = br + dgly * (0.55 + 0.45 * chaos)
278 bg = bg + dgly * 0.85
279 bb = bb + dgly * (0.45 + 0.55 * chaos)
280 dp = (1 - smooth(0.006, 0.0, len(cu + 0.26, cv - 0.36))) * 0.8
281 br = br + dp
282 bg = bg + dp * 0.8
283 bb = bb + dp * 0.4
284 brd = textline(BRAND, -0.28, 0.53, 0.030) * (1 - 0.7 * chaos)
285 br = br + brd * 0.35
286 bg = bg + brd * 0.38
287 bb = bb + brd * 0.40
288 er = textline(ERR, -0.14, 0.38, 0.070) * smooth(0.72, 0.90, chaos)
289 br = br + er * 1.0
290 bg = bg + er * 0.15
291 bb = bb + er * 0.10
292 if (chaos > 0.55) {
293 pr = len(cu, (cv - 0.38) * 1.5) + 0.03
294 pa = atan2(cv - 0.38, cu)
295 prings = pow(0.5 + 0.5 * sin(pr * 38.0 - t * 4.0 + 3.0 * sin(pa * 5.0 + t * 0.8)), 8)
296 br = br + disp * prings * 0.85
297 bg = bg + disp * prings * 0.25
298 bb = bb + disp * prings * 0.95
299 }
300 }
302 # keypad: 4 x 4 buttons
303 kx = (cu + 0.36) / 0.18
304 ky = (cv + 0.50) / 0.125
305 kci = floor(kx)
306 kcj = floor(ky)
307 kfx = fract(kx)
308 kfy = fract(ky + chaos * 0.45 * hash(kci * 3.1 + kcj * 5.7))
309 keyArea = step(0, kx) * step(kx, 4.0) * step(0, ky) * step(ky, 4.0)
310 key = (1 - smooth(0.47, 0.49, abs(kfx - 0.5))) * (1 - smooth(0.45, 0.47, abs(kfy - 0.5))) * keyArea * body
311 ksel = hash(kci * 7.1 + kcj * 13.7)
312 kmove = step(ksel, chaos * 0.95)
313 key = key * (1 - kmove)
314 if (key > 0.001) {
315 keyHue = fract(0.55 + 0.10 * kci + 0.06 * kcj + 0.18 * chaos)
316 hsv(keyHue, 0.08 + 0.55 * chaos, 0.18 + 0.10 * chaos)
317 kr = cget(0)
318 kg = cget(1)
319 kb = cget(2)
320 br = mix(br, kr, key)
321 bg = mix(bg, kg, key)
322 bb = mix(bb, kb, key)
323 br = br + key * 0.30 * kickE
324 bg = bg + key * 0.10 * kickE
325 bb = bb + key * 0.35 * kickE
326 ki = kci + (3.0 - kcj) * 4.0
327 kgx = 0.10 + kfx * 0.80
328 kgy = 0.10 + (1.0 - kfy) * 0.80
329 kl = glyph(str(KEYS, floor(ki)), kgx, kgy) * key
330 br = br + kl * 0.60
331 bg = bg + kl * 0.62
332 bb = bb + kl * 0.66
333 }
335 # final split: the calculator itself starts to tear
336 tear = step(0.55, hash(floor(u * 10.0) + floor(v * 12.0) * 17.0 + floor(t * 18.0))) * chaos
337 if (tear > 0.5) {
338 cadd(0.12, 0.02, 0.18)
339 }
341 # doom text at the meltdown
342 dt = textline(DIV, -0.27, -0.02, 0.045) * smooth(0.85, 1.02, chaos)
343 br = br + dt * 1.0
344 bg = bg + dt * 0.10
345 bb = bb + dt * 0.20
347 # white-hot overload
348 br = br + chaos * kickE * 0.25
349 bg = bg + chaos * kickE * 0.10
350 bb = bb + chaos * kickE * 0.30
351 rgb(br, bg, bb)
352}
354post {
355 cr = tap(0.0, 0.0)
356 cg = r1
357 cb = r2
358 # block displacement / datamosh, stronger with chaos
359 gx = floor(x * 26.0)
360 gy = floor(y * 22.0)
361 gl = step(0.50, hash(gx * 3.1 + gy * 7.7 + floor(t * 18.0))) * chaos
362 ox = (hash(gx * 1.7 + gy * 9.1 + floor(t * 14.0)) - 0.5) * 0.10 * gl
363 oy = (hash(gx * 8.3 + gy * 2.9 + floor(t * 14.0)) - 0.5) * 0.05 * gl
364 tr = tap(ox, oy)
365 tg = r1
366 tb = r2
367 cr = mix(cr, tr, gl * 0.85)
368 cg = mix(cg, tg, gl * 0.70)
369 cb = mix(cb, tb, gl * 0.90)
370 # row tearing
371 tear = step(0.82, hash(floor(y * 90.0) + floor(t * 22.0))) * chaos
372 tr = tap(0.018 * tear, 0.0)
373 cr = mix(cr, tr, tear * 0.7)
374 # RGB split
375 tr = tap(0.003 * gl, 0.0)
376 cr = mix(cr, tr, gl * 0.7)
377 tr = tap(-0.003 * gl, 0.0)
378 cb = mix(cb, tr, gl * 0.7)
379 # posterise and scanlines as it goes
380 q = 4.0 + 28.0 * (1.0 - chaos)
381 cr = floor(cr * q + 0.5) / q
382 cg = floor(cg * q + 0.5) / q
383 cb = floor(cb * q + 0.5) / q
384 scan = 0.88 + 0.12 * sin(y * 900.0)
385 cr = cr * scan
386 cg = cg * scan
387 cb = cb * scan
388 # vignette and grain
389 vg = 1.0 - 0.35 * smooth(0.45, 1.10, len(u * 0.9, v))
390 cr = cr * vg
391 cg = cg * vg
392 cb = cb * vg
393 gr = hash(x * 911.0 + y * 277.0 + frame * 19.0) - 0.5
394 cr = cr + gr * 0.025
395 cg = cg + gr * 0.025
396 cb = cb + gr * 0.025
397 fl = smooth(40.0, 40.25, t) * (1.0 - smooth(40.35, 41.0, t))
398 cr = cr + fl * 1.4
399 cg = cg + fl * 1.3
400 cb = cb + fl * 1.5
401 rgb(cr, cg, cb)
402}
Click a line number to link to that line.