THRESHOLD
threshold.dmt · 112 BPM · 17 s · 480×300
procedural
notes
A portal cut through an embedded starfield texture. Branches choose the picture inside it and the sound of the opening transient.
| music | pulse, snare, bass and FM glints with a branched kick attack |
|---|---|
| visual | a moving portal into a warped embedded PPM nebula; nested if/else selects the expensive inner field, a dim outer sky, selective edge glow and post bloom |
| file | threshold.dmt |
|---|---|
| duration | 0:17 |
| video | 480×300 · 24 fps · h264 + audio · 832 KB |
| song | 112 BPM · speed 6 · rpb 4 · 4 channels |
| loop | 0 |
| render | scale 1 · dither on · master 0.7 |
| uniforms | radius shimmer |
| collection | Demos |
| tags | procedural |
| source | 133 lines · 4 KB · download |
anatomy
8VM programs
2patterns
0palettes
0timeline events
2text / sample / texture
133source lines
4inst
0chan
1master
1frame
1pixel
1post
0fn
line composition
pixel 34%pattern 30%inst 16%post 7%master 4%frame 3%title 1%song 1%order 1%pan 1%uniform 1%text 1%texture 1%
play order
01011010
order list · 8 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 | caption | 17 | T H R E S H O L D |
| texture | nebula | assets/threshold-nebula.ppm |
source
1# @description A portal cut through an embedded starfield texture. Branches choose the picture inside it and the sound of the opening transient.
2# @tags procedural
3# @collection Demos
4# @music pulse, snare, bass and FM glints with a branched kick attack
5# @visual a moving portal into a warped embedded PPM nebula; nested if/else selects the expensive inner field, a dim outer sky, selective edge glow and post bloom
6# threshold.dmt — a portal cut through an embedded PPM starfield.
7# The inside uses a warped texture and geometric detail; the outside skips that
8# work entirely. Branches also choose the sound of the opening transient.
9title THRESHOLD
10song bpm=112 speed=6 rpb=4 channels=4 loop=0 volume=0.7 scale=1 dither=1
11order 0 1 0 1 1 0 1 0
12pan 0.5 0.55 0.5 0.7
13texture nebula "assets/threshold-nebula.ppm"
14text caption "T H R E S H O L D"
15uniform radius shimmer
17inst pulse {
18 if (t < 0.035) {
19 out(sin(tau * (92 - t * 1200) * t) * exp(-t * 32) * 0.65 + noise() * exp(-t * 170) * 0.16)
20 }
21 else {
22 out(sin(tau * 49 * t) * exp(-t * 8) * 0.75)
23 }
24}
25inst snare {
26 out(hp(noise(), 1200) * exp(-t * 18) * 0.34)
27}
28inst bass {
29 e = env(0.02, 0.2, 0.45, 0.3)
30 out((sin(ph * tau) + 0.18 * saw(ph)) * e * 0.5)
31}
32inst glint {
33 e = env(0.005, 0.5, 0, 0.5)
34 out((sin(ph * tau + 0.9 * sin(ph * tau * 2)) + sin(ph * tau * 2.01) * 0.25) * e * 0.25)
35}
36master {
37 dl = dly(l, 0.268, 0.38)
38 dr = dly(r, 0.402, 0.35)
39 out(l + dr * 0.25, r + dl * 0.25)
40}
42pattern 0 rows=16 {
43 C-2 1 38 | . | C-2 3 32 | C-5 4 20
44 . | . | . | .
45 . | . | . | G-5 4 18
46 . | . | . | .
47 C-2 1 30 | D-4 2 25 | . | E-5 4 1C
48 . | . | . | .
49 . | . | G-2 3 2E | D-5 4 18
50 . | . | . | .
51 C-2 1 38 | . | C-2 3 32 | C-5 4 20
52 . | . | . | .
53 . | . | . | A-5 4 18
54 . | . | . | .
55 C-2 1 30 | D-4 2 25 | . | G-5 4 1C
56 . | . | . | .
57 . | . | G-2 3 2E | E-5 4 18
58 . | . | . | .
59}
60pattern 1 rows=16 {
61 C-2 1 38 | . | A-1 3 32 | A-5 4 20
62 . | . | . | .
63 . | . | . | G-5 4 18
64 . | . | . | .
65 C-2 1 30 | D-4 2 25 | . | E-5 4 1C
66 . | . | . | .
67 . | . | E-2 3 2E | D-5 4 18
68 . | . | . | .
69 C-2 1 38 | . | A-1 3 32 | C-6 4 20
70 . | . | . | .
71 . | . | . | A-5 4 18
72 . | . | . | .
73 C-2 1 30 | D-4 2 25 | . | G-5 4 1C
74 . | . | . | .
75 . | . | E-2 3 2E | E-5 4 18
76 . | . | . | .
77}
79frame {
80 radius = 0.38 + 0.12 * smooth(0, 16, beat) + 0.035 * sin(beat * tau * 0.25)
81 shimmer = exp(-trig(0) * 9)
82}
84pixel {
85 cx = u * 0.72
86 cy = v * 1.12 + 0.04
87 d = len(cx, cy)
88 # Cheap backdrop: one bilinear sample of the embedded RGB image.
89 back = tex(nebula, x, y)
90 bg = r1
91 bb = r2
92 if (d < radius) {
93 # Only portal pixels pay for domain warping and a folded geometric field.
94 warp = fbm(cx * 4 + beat * 0.09, cy * 4, 4) - 0.5
95 rr = tex(nebula, fract(x * 1.8 + warp * 0.22 + beat * 0.015), fract(y * 1.8 + warp * 0.13))
96 gg = r1
97 bl = r2
98 foldline = kifs(cx * 1.7 + warp * 0.15, cy * 1.7, 1.63, beat * 0.025, 5)
99 veins = exp(-foldline * 17) * 0.38
100 core = exp(-d * 9) * (0.2 + 0.35 * shimmer)
101 rgb(rr * 1.2 + veins * 0.25 + core * 0.4, gg * 1.25 + veins * 0.6 + core * 0.6, bl * 1.35 + veins + core)
102 }
103 else {
104 if (v < -0.45) {
105 # A quiet reflection below the horizon.
106 rgb(back * 0.12, bg * 0.15, bb * 0.23 + 0.015)
107 }
108 else {
109 rgb(back * 0.27, bg * 0.28, bb * 0.45)
110 }
111 }
112 edge = abs(d - radius)
113 if (edge < 0.065) {
114 glow = exp(-edge * 65) * (0.65 + 0.3 * shimmer)
115 cadd(glow * 0.6, glow * 0.83, glow)
116 }
117 # The label is rasterized only in its narrow band.
118 if (v < -0.64 && v > -0.8) {
119 tx = (u + 0.95) / 0.105
120 ty = (-v - 0.64) / 0.13
121 letter = glyph(str(caption, floor(tx)), fract(tx), ty)
122 cadd(letter * 0.38, letter * 0.67, letter)
123 }
124}
126post {
127 # Bright portal edges receive a small horizontal bloom; dark sky is untouched.
128 if (cget(2) > 0.48) {
129 left = tap(-2, 0)
130 right = tap(2, 0)
131 cadd((left + right) * 0.055, (r1 + r2) * 0.02, (r1 + r2) * 0.035)
132 }
133}
Click a line number to link to that line.