LIFE GARDEN
life.dmt · 120 BPM · 24 s · 960×600
feedbackprocedural
notes
Conway-style cellular automata living in the previous-frame buffer. Every 16th note advances one generation; every two bars a ring of seeds arrives.
| music | kick, snare, hat, bass, glass, cloud pad |
|---|---|
| visual | Conway-style cellular automaton living in the previous-frame buffer: red is the live bit, blue the afterglow; one generation per 16th note, a ring of seeds every two bars |
| file | life.dmt |
|---|---|
| duration | 0:24 |
| video | 960×600 · 30 fps · h264 + audio · 7.2 MB |
| song | 120 BPM · speed 6 · rpb 4 · 6 channels |
| loop | 0 |
| render | scale 1 · master 0.56 |
| uniforms | advance seed burst epoch hue kickE snE mode |
| collection | Demos |
| tags | feedbackprocedural |
| source | 187 lines · 8 KB · download |
anatomy
9VM programs
4patterns
0palettes
0timeline events
0text / sample / texture
187source lines
6inst
0chan
1master
1frame
1pixel
0post
0fn
line composition
pattern 41%pixel 29%inst 16%frame 7%master 4%title 1%song 1%order 1%uniform 1%
play order
001122331230
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
1# @description Conway-style cellular automata living in the previous-frame buffer. Every 16th note advances one generation; every two bars a ring of seeds arrives.
2# @tags feedback, procedural
3# @collection Demos
4# @music kick, snare, hat, bass, glass, cloud pad
5# @visual Conway-style cellular automaton living in the previous-frame buffer: red is the live bit, blue the afterglow; one generation per 16th note, a ring of seeds every two bars
6# life.dmt - Conway-like cellular automata in the previous-frame buffer
7# Red encodes the live cell bit, blue carries its fading afterglow.
8# Every 16th note advances one generation; every two bars a ring of seeds arrives.
9title LIFE GARDEN
10song bpm=120 speed=6 rpb=4 channels=6 loop=0 volume=0.56
11order 0 0 1 1 2 2 3 3 1 2 3 0
13inst kick {
14 f = 49 + 480 * exp(-t * 44)
15 $p = $p + f / sr
16 out(dist(sin($p * tau) * exp(-t * 8) * 1.9, 1.4) * 0.67)
17}
18inst snare {
19 n = svf(noise(), 1800 + 2600 * exp(-t * 30), 0.35)
20 out((r2 * 0.8 + n * 0.3) * exp(-t * 13) * 0.48)
21}
22inst hat {
23 out(hp(noise(), 8700) * exp(-t * (36 + 70 * (1 - vel))) * 0.23)
24}
25inst bass {
26 e = env(0.004, 0.20, 0.25, 0.08)
27 s = svf(saw(ph) * 0.45 + sin(ph * tau) * 0.8, 190 + 1100 * e, 0.3)
28 out(s * e * 0.44)
29}
30inst glass {
31 e = exp(-t * 2.5)
32 m = sin(ph * tau * 2.03) * exp(-t * 4) * 1.3
33 out((sin(ph * tau + m) + sin(ph * tau * 2.01) * 0.35) * e * 0.26)
34}
35inst cloud {
36 e = env(0.25, 0.7, 0.70, 0.8)
37 s = sin(ph * tau + 0.6 * sin(ph * tau * 0.5 + t * 0.3))
38 s = s + saw(ph + t * 0.0014) * 0.25 + saw(ph - t * 0.0018) * 0.25
39 out(svf(s, 480 + 330 * sin(t * 0.33), 0.2) * e * 0.22)
40}
41master {
42 dl = dly(l, 0.375, 0.42)
43 dr = dly(r, 0.50, 0.42)
44 vl = verb(l + dr * 0.2, 0.72, 0.48)
45 vr = verb(r + dl * 0.2, 0.72, 0.48)
46 out(dist(l + dr * 0.25 + vl * 0.18, 1.15), dist(r + dl * 0.25 + vr * 0.18, 1.15))
47}
49# Channels: kick, snare, hats, bass, glass notes, pad.
50pattern 0 rows=16 {
51 C-2 1 38 | . | C-6 3 11 | A-1 4 34 | . | A-3 6 24
52 . | . | . | . | . | .
53 . | . | C-6 3 18 | A-2 4 26 | E-5 5 19 | .
54 . | . | . | . | . | .
55 C-2 1 34 | D-5 2 30 | C-6 3 12 | . | . | .
56 . | . | . | . | . | .
57 . | . | C-6 3 18 | A-1 4 32 | C-6 5 18 | .
58 . | . | . | . | . | .
59 C-2 1 38 | . | C-6 3 11 | F-1 4 34 | . | F-3 6 24
60 . | . | . | . | . | .
61 . | . | C-6 3 18 | F-2 4 26 | A-5 5 19 | .
62 . | . | . | . | . | .
63 C-2 1 34 | D-5 2 30 | C-6 3 12 | . | . | .
64 . | . | . | . | . | .
65 . | . | C-6 3 18 | F-1 4 32 | C-6 5 18 | .
66 . | . | . | . | . | .
67}
68pattern 1 rows=16 {
69 C-2 1 40 | . | C-6 3 13 | D-1 4 36 | A-4 5 24 | D-3 6 27
70 . | . | C-6 3 10 | . | . | .
71 . | . | C-6 3 20 | D-2 4 28 | F-5 5 19 | .
72 . | . | C-6 3 10 | . | . | .
73 C-2 1 36 | D-5 2 35 | C-6 3 13 | . | C-6 5 22 | .
74 . | . | C-6 3 10 | . | . | .
75 . | . | C-6 3 20 | D-1 4 34 | A-5 5 19 | .
76 . | . | C-6 3 10 | . | . | .
77 C-2 1 40 | . | C-6 3 13 | G-1 4 36 | G-4 5 24 | G-3 6 27
78 . | . | C-6 3 10 | . | . | .
79 . | . | C-6 3 20 | G-2 4 28 | D-5 5 19 | .
80 . | . | C-6 3 10 | . | . | .
81 C-2 1 36 | D-5 2 35 | C-6 3 13 | . | B-5 5 22 | .
82 . | . | C-6 3 10 | . | . | .
83 . | . | C-6 3 20 | G-1 4 34 | D-6 5 19 | .
84 . | D-5 2 18 | C-6 3 10 | . | . | .
85}
86pattern 2 rows=16 {
87 C-2 1 40 | . | C-6 3 13 | C-1 4 38 | E-5 5 24 | C-3 6 29
88 . | . | C-6 3 12 | . | . | .
89 . | . | C-6 3 22 | C-2 4 30 | G-5 5 21 | .
90 . | . | C-6 3 12 | . | . | .
91 C-2 1 38 | D-5 2 36 | C-6 3 13 | . | C-6 5 24 | .
92 . | . | C-6 3 12 | . | . | .
93 . | . | C-6 3 22 | C-1 4 36 | E-6 5 21 | .
94 . | . | C-6 3 12 | . | . | .
95 C-2 1 40 | . | C-6 3 13 | E-1 4 38 | G-4 5 24 | E-3 6 29
96 . | . | C-6 3 12 | . | . | .
97 . | . | C-6 3 22 | E-2 4 30 | B-4 5 21 | .
98 . | . | C-6 3 12 | . | . | .
99 C-2 1 38 | D-5 2 36 | C-6 3 13 | . | E-5 5 24 | .
100 . | . | C-6 3 12 | . | . | .
101 . | . | C-6 3 22 | E-1 4 36 | G-5 5 21 | .
102 C-2 1 24 | D-5 2 20 | C-6 3 12 | . | . | .
103}
104pattern 3 rows=16 {
105 C-2 1 33 | . | C-6 3 10 | F-1 4 33 | A-4 5 20 | F-3 6 25
106 . | . | . | . | . | .
107 . | . | C-6 3 16 | F-2 4 25 | C-5 5 18 | .
108 . | . | . | . | . | .
109 . | D-5 2 31 | C-6 3 10 | . | F-5 5 19 | .
110 . | . | . | . | . | .
111 . | . | C-6 3 16 | F-1 4 30 | A-5 5 18 | .
112 . | . | . | . | . | .
113 C-2 1 33 | . | C-6 3 10 | G-1 4 33 | B-4 5 20 | G-3 6 25
114 . | . | . | . | . | .
115 . | . | C-6 3 16 | G-2 4 25 | D-5 5 18 | .
116 . | . | . | . | . | .
117 . | D-5 2 31 | C-6 3 10 | . | G-5 5 19 | .
118 . | . | . | . | . | .
119 . | . | C-6 3 16 | G-1 4 30 | B-5 5 18 | .
120 . | . | . | . | . | .
121}
123uniform advance seed burst epoch hue kickE snE mode
124frame {
125 gen = floor(beat * 4)
126 advance = step(0.5, abs(gen - $gen))
127 $gen = gen
128 seed = step(frame, 0.5)
129 epoch = floor(lbeat / 8)
130 burst = step(0.5, abs(epoch - $epoch))
131 $epoch = epoch
132 kickE = exp(-trig(0) * 9)
133 snE = exp(-trig(1) * 12)
134 hue = 0.5 + 0.5 * sin(lbeat * 0.13)
135 mode = step(0.55, 0.5 + 0.5 * sin(lbeat * 0.10))
136}
137pixel {
138 # One logical cell occupies several display pixels, so prev() samples its centre.
139 cellSize = max(2, floor(h / 48))
140 cols = floor(w / cellSize)
141 rows = floor(h / cellSize)
142 gx = floor(x * cols)
143 gy = floor(y * rows)
144 cx = (gx + 0.5) / cols
145 cy = (gy + 0.5) / rows
146 dx = 1 / cols
147 dy = 1 / rows
148 here = prev(cx, cy)
149 oldTrail = r2
150 self = step(0.5, here)
152 # Toroidal neighbourhood: all eight adjacent cells wrap around the screen.
153 a = step(0.5, prev(fract(cx - dx), fract(cy - dy)))
154 b = step(0.5, prev(cx, fract(cy - dy)))
155 c = step(0.5, prev(fract(cx + dx), fract(cy - dy)))
156 d = step(0.5, prev(fract(cx - dx), cy))
157 e = step(0.5, prev(fract(cx + dx), cy))
158 f = step(0.5, prev(fract(cx - dx), fract(cy + dy)))
159 g = step(0.5, prev(cx, fract(cy + dy)))
160 j = step(0.5, prev(fract(cx + dx), fract(cy + dy)))
161 neighbours = a + b + c + d + e + f + g + j
163 # B3/S23 Life, with occasional B6 births in the brighter phase.
164 born3 = step(2.5, neighbours) * (1 - step(3.5, neighbours))
165 born6 = step(5.5, neighbours) * (1 - step(6.5, neighbours)) * mode
166 survives = step(1.5, neighbours) * (1 - step(3.5, neighbours))
167 next = max(born3, born6) * (1 - self) + survives * self
168 alive = mix(self, next, advance)
170 # An initial random colony and sparse periodic spore rings prevent extinction.
171 rr = len(u, v)
172 ring = exp(-abs(rr - (0.24 + 0.13 * sin(epoch * 1.9))) * 22)
173 random = hash(gx * 1.71 + gy * 97.31 + epoch * 337.7)
174 first = seed * step(0.71, hash(gx * 7.13 + gy * 113.7))
175 spore = burst * step(0.67, random) * step(0.16, ring)
176 alive = max(alive, max(first, spore))
178 # Red remains a clean binary state at every cell centre; blue is a fading trail.
179 trail = max(alive, oldTrail * 0.94)
180 lx = fract(x * cols) - 0.5
181 ly = fract(y * rows) - 0.5
182 tile = 1 - smooth(0.38, 0.68, len(lx, ly))
183 red = (alive * (0.74 + 0.10 * kickE) + trail * 0.12) * tile
184 green = (alive * (0.20 + 0.54 * hue + 0.12 * snE) + trail * 0.07) * tile
185 blue = trail * tile
186 rgb(red, green, blue)
187}
Click a line number to link to that line.