رفتن به محتواCREATIVE·CODE·ART
112
0.4
1
1
1
Strudel (music)

Orbit Garden

این یک اثر موسیقی است. پیش از پخش، این گل از روی کد خود اثر کشیده می‌شود، پس هر اثر موسیقی گل خودش را دارد. دکمه‌ی پخش را بزنید تا گلبرگ‌ها با صدا حرکت کنند. چطور کار می‌کند

مجوز: CC BY-NC-SA 4.0: ریمیکس با ذکر نام، غیرتجاری، با همین مجوز

دیدن کد
// Orbit Garden: a slow-blooming generative piece.
// Nothing here is recorded: every note is chosen while you listen.
// Mood picks the scale, Energy fills in the rhythm, Brightness opens the filters,
// Space opens the echo and the room. Move them and the garden answers on the next beat.
setcps(params.tempo / 60 / 4);

// 'single quotes' are plain text; "double quotes" would be read as patterns.
const moods = ['minor:pentatonic', 'dorian', 'lydian', 'major:pentatonic'];
const mood = moods[Math.round(params.mood)];
const low = 'C2:' + mood;
const mid = 'C3:' + mood;
const high = 'C4:' + mood;

stack(
  // pad: wide, slow chords that breathe through a filter
  n("<[0,2,4] [-1,1,4] [-2,0,3] [1,3,5]>")
    .scale(mid)
    .s("supersaw")
    .attack(0.6)
    .release(2.5)
    .lpf(sine.range(300, 600 + params.brightness * 3500).slow(16))
    .room(0.3 + params.space * 0.6)
    .gain(0.22),

  // bass: one root per bar, moving with the chords
  n("<0 -1 -2 1>")
    .scale(low)
    .s("sawtooth")
    .lpf(180 + params.brightness * 700)
    .decay(0.35)
    .sustain(0.4)
    .gain(0.5),

  // arpeggio: notes chosen at random from the scale, thinning out as energy drops
  n(irand(8).segment(8))
    .scale(high)
    .s("triangle")
    .decay(0.22)
    .sustain(0)
    .degradeBy(1 - params.energy)
    .delay(params.space * 0.7)
    .delaytime(0.375)
    .delayfeedback(0.45)
    .pan(sine.slow(3))
    .gain(0.45),

  // pulse: a soft kick in a 3-against-8 pattern, only once there's some energy
  note("c1(3,8)")
    .s("sine")
    .decay(0.25)
    .sustain(0)
    .gain(params.energy > 0.25 ? 0.85 : 0),

  // air: brushed noise, busier with energy
  s("white*8")
    .decay(0.03)
    .sustain(0)
    .hpf(7000)
    .degradeBy(1 - params.energy * 0.9)
    .gain(0.12)
);