create/update 'music box.md' file

This commit is contained in:
littleisland 2025-11-11 13:46:03 +09:00
parent 6e6ec38afa
commit fc9a8a0cd7

96
strudel/music box.md Normal file
View File

@ -0,0 +1,96 @@
```javascript
await initHydra({detectAudio: true})
noise(3, 0.1)
.color(0.6, 0.6, 0.6)
.rotate(() => time * 0.05)
.scale(() => 1 + Math.sin(time * 0.5) * 0.3 + a.fft[1] * 0.4)
.modulate(
noise(2, 0.2),
() => 0.03 + a.fft[2] * 0.05
)
.add(
noise(4, 0.15)
.color(0.9, 0.9, 0.9)
.rotate(() => -time * 0.03),
0.5
)
.brightness(0.35)
.contrast(() => 1.2 + Math.sin(time * 0.3) * 0.1)
.out()
setcps(60/60/4)
$:xfade(
stack(
note("<[c4 d4 e4 g4 a4] [g4 a4 c5 d5] [e4 g4 a4 c5] [c4 e4 g4 a4]>")
.s("sine").slow(4).decay(0.5).gain(sine.range(0.3,0.7).slow(5))
.someCyclesBy(0.5, x=>x.transpose(-7)),
note("<[c4,e4] [d4,f4] [e4,g4] [g4,b4]>")
.s("sine").decay(0.5).gain(cosine.range(0.3,0.6).slow(4)),
note("c2 - c2 c3 - c2 - c3").fast(2)
.s("sine").gain(sine.range(0.3,0.6).slow(7)),
).orbit(1)
.pan(cosine.range(0.3,-0.3).slow(4))
.room(perlin.range(0.3,0.6).slow(4)).size("3|2|4")
.lpf(berlin.range(300,2400).slow(13)),
sine.range(0,1).seg(32).slow(32),
stack(
note("<[e4 g4 c5] [f4 a4 d5] [g4 b4 e5] [e4 g4 c5]>")
.s("sine").decay(0.5).slow(3).gain(sine.range(0.4,0.7).slow(8))
.someCyclesBy(0.3, x=>x.transpose("<-7 2>/4")),
note("c5 e5 g5 c6 g5 e5")
.s("sine").decay(0.5).fast(2).gain(sine.range(0.2,0.5).slow(7)),
note("<c2 d2 e2 c2>").fast(2).s("sine").decay(0.5).gain(sine.range(0.3,0.6).slow(6)),
).orbit(2)
.pan(sine.range(0.6,-0.6).slow(5))
.room(berlin.range(0.2,0.7).slow(3)).size("2|3|5")
.lpf(perlin.range(100,2400).slow(11)),
).delay("<0.4 0.6 0.8>").dt(0.3)
.dfb(0.7).fast(sine.range(1,3).slow(24)).postgain(1)
```