Terrarium / a listening sketch

Same seeds,
two melodies.

A cellular automaton or seeded pseudorandom generator makes 64 choices. Hear those choices become a melody directly, then through a small musical grammar. Each phrase lasts 16 seconds, with the same rhythm, sine voice, envelope, and gain.

Silent. Choose a phrase to listen.

Gold: free · Mint: constrained. Left to right: 64 eighth notes. Higher marks mean higher pitches. A new Play always starts at the beginning; switching stops the previous phrase. Start with a comfortable volume.

Listen to all four · 67 seconds

  1. Automaton · free
  2. Automaton · constrained
  3. Seeded random · free
  4. Seeded random · constrained

Four 16-second phrases with one-second pauses. Volume stays fixed during the comparison; Stop or either Play ends it. The score above shows the built pair. A built random pair compares against automaton rule 30. Pending form edits take effect only after Build pair.

The JSON keeps the exact notes, order, source recipes, seed, rule and current volume. This fixed order is an informal listening aid; order may influence your impression.

What changes?

The free mapping picks from C4, D4, E4, F4, G4, A4, B4, C5. The constrained mapping repeats an eight-note motif with small variations, favors nearby notes, and places the start of each two-beat group in C, Am, F, then G harmony. There is no accompanying chord sound.

Try humming each phrase back. Which has a more recognizable shape? Which surprises you? The names describe the mappings, not a verdict about quality. Switch the choice source, keep the seed, and build again: does the grammar give both sources a similar shape? The same seed makes each source repeatable; it does not make their choices equal. This is an open comparison, not a blinded listening study. Equal gain does not guarantee equal perceived loudness.

Inspect and reuse

WAV saves the built phrase at the current volume: 16 seconds, mono, 44.1 kHz, 16-bit PCM. Export is silent and does not start or stop playback. Both exports use the same voice as Play; keep volume fixed when comparing.

Paste this adapter into Daimon. Its timing and voice defaults may differ; the matched comparison lives on this page. Strudel repeats until stopped.

Exact recipe and note data

For the automaton source, a circular row has 31 binary cells. Seed bits 0–15 fill cells 0–15, least significant first; other cells start empty. After 16 warm-up updates, before each further update, cells 12–19 form one unsigned eight-bit number, leftmost most significant. Standard elementary-rule lookup uses 4×left + 2×center + right.

For seeded random, xorshift32 starts with the selected nonzero seed as an unsigned 32-bit state. Each choice updates state with XOR-left-shift 13, XOR-unsigned-right-shift 17, XOR-left-shift 5, then takes the high eight bits. There is no warm-up. This deterministic pseudorandom source uses no fresh randomness. Both sources feed the exact same two mappings below; JSON records the source, algorithm version, choices, and notes.

Free pitch index = choice mod 8. Constrained target uses the first eight free indices as a repeated motif. After step 7, add (current choice mod 3) − 1, clamping to 0–7. At steps divisible by 4 restrict candidates to chord pitch classes: [0,4,7], [9,0,4], [5,9,0], [7,11,2], one chord per 16 steps. Otherwise all eight pitches qualify. Minimize |pitch−target| + 0.5×|pitch−previous|, breaking ties downward; previous starts at MIDI 60. The motif target varies by at most one scale step; chord and proximity choices can move the final note further.

120 BPM, one note every 0.25 seconds, 0.20-second gate, peak gain 0.16 before master volume. Sine oscillator; 10ms attack and 30ms release. No autoplay, network samples, or microphone. Hiding the page stops playback.

Explore the rule garden · Generator source