dmscene Demos & source

PULSE

pulse.dmt · 128 BPM · 30 s · 960×600

loopsfractal

notes

A loopable fractal demo in one byte-packed module: five instruments, four tracker patterns, a master effect, two palettes and a two-stage shader.

musichouse: FM kick, FM bass, pluck arps, pad, stereo echo
visualJulia set whose c orbits the cardioid; kaleidoscope fold; orbit-trap glow on the arp
filepulse.dmt
duration0:30
video960×600 · 30 fps · h264 + audio · 20 MB
song128 BPM · speed 6 · rpb 4 · 5 channels
loop1
renderscale 1 · master 0.62
uniformszoom ang cx cy hue kickE glow mixk fold
collectionDemos
tagsloopsfractal
source297 lines · 15 KB · download

anatomy

9VM programs
4patterns
2palettes
0timeline events
0text / sample / texture
297source lines
6inst
0chan
1master
1frame
1pixel
0post
0fn

line composition

pattern 54%inst 15%pixel 12%frame 8%palette 6%master 3%title 0%song 0%order 0%uniform 0%

play order

01213

order list · loop returns to order 1 · 5 entries

palettes

nebula7 keys · lines 15–23
ice5 keys · lines 24–30

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 A loopable fractal demo in one byte-packed module: five instruments, four tracker patterns, a master effect, two palettes and a two-stage shader.
2# @tags fractal
3# @collection Demos
4# @music house: FM kick, FM bass, pluck arps, pad, stereo echo
5# @visual Julia set whose c orbits the cardioid; kaleidoscope fold; orbit-trap glow on the arp
6# pulse.dmt - a loopable fractal demo for dmscene.
7# Everything below compiles into one byte-packed .dms: five VM instruments,
8# four tracker patterns, a master effect, two palettes and a two-stage shader.
10title PULSE
11song bpm=128 speed=6 rpb=4 channels=5 loop=1 volume=0.62
12order 0 1 2 1 3
14# ------------------------------------------------------------------ palettes
15palette nebula {
16 0.00 0.01 0.00 0.05
17 0.18 0.10 0.00 0.35
18 0.38 0.75 0.10 0.45
19 0.55 1.00 0.55 0.10
20 0.72 0.95 0.95 0.70
21 0.86 0.10 0.60 0.80
22 1.00 0.01 0.00 0.05
24palette ice {
25 0.00 0.00 0.02 0.08
26 0.30 0.00 0.35 0.60
27 0.60 0.60 0.95 1.00
28 0.80 1.00 1.00 1.00
29 1.00 0.00 0.02 0.08
32# ------------------------------------------------------------------ instruments
33# inst programs run once per sample per voice.
34# t = seconds since note-on, rel = seconds since note-off (-1 while held)
35# ph = phase 0..1 at the channel's current pitch, vel = note-on velocity
36# $name = per-voice state slot (zeroed on trigger)
38inst kick {
39 f = 48 + 520 * exp(-t * 38) # pitch sweep
40 $p = $p + f / sr # own phase accumulator (ignores pattern pitch)
41 body = sin($p * tau) * exp(-t * 6.5)
42 click = noise() * exp(-t * 120) * 0.6
43 out(dist((body + click) * 2.2, 1.5) * 0.8)
46inst snare {
47 n = hp(noise(), 1500) * exp(-t * 14)
48 tone = sin(tau * 185 * t) * exp(-t * 32)
49 out((n * 0.8 + tone * 0.6) * 0.7)
52inst hat {
53 n = hp(noise(), 8000)
54 d = 30 + 80 * (1 - vel) # quieter hats are also shorter
55 out(n * exp(-t * d) * 0.35)
58inst bass {
59 e = env(0.003, 0.22, 0.35, 0.08)
60 mi = 2.5 * exp(-t * 6) + p0 * 6 # fm index: decays, Sxx opens it back up
61 m = sin(ph * tau * 2) * mi
62 s = sin(ph * tau + m) + saw(ph) * 0.25
63 s = lp(s, 250 + 2800 * e)
64 out(s * e * 0.55)
67inst pluck {
68 e = env(0.001, 0.16, 0.0, 0.05)
69 pw = 0.5 + 0.35 * sin(t * 9)
70 s = sqr(ph, pw) * 0.55 + saw(ph * 2 + 0.25) * 0.45
71 s = lp(s, 400 + 7000 * e)
72 out(s * e * 0.32)
75inst pad {
76 e = env(0.35, 0.6, 0.7, 0.7)
77 a = sin(ph * tau + 0.7 * sin(ph * tau * 0.5 + t * 0.5))
78 b = saw(ph + 0.0021 * t) * 0.5 + saw(ph - 0.0017 * t) * 0.5 # two detuned saws
79 s = lp(a + b * 0.6, 350 + 900 * e + 250 * sin(t * 1.7))
80 out(s * e * 0.28)
83# ------------------------------------------------------------------ master
84# l / r come in, out(l, r) goes to the speakers. dly() lines only exist here.
85master {
86 dl = dly(l, 0.2344, 0.38) # dotted-ish echoes at 128 bpm
87 dr = dly(r, 0.3516, 0.34)
88 ol = l + dr * 0.22
89 or = r + dl * 0.22
90 out(dist(ol, 1.2), dist(or, 1.2))
93# ------------------------------------------------------------------ patterns
94# channels: 0 kick(1) 1 snare(2)/hat(3) 2 bass(4) 3 pluck(5) 4 pad(6)
95# cell: note inst vol fx '.' = none
97pattern 0 rows=32 {
98 # intro: bass + hats, kick enters halfway
99 00: ... . .. ... | C-6 3 20 ... | A-1 4 40 S00 | ... . .. ... | A-2 6 30 ...
100 01: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
101 02: ... . .. ... | C-6 3 10 ... | ... . .. ... | ... . .. ... | ... . .. ...
102 03: ... . .. ... | ... . .. ... | A-1 4 .. ... | ... . .. ... | ... . .. ...
103 04: ... . .. ... | C-6 3 20 ... | ... . .. ... | ... . .. ... | ... . .. ...
104 05: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
105 06: ... . .. ... | C-6 3 10 ... | A-1 4 .. ... | ... . .. ... | ... . .. ...
106 07: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
107 08: ... . .. ... | C-6 3 20 ... | ... . .. ... | ... . .. ... | ... . .. ...
108 09: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
109 10: ... . .. ... | C-6 3 10 ... | A-1 4 .. ... | ... . .. ... | ... . .. ...
110 11: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
111 12: ... . .. ... | C-6 3 20 ... | G-1 4 .. ... | ... . .. ... | ... . .. ...
112 13: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
113 14: ... . .. ... | C-6 3 10 ... | G-1 4 .. ... | ... . .. ... | ... . .. ...
114 15: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
115 16: C-2 1 40 ... | C-6 3 20 ... | F-1 4 .. S30 | ... . .. ... | F-2 6 30 ...
116 17: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
117 18: ... . .. ... | C-6 3 10 ... | ... . .. ... | ... . .. ... | ... . .. ...
118 19: ... . .. ... | ... . .. ... | F-1 4 .. ... | ... . .. ... | ... . .. ...
119 20: C-2 1 40 ... | C-6 3 20 ... | ... . .. ... | ... . .. ... | ... . .. ...
120 21: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
121 22: ... . .. ... | C-6 3 10 ... | F-1 4 .. ... | ... . .. ... | ... . .. ...
122 23: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
123 24: C-2 1 40 ... | C-6 3 20 ... | G-1 4 .. S60 | ... . .. ... | G-2 6 30 ...
124 25: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
125 26: ... . .. ... | C-6 3 10 ... | G-1 4 .. ... | ... . .. ... | ... . .. ...
126 27: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
127 28: C-2 1 40 ... | C-6 3 20 ... | G-1 4 .. ... | ... . .. ... | ... . .. ...
128 29: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
129 30: C-2 1 40 ... | C-6 3 30 ... | G-1 4 .. 208 | ... . .. ... | ... . .. ...
130 31: C-2 1 40 ... | D-5 2 30 ... | ... . .. ... | ... . .. ... | ... . .. ...
133pattern 1 rows=32 {
134 # main groove A: Am F
135 00: C-2 1 40 ... | C-6 3 20 ... | A-1 4 40 S00 | A-4 5 30 ... | A-2 6 30 ...
136 01: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
137 02: ... . .. ... | C-6 3 10 ... | A-1 4 .. ... | C-5 5 28 ... | ... . .. ...
138 03: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
139 04: C-2 1 40 ... | D-5 2 38 ... | ... . .. ... | E-5 5 30 ... | ... . .. ...
140 05: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
141 06: ... . .. ... | C-6 3 10 ... | A-1 4 .. ... | A-5 5 26 ... | ... . .. ...
142 07: ... . .. ... | ... . .. ... | A-2 4 .. ... | ... . .. ... | ... . .. ...
143 08: C-2 1 40 ... | C-6 3 20 ... | A-1 4 .. S20 | G-4 5 30 ... | ... . .. ...
144 09: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
145 10: ... . .. ... | C-6 3 10 ... | A-1 4 .. ... | B-4 5 28 ... | ... . .. ...
146 11: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
147 12: C-2 1 40 ... | D-5 2 38 ... | G-1 4 .. ... | D-5 5 30 ... | ... . .. ...
148 13: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
149 14: ... . .. ... | C-6 3 10 ... | G-1 4 .. ... | G-5 5 26 ... | ... . .. ...
150 15: ... . .. ... | C-6 3 18 ... | ... . .. ... | E-5 5 20 ... | ... . .. ...
151 16: C-2 1 40 ... | C-6 3 20 ... | F-1 4 .. S40 | F-4 5 30 ... | F-2 6 30 ...
152 17: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
153 18: ... . .. ... | C-6 3 10 ... | F-1 4 .. ... | A-4 5 28 ... | ... . .. ...
154 19: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
155 20: C-2 1 40 ... | D-5 2 38 ... | ... . .. ... | C-5 5 30 ... | ... . .. ...
156 21: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
157 22: ... . .. ... | C-6 3 10 ... | F-1 4 .. ... | F-5 5 26 ... | ... . .. ...
158 23: ... . .. ... | ... . .. ... | F-2 4 .. ... | ... . .. ... | ... . .. ...
159 24: C-2 1 40 ... | C-6 3 20 ... | G-1 4 .. S70 | G-4 5 30 ... | G-2 6 30 ...
160 25: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
161 26: ... . .. ... | C-6 3 10 ... | G-1 4 .. ... | B-4 5 28 ... | ... . .. ...
162 27: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
163 28: C-2 1 40 ... | D-5 2 38 ... | G-1 4 .. ... | D-5 5 30 ... | ... . .. ...
164 29: ... . .. ... | ... . .. ... | ... . .. ... | G-5 5 24 ... | ... . .. ...
165 30: ... . .. ... | C-6 3 10 ... | G-1 4 .. ... | B-5 5 28 ... | ... . .. ...
166 31: ... . .. ... | D-5 2 20 ... | G-2 4 .. ... | D-6 5 22 ... | ... . .. ...
169pattern 2 rows=32 {
170 # main groove B: Am C -> builds, arps climb
171 00: C-2 1 40 ... | C-6 3 20 ... | A-1 4 40 S10 | A-4 5 30 ... | A-2 6 30 ...
172 01: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
173 02: ... . .. ... | C-6 3 10 ... | A-1 4 .. ... | E-5 5 28 ... | ... . .. ...
174 03: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
175 04: C-2 1 40 ... | D-5 2 38 ... | ... . .. ... | A-5 5 30 ... | ... . .. ...
176 05: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
177 06: ... . .. ... | C-6 3 10 ... | A-1 4 .. ... | C-6 5 26 ... | ... . .. ...
178 07: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
179 08: C-2 1 40 ... | C-6 3 20 ... | A-1 4 .. S30 | B-5 5 30 ... | ... . .. ...
180 09: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
181 10: ... . .. ... | C-6 3 10 ... | A-1 4 .. ... | A-5 5 28 ... | ... . .. ...
182 11: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
183 12: C-2 1 40 ... | D-5 2 38 ... | ... . .. ... | E-5 5 30 ... | ... . .. ...
184 13: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
185 14: ... . .. ... | C-6 3 10 ... | G-1 4 .. ... | G-5 5 26 ... | ... . .. ...
186 15: ... . .. ... | C-6 3 18 ... | ... . .. ... | ... . .. ... | ... . .. ...
187 16: C-2 1 40 ... | C-6 3 20 ... | C-2 4 .. S50 | C-5 5 30 ... | C-3 6 30 ...
188 17: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
189 18: ... . .. ... | C-6 3 10 ... | C-2 4 .. ... | E-5 5 28 ... | ... . .. ...
190 19: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
191 20: C-2 1 40 ... | D-5 2 38 ... | ... . .. ... | G-5 5 30 ... | ... . .. ...
192 21: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
193 22: ... . .. ... | C-6 3 10 ... | C-2 4 .. ... | C-6 5 26 ... | ... . .. ...
194 23: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
195 24: C-2 1 40 ... | C-6 3 20 ... | G-1 4 .. S80 | B-5 5 30 ... | G-2 6 30 ...
196 25: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
197 26: ... . .. ... | C-6 3 10 ... | G-1 4 .. ... | G-5 5 28 ... | ... . .. ...
198 27: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
199 28: C-2 1 40 ... | D-5 2 38 ... | G-1 4 .. ... | D-5 5 30 ... | ... . .. ...
200 29: C-2 1 30 ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
201 30: C-2 1 38 ... | D-5 2 30 ... | G-1 4 .. 108 | B-4 5 28 ... | ... . .. ...
202 31: C-2 1 40 ... | D-5 2 38 ... | ... . .. ... | G-4 5 22 ... | ... . .. ...
205pattern 3 rows=32 {
206 # breakdown: pad + arps, drums drop, kick rolls back in
207 00: ... . .. ... | ... . .. ... | A-1 4 30 SFF | A-4 5 20 ... | A-2 6 38 ...
208 01: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
209 02: ... . .. ... | ... . .. ... | ... . .. ... | C-5 5 20 ... | ... . .. ...
210 03: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
211 04: ... . .. ... | ... . .. ... | ... . .. ... | E-5 5 22 ... | ... . .. ...
212 05: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
213 06: ... . .. ... | ... . .. ... | ... . .. ... | A-5 5 22 ... | ... . .. ...
214 07: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
215 08: ... . .. ... | ... . .. ... | ... . .. ... | C-6 5 24 ... | ... . .. ...
216 09: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
217 10: ... . .. ... | ... . .. ... | ... . .. ... | E-6 5 24 ... | ... . .. ...
218 11: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
219 12: ... . .. ... | ... . .. ... | ... . .. ... | A-5 5 22 ... | ... . .. ...
220 13: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
221 14: ... . .. ... | ... . .. ... | ... . .. ... | E-5 5 20 ... | ... . .. ...
222 15: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
223 16: ... . .. ... | C-6 3 14 ... | F-1 4 .. SC0 | F-4 5 20 ... | F-2 6 38 ...
224 17: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
225 18: ... . .. ... | C-6 3 10 ... | ... . .. ... | A-4 5 20 ... | ... . .. ...
226 19: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
227 20: ... . .. ... | C-6 3 14 ... | ... . .. ... | C-5 5 22 ... | ... . .. ...
228 21: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
229 22: ... . .. ... | C-6 3 10 ... | ... . .. ... | F-5 5 24 ... | ... . .. ...
230 23: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
231 24: C-2 1 28 ... | C-6 3 14 ... | G-1 4 .. S90 | G-4 5 26 ... | G-2 6 38 ...
232 25: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
233 26: C-2 1 30 ... | C-6 3 10 ... | ... . .. ... | B-4 5 26 ... | ... . .. ...
234 27: ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ... | ... . .. ...
235 28: C-2 1 34 ... | C-6 3 14 ... | G-1 4 .. ... | D-5 5 28 ... | ... . .. ...
236 29: ... . .. ... | D-5 2 20 ... | ... . .. ... | ... . .. ... | ... . .. ...
237 30: C-2 1 38 ... | D-5 2 28 ... | G-1 4 .. ... | G-5 5 30 ... | ... . .. ...
238 31: C-2 1 40 ... | D-5 2 38 R03 | G-2 4 .. ... | B-5 5 30 ... | ... . .. ...
241# ------------------------------------------------------------------ visuals
242# frame runs once per frame and publishes uniforms; pixel reads them.
243uniform zoom ang cx cy hue kickE glow mixk fold
245frame {
246 k = exp(-trig(0) * 7) # kick envelope
247 kickE = k
248 sn = exp(-trig(1) * 10) * step(0.5, vel(1)) # snare only (hats have low velocity)
249 pl = exp(-trig(3) * 9) # pluck envelope
250 glow = pl * 0.9 + sn * 0.5
252 # julia parameter orbits the cardioid boundary: always a lively set
253 a = beat * 0.045 * tau + 0.25 * sin(beat * 0.11) + 0.08 * k
254 rr = 0.7885 + 0.012 * sin(beat * 0.37)
255 cx = rr * cos(a)
256 cy = rr * sin(a)
258 # camera: slow breathing + kick punch + bar-wise rotation
259 zoom = 0.78 + 0.06 * sin(beat * 0.5 * pi) + 0.12 * k
260 ang = beat * 0.03 + 0.4 * sin(beat * 0.07)
261 hue = bar * 0.06 + pl * 0.05
262 mixk = 0.5 + 0.5 * sin(lbeat / llen * tau) # palette crossfade across the loop
263 fold = smooth(0.1, 0.9, 0.5 + 0.5 * sin(beat * 0.0625 * pi)) # kaleidoscope amount
266pixel {
267 # rotate + zoom view space
268 px = rot(u, v, ang)
269 py = r1
270 # kaleidoscope fold (mirror across x when fold is up)
271 px = mix(px, abs(px), fold)
272 zx = px / zoom
273 zy = py / zoom
275 it = julia(zx, zy, cx, cy, 72)
276 trap = r1
277 cross = r2
279 k = it / 72
280 inside = step(1, k) # 1 inside the set
281 near = log(1 + it * 0.5) / log(37) # 0 far from the set, 1 at its boundary (log scale)
282 tone = near * 2.4 + hue + cross * 0.08
283 pal(nebula, tone)
284 mixpal(ice, tone + 0.1, mixk * 0.7)
286 # brightness: edges pop, deep interior stays dark but pulses with the kick
287 cmul(mix(0.12 + 0.5 * kickE, 0.08 + 1.6 * near ^ 1.5, 1 - inside))
289 # orbit-trap glow follows the arp
290 g = exp(-trap * 6) * glow * (1 - inside)
291 cadd(g * 0.9, g * 0.5, g * 0.2)
293 # subtle vignette + centre flash on kick
294 d = len(u, v)
295 cmul(1 - 0.35 * d * d)
296 cadd(kickE * 0.08 * exp(-d * 2), kickE * 0.03, kickE * 0.1 * exp(-d * 2))

Click a line number to link to that line.