The Whimsy Machine Manual

Deterministic Esoteric Parlor Orchestration, Apparition Vitrine & One-Finger Accompanist

Comprehensive 3x technical manual documenting what each component does, how its execution and audio/visual mechanisms operate, and why it is designed under strict zero-dependency and esoteric computation invariants.

Version 1.1.0Zero-DependencyClient-OnlyLOLCODE 1.2Malbolge 1998Brainfuck 1993Befunge-93Piet 2001FRACTRAN 1987Shakespeare SPLEuler-Tonnetz
The 3x reading contract: every entry explains what it does, how it works, and why it works that way.
No entries match that search.

Foundations & Architectural Boundaries

Core deterministic seed generation, interpreter boundaries, score validation, and zero-dependency guarantees.

Phrase Normalization & Deterministic Seed Hashing

#
foundationsdeterminismsecurity

Transforms arbitrary human text input into an immutable unsigned 32-bit seed.

What it does

Accepts user text up to 72 characters, trims surrounding whitespace, collapses internal whitespace sequences into single ASCII spaces, converts text to lowercase, and hashes the normalized string into an unsigned 32-bit integer. Rejects empty phrases or whitespace-only inputs at the boundary.

How it works

The normalization and hashing pipeline follows a strict pure functional path in src/score.mjs:

  1. normalizePhrase() applies Unicode normalization, lowercasing, and regex space collapsing s.trim().toLowerCase().replace(/\s+/g, ' ').
  2. hashPhrase() executes a 32-bit FNV-1a non-cryptographic dispersion algorithm using offset basis 0x811c9dc5 and prime 0x01000193.
  3. Bitwise operations (Math.imul and >>> 0) guarantee that the resulting integer remains unsigned and bit-identical across JavaScript engines on all platforms.

Why it works this way

A creature's identity depends on exact determinism: confiding identical words must invariably summon the identical specimen. Using FNV-1a on normalized text avoids cross-browser string hashing discrepancies while forgiving accidental double spaces and letter case differences without altering semantics (ADR D-003).

Evidence
  • Hashing implementation src/score.mjs
  • Determinism unit tests tests/oracle.test.mjs
  • Architecture Record D-003 docs/DECISIONS.md

LOLCODE 1.2 Interpreted Score Engine

#
interpreterlolcodegenerative

Executes the generative score spell inside a purpose-built in-browser LOLCODE interpreter.

What it does

Executes src/oracle.lol locally in JavaScript. The spell acts as the causal bandleader of the universe: it seeds every visual property, anatomical feature, musical mode, and accompaniment parameter across all six languages, emitting key=integer pairs.

How it works

The interpreter in src/lolcode.mjs implements an honest, spec-compliant subset of LOLCODE 1.2:

  1. Parses HAI 1.2 through KTHXBYE and manages a dynamic symbol table with lexical scoping.
  2. Executes variable declaration (I HAS A), assignment (R), math operations (SUM OF, DIFF OF, PRODUKT OF, QUOSHUNT OF, MOD OF), Boolean logic (BOTH OF, EITHER OF, NOT), condition blocks (O RLY? / YA RLY / NO WAI / OIC), switches (WTF? / OMG / OMGWTF), loops (IM IN YR / IM OUTTA YR), and printing (VISIBLE).
  3. Injects the normalized phrase seed as an initial global variable INPUT_SEED.
  4. Fails closed with exact line numbers and statement context whenever unsupported syntax or uninitialized variables are encountered.

Why it works this way

Rather than generating parameters through arbitrary JavaScript math, every creature's soul originates in LOLCODE. Purpose-building the interpreter avoids bundling heavy third-party runtimes, preserves the zero-dependency contract, and guarantees that errors are debuggable with precise line numbers (ADR D-002).

Evidence
  • LOLCODE runtime source src/lolcode.mjs
  • Canonical score spell src/oracle.lol
  • Syntax error regression tests tests/oracle.test.mjs
  • Architecture Record D-002 docs/DECISIONS.md

Immutable Generative Score Grammar & Allowlist Validation

#
validationscoresecurity

Validates every output parameter against strict allowable keys and numeric bounds before rendering.

What it does

Parses raw text emitted by src/oracle.lol into an immutable, frozen score object. Ensures that every required field is present exactly once and within valid range bounds, rejecting unknown keys, malformed integers, or missing properties.

How it works

parseScore() in src/score.mjs enforces an exhaustive schema check on the spell's key-value lines:

  1. Splits stdout into lines, verifies key=value format, and rejects duplicates or unauthorized field names.
  2. Validates numerical ranges for visual traits (hue 0..359, size 36..100, shape 0..9, symmetry 2..15, bloom 0..100, edge 0..100, motion 0..100, eyes 1..9, irisStyle 0..7, pupilShape 0..7, irisHue 0..359, eyeLayout 0..5, kineticMode 0..7, kineticSpeed 20..100, kineticDepth 20..100, kineticTilt 0..7, fluxMode 0..7).
  3. Validates numerical ranges for lead audio (pulse 42..167, waveform 0..3, voice 0..5, rhythm 0..5, melodyMode 0..11, melodyTurn 0..11, root 36..60, scale 0..7, gate 40..95) and accompaniment engines (beatMode 0..7, beatDensity 35..100, bassMode 0..7, bassGlide 20..100, harmonyMode 0..7, harmonyStrum 15..100, chimeMode 0..7, chimeShimmer 20..100, chantMode 0..7, chantFormant 25..100).
  4. Composes an evocative multi-tier ceremonial name using seed-driven vocabulary matrices (64 adjectives, 64 nouns, 64 actions, 32 realms, 10 grammatical templates) along with deterministic specimen folio identifiers, bell jar numbers, and archival curiosa classes.
  5. Returns a deeply frozen Object.freeze() score structure.

Why it works this way

Treating interpreter output as an untrusted boundary prevents corrupted, NaN, or out-of-range values from reaching Web Audio or Canvas. Audio nodes can produce speaker damage or ear injury if fed infinite or NaN frequencies; strict validation guarantees safe audio synthesis and predictable visual framing (ADR D-004).

Evidence
  • Score parser and validator src/score.mjs
  • Validation test assertions tests/oracle.test.mjs
  • Architecture Record D-004 docs/DECISIONS.md

Zero-Dependency & Client-Only Privacy Boundary

#
privacyofflinezero-dependency

Maintains an unyielding guarantee that all computation, rendering, and synthesis occur locally on-device.

What it does

Executes entirely in modern evergreen web browsers using native HTML5, CSS3, Canvas 2D, and Web Audio APIs. Transmits zero telemetry, analytics, cookies, local storage entries, or network requests after initial static file fetch.

How it works

The zero-dependency discipline is enforced both architecturally and by automated CI tests:

  1. tests/static.test.mjs scans all authored source files, asserting that no http:// or https:// URLs, external CDN imports, or node_modules references exist.
  2. All six esoteric programs (src/oracle.lol, src/beat.mal, src/bass.bf, src/harmony.bfg, src/pad.piet, src/chimes.frac, src/chant.spl) are bundled as plain static text files served from the same HTTP origin.
  3. No server-side processing, database, or cloud infrastructure is involved.

Why it works this way

Privacy, speed, and durability are non-negotiable architectural pillars. Relying on remote servers or third-party CDNs introduces tracking risks, network latency, bit rot, and external failure points. A static zero-dependency toy remains functional indefinitely (ADR D-001).

Evidence
  • Static asset scanner test tests/static.test.mjs
  • Architecture Record D-001 docs/DECISIONS.md
  • Security documentation docs/SECURITY.md

Esoteric Victorian Parlor Cabinet & Broadsheet Styling

#
uidesigncsstypography

Immerses the user in a 19th-century macabre spiritualist chamber and specimen broadsheet.

What it does

Frames the oracle not as a generic digital app or flat modern widget, but as a centered antique spiritualist cabinet featuring an arched bell-jar apparition vitrine, engraved book-serif typography, telegraph monospace, foxed vellum textures, ebonized wood, and tarnished brass rules.

How it works

The visual system in styles.css builds rich textures entirely through CSS without external image binaries:

  1. Employs a high-contrast palette of oxblood (#6b1f28), tarnished brass (#b89249), bright brass (#d9b86c), foxed vellum (#f4ede2), and ebonized wood (#120e0c).
  2. Uses system book serifs (Palatino Linotype, Book Antiqua, Iowan Old Style, Georgia) and telegraph monospace (Courier New, Courier), avoiding external web font downloads.
  3. Renders ornamental spandrels, astrolabe rings, and eye crests via inline SVGs embedded directly in the markup.
  4. Provides responsive reflow across desktop, tablet, and mobile with accessible touch targets, high contrast, and prefers-reduced-motion overrides.

Why it works this way

Art direction moved decisively away from generic futuristic dark modes or pastel storybooks to a bespoke, eccentric Victorian macabre parlor aesthetic. Using layered CSS gradients and system fonts delivers tactile richness without sacrificing performance or violating zero-dependency boundaries (ADR D-011).

Evidence
  • Interface stylesheet styles.css
  • Cabinet markup shell index.html
  • Design system tests tests/static.test.mjs
  • Architecture Record D-011 docs/DECISIONS.md

Visual Anatomy & Kinetic Apparition (Plate I)

Procedural biological forms, dynamic silhouette deformation, rotating 4D tesseract cores, and interactive vitrine gestures.

Clamped Kinetic Silhouette & Deforming Boundary Flux

#
graphicscanvasgeometry

Renders organic, undulating perimeter boundaries clamped strictly within a visible envelope.

What it does

Computes a continuous closed boundary path for the creature using one of ten base shape archetypes (oval, bell, spindle, tesseract, clover, crescent, lantern, diamond, amphora, scarab) deformed by one of eight seed-selected flux grammars (breathing ripple, traveling peristalsis, nodal pulsation, standing wave, cardioid heartbeat, chaotic flux, twist wave, crystalline facet).

How it works

traceBody() in src/app.mjs executes procedural polar coordinate mathematics:

  1. Evaluates points radial vertices around $2\pi$ radians.
  2. Computes base radius $r(\theta)$ from the creature's shape harmonics and symmetry index.
  3. Applies time-varying flux offsets $\Delta r(\theta, t)$ driven by elapsed seconds, flux mode frequency, and interactive touch deformation.
  4. Strictly clamps the normalized radius envelope to $[0.38, 1.08]$ to prevent visual clipping or stage escape.
  5. Applies an isolated radial glow on the body fill pass, then clears shadowBlur before kinetic linework to maintain 60 FPS performance.

Why it works this way

Early prototypes suffered from jittery pulse-dominated blobs that repeatedly broke past canvas boundaries or lagged due to unconstrained shadow blur. Clamping the deformation mathematically and clearing the body glow ensures fluid, organic movement within the bell jar (ADRs D-007, D-008).

Evidence
  • Body trace algorithm src/app.mjs
  • Boundary containment tests tests/static.test.mjs
  • Architecture Records D-007, D-008 docs/DECISIONS.md

Bounded Internal Kinetic Systems & 4D Projected Tesseract

#
graphics4d-projectionmathematics

Animates independent mathematical motion systems clipped within the deforming creature boundary.

What it does

Renders one of eight sophisticated kinetic systems moving inside the creature's body: a four-dimensional rotating hypercube (tesseract), orbiting astrolabe rings, concentric hypocycloid gears, phyllotaxis spiral florets, Lissajous harmonograph knots, double pendulum chaos traces, nested chiral polyhedra, or a self-weaving crystal network.

How it works

drawKineticCore() in src/app.mjs clips rendering to the active traceBody() path:

  1. For drawTesseract(), defines 16 four-dimensional vertices $(\pm 1, \pm 1, \pm 1, \pm 1)$ and 32 connecting edges.
  2. Applies continuous 4D rotation matrices in the $XW$ and $YZ$ planes parameterized by elapsed * speed.
  3. Performs two-stage 4D-to-3D-to-2D perspective projection onto the 2D Canvas.
  4. Styles lines with palette-derived semitransparent stroke gradients and dynamic thickness based on touch velocity.

Why it works this way

Static creatures felt flat and lifeless. Projecting true multidimensional mathematical structures into the clipped interior creates an authentic sense of an ethereal, impossible specimen trapped under glass (ADR D-007).

Evidence
  • Kinetic core renderers src/app.mjs
  • Kinetic mode test suite tests/oracle.test.mjs
  • Architecture Record D-007 docs/DECISIONS.md

Generative Fungal Appendages, Cellular Organelles, & Botanical Tropism

#
graphicsanatomymycologycellularinteractivity

Composes cellular organelles, sporangial fruiting bodies, and botanical appendages responding to touch tension and vitrine dynamics without ocular animal sclera.

What it does

Replaces ocular animal eyeballs with generative fungal fruiting bodies, sporangia, cellular organelles, and botanical appendages inspired by Victorian biological lithography and Ernst Haeckel. Produces 8 distinct appendage archetypes (Sporangium Globule, Ciliated Flagellum, Bioluminescent Vacuole, Ascus Spore-Sac, Stipitate Hydathode, Anastomosing Cirri, Pholiota Phosphor-Gland, Cellular Platelet Rosette), 8 internal organelle textures (cyclosis sol-gel, lipid bilayers, cytoskeletal microtubules, mitochondrial granules, thylakoid crescents, endoplasmic reticulum, aster spicules, chitin corona), 8 germ aperture cores (nucleolus, dehiscence slit, stomatal cleft, crystal inclusion, radiolarian aster, spore tetrad, annular lumen, trilete suture), and 6 colonization layouts (orbital rosette, bilateral branching, golden spiral, dorsal crescent, cellular colony cluster, axial hyphal spine).

How it works

drawCellularAppendage() in src/app.mjs positions and animates biological appendages derived deterministically from the score:

  1. Distributes appendages using orbital rosettes, bilateral flanks, golden phyllotaxis spirals, dorsal crescents, cellular colony clusters, or axial hyphal spines.
  2. Applies thigmotropic/phototropic orientation toward pointer touch coords during vitrine interaction, flexing stalks and tendrils smoothly.
  3. Quivers appendages and trembles guttation nectar droplets during vitrine glass tapping.
  4. Bristles cilia, intensifies organelle warning luminescence, and whips flagella at high frequency as vitrine agitation escalates.
  5. Surges appendages forward with incandescent discharge flare during retaliatory strikes, and curls them inward into a defensive huddle during sulk recovery.

Why it works this way

Ocular animal eyeballs (white scleras, irises, black pupils) felt discordant and jarringly cartoonish on an esoteric fungal/cellular organism. Replacing them with authentic generative fruiting bodies, spore pods, glandular hydathodes, and cellular organelles deepens the cabinet's Victorian bio-luminescent botanical and mycological aesthetic while maintaining 100% causal determinism with the underlying LOLCODE score (ADR D-049).

Evidence
  • Cellular appendage renderers src/app.mjs
  • Deterministic score batch test tests/oracle.test.mjs
  • Static vitrine tests tests/static.test.mjs
  • Architecture Record D-049 docs/DECISIONS.md

Expressive Touch/Pointer Gestures & Harmonic Field Modulation

#
audiocanvasgesturesperformance

Transforms the apparition vitrine into a live expressive performance instrument.

What it does

Allows the user to tap, hold, and drag directly across the glass vitrine (#vision). Gestures trigger synthesized membrane and glass percussion, elastic silhouette deformation, filter sweeps, echo swell, and polar harmonic phase shifting without mutating the underlying deterministic score.

How it works

Pointer events (pointerdown, pointermove, pointerup) feed an active session state interaction:

  1. Tapping triggers synthesized multi-partial glass strike plucks and expands shockwave ripples on the vitrine.
  2. Rapid repeated tapping escalates organism agitation: appendages bristle and whip frantically, organelle cores flare with warning luminescence, perimeter contours jitter, and filter resonance sharpens.
  3. Crossing the irritation threshold triggers a retaliatory strike: the creature lunges forward against the glass, unleashing an explosive sub-bass cabinet boom, high-tension glass snap, bio-acoustic snarl, phosphorescent stress fractures, radial discharge flash, and vitrine shudder before retreating into defensive sulk recovery.
  4. Holding swells filter cutoff/resonance, dry/wet mix, echo feedback, and morphs the silhouette toward a secondary shape family.
  5. Dragging maps $(x, y)$ coordinates into polar $(r, \theta)$ via harmonicField(), crossfading the creature's motif through a consonant $(\cos\alpha, \sin\alpha)$ harmonic phase shift and three-partial drone choir (-12, -5, +7).
  6. Releasing the pointer smoothly decays all offsets back to resting values via exponential smoothing.

Why it works this way

A passive generative visualizer grows stale quickly. Letting users directly disturb the apparition turns the parlor vitrine into a musical instrument while preserving the core premise: releasing the glass allows the creature to return to its pure, immutable identity (ADR D-012).

Evidence
  • Pointer interaction logic src/app.mjs
  • Vitrine interaction tests tests/static.test.mjs
  • Architecture Record D-012 docs/DECISIONS.md
  • Architecture Record D-048 docs/DECISIONS.md

Procedural Mycelial Network, Botanical Staging, & Bio-Acoustic Sonification

#
graphicscanvasmycologyproceduralbio-acousticsstaging

Simulates living mycelial colonization, Victorian vitrine staging, Haeckel engravings, and bio-acoustic sonification.

What it does

Simulates a living Victorian botanical specimen rooted in an antique turned-wood mahogany pedestal and fibrous peat substrate. Branching hyphal filaments colonize the vitrine and mature over a 10-second envelope, sprouting eight generative sporophore archetypes (Agaric Cap, Bracket Conk, Coral Clavaria, Bioluminescent Bonnet, Cup Peziza, Morel Honeycomb, Globular Puffball, Hyphal Hydra) etched with Ernst Haeckel lithographic anatomy. Condensation micro-droplets cling to the curved bell jar, while Web Audio synthesizes bio-electric action potentials, guttation droplet chimes, and tactile ballistospore puffs.

How it works

buildMycelialNetwork(), drawVitrinePedestal(), drawGlassCondensation(), and scheduleFungalBioStep() in src/app.mjs (with myceliumEvents() in src/mycelium.mjs) execute botanical synthesis:

  1. Renders an antique turned-wood mahogany specimen pedestal with polished brass channel ring and fibrous peat/driftwood substrate mounds grounding hyphal rootlets.
  2. Generates 46 deterministic dew condensation micro-droplets clinging along the curved glass profile of the vitrine bell jar, vibrating on tap gestures and catching specimen bloom.
  3. Etches eight sporophore archetypes with Ernst Haeckel-style lithographic details: radiating lamellae, stippled universal veil verrucae, growth sulci, fimbriate eyelash rims, scalariform alveoli, and aculei teeth.
  4. Gives each sporophore form its own voice (src/mycelium.mjs): an AGARIC CAP clicks and drips, a BRACKET CONK knocks like wood, a CORAL CLAVARIA glints in rising glassy trains, a BIOLUMINESCENT BONNET rings slow chords, a CUP PEZIZA bloops, a MOREL HONEYCOMB ticks, a GLOBULAR PUFFBALL breathes soft clouds, and a HYPHAL HYDRA chirps. Hyphae lengthen the spike trains and rotate the patterns, spores thicken the puffs, and bloom tilts every pitch (D-042).
  5. Maintains a 35 to 85 particle ballistospore cloud discharging explosive percussive noise puffs and downward pitch chirps when the vitrine glass is disturbed.

Why it works this way

Transforms the apparition from a floating geometric shape into a preserved Victorian cryptogamic specimen firmly mounted inside physical glass. Grounding substrate, glass condensation, anatomical lithography, and bio-acoustic sonification produce a multisensory experience of living antique science (ADR D-017, ADR D-018).

Evidence
  • Mycelial and vitrine generators src/app.mjs
  • Score grammar validation src/score.mjs
  • Mycelial and staging tests tests/static.test.mjs
  • Architecture Records D-017 & D-018 docs/DECISIONS.md

Autopoietic Creative Determinant & Fractal Morphogenesis

#
autopoiesisfractalscreative-determinantstrange-attractortonnetz

Models the creature as a living autopoietic entity governed by Project Navi's Creative Determinant equation and multi-scale fractal dynamics.

What it does

Integrates Nelson Spence's Creative Determinant (CD) field theory and fractal dynamics into the creature's visual morphogenesis and sonic behavior. The nonlinear elliptic equation (L Φ)_x = a ||∇Φ||_x + b Φ_x - c (Φ_x^+)^p balances Coherence (Laplacian diffusion), Contradiction (gradient transport), and Care (nonlinear boundary saturation).

How it works

src/autopoiesis.mjs and src/vitrine-canvas.mjs implement discrete CD dynamics and fractal attractors:

  1. Solves the discrete CD equation on circular S^1 perimeter graphs and the 12-node Neo-Riemannian Tonnetz torus.
  2. Checks spectral viability (λ_1(L - diag(b)) < 0) via power iteration on the shifted graph Laplacian operator.
  3. Blends self-similar Weierstrass fractal fluting into perimeter radius calculations (fluxOffset), scaled by gestural agitation.
  4. Renders deterministic Clifford strange attractor dust (drawStrangeAttractorDust) within the creature's glowing core.
  5. Provides Golden-Ratio Fibonacci delay tap cascades and self-similar recursive arpeggiation for harmonic accompaniment.

Why it works this way

Elevates the summoned creature from a static procedural rendering into a genuinely autopoietic, self-maintaining organism that transforms under touch and harmonic exploration while preserving its topological identity within the vitrine (D-083).

Evidence
  • Autopoiesis Engine src/autopoiesis.mjs
  • Autopoiesis & Fractal Suite tests/autopoiesis.test.mjs
  • Vitrine Canvas Renderer src/vitrine-canvas.mjs
  • Architecture Decision Record D-083 docs/DECISIONS.md

Generative Music & Lead Melody

Web Audio look-ahead synthesis, repeating motif grammars, and live master volume and tempo controls.

Look-Ahead Web Audio Transport & Master Volume

#
audiowebaudioscheduler

Schedules multi-voice polyphony smoothly using a precision look-ahead clock.

What it does

Executes continuous Web Audio playback using a 90 ms interval timer that schedules audio events 280 ms into the future. Routes all synthesizers through per-voice gain nodes, a shared resonant biquad filter, tempo-synced feedback delay, dynamics compressor, and master volume control.

How it works

playScore() and scheduleAhead() in src/app.mjs coordinate the audio pipeline:

  1. Maintains high-precision Web Audio context.currentTime scheduling, preventing timing jitter caused by main-thread UI operations.
  2. Computes rhythmic step durations unit = 60 / pulse / 2 mapped against score rhythm multipliers.
  3. Manages voice stacks, multi-harmonic drones, resonant envelope filters, and ping-pong feedback delays.
  4. masterGainFor() applies a perceptual power curve (vol / 82)^1.6 with 18 ms ramp smoothing, protected from digital clipping by a pre-output dynamics compressor.

Why it works this way

Early implementations used fixed-duration playback with setTimeout, which drifted, clipped, and stopped abruptly. A continuous look-ahead scheduler with compressor protection enables seamless infinite looping and reliable real-time mixing (ADRs D-005, D-009).

Evidence
  • Web Audio transport implementation src/app.mjs
  • Scheduler and volume tests tests/static.test.mjs
  • Architecture Records D-005, D-009 docs/DECISIONS.md

Master Transport: Play, Pause, Stop & Hotkeys

#
transportaudiokeyboardaccessibility

Starts, pauses at the last heard step, and stops-and-rewinds the ensemble loop from buttons or the keyboard.

What it does

A brass transport rail (#transport-deck) with PLAY, PAUSE, and STOP · REWIND buttons, a loop position readout (STEP 05 / 12), and global hotkeys: Space toggles play/pause and Esc stops and rewinds to step one. Pause resumes on the next unheard step; mute silences without changing the transport state.

How it works

src/transport.mjs holds the pure state model; runTransportCommand() in src/app.mjs applies it to audio and the page:

  1. transportReduce() moves between stopped, playing, and paused, keeping a raw step cursor that is never wrapped to 12, so five- and six-cell rhythm patterns resume in phase.
  2. Each live transport records audibleStep when a step actually sounds; pausing resumes after it rather than after the 280 ms look-ahead window, so queued but unheard steps are never skipped.
  3. stopCurrentSound() fades the whole output bus, not only the drone mix, so already-scheduled drums and bass stop with the pause.
  4. transportCommandForKey() leaves Space alone while typing and on keyboard-focused buttons, checkboxes, and switches, but takes it from a control last focused by a pointer press, so Space after clicking MUTATE pauses instead of mutating again.
  5. Audio runs only while the transport is playing and the bell is unmuted; summon and RESTART THE MELODY both issue restart.

Why it works this way

Basic DAW control is the first step toward a playable synthesizer workstation (roadmap P5-18). Pausing by rebuilding the graph at the saved cursor, instead of suspending the AudioContext, keeps the Fun Machine keyboard auditioning while paused and preserves the single-transport invariant (ADR D-023).

Evidence
  • Transport state and hotkey resolution src/transport.mjs
  • Transport controller src/app.mjs
  • Transport and hotkey tests tests/transport.test.mjs
  • Architecture Record D-023 docs/DECISIONS.md

Twelve Repeating Motif Families

#
audiomusic-theoryscales

Maps generative seeds into recognizable, musically coherent 12-note loops.

What it does

Generates exactly twelve semitone offsets selected from twelve distinct motif families: Major Arpeggio, Minor Arpeggio, Diminished Arpeggio, Augmented Arpeggio, Minor 7th Arpeggio, Ascending Chromatic, Descending Chromatic, Interleaved Chromatic, Circle of Fifths, Whole Tone Stride, Glass Ladder, and Seeded Scale Walk.

How it works

melodyFor() in src/music.mjs computes the melodic array:

  1. Applies the selected melodic mode and root key offset.
  2. Rotates the 12-note array by melodyTurn modulo 12 to provide variety in phrase starting points.
  3. Caches the resulting sequence on the active transport.
  4. Maps notes to audio frequencies via midiToFrequency(note) = 440 * 2^((note - 69) / 12).

Why it works this way

Purely random note selection sounds like formless computer noise. Human ear recognition requires structured motifs, arpeggios, and stepwise motion. Providing twelve distinct families ensures recognizable thematic identity across creatures (ADR D-010).

Evidence
  • Melodic vocabulary engine src/music.mjs
  • Exact motif sequence tests tests/oracle.test.mjs
  • Architecture Record D-010 docs/DECISIONS.md

Real-Time Ensemble Tempo Modulation

#
audiotempocontrols

Enables interactive speed adjustment across all six instruments without loop interruption.

What it does

Provides an accessible range slider (#tempo-bpm, 36 to 208 BPM) with a live numeric readout. Initialized on summon to the creature's native LOLCODE pulse, adjusting the slider immediately paces upcoming subdivisions across all six esoteric accompaniment engines without audio clicks, while double-clicking restores native speed.

How it works

setTempoBpm() and the look-ahead scheduler in src/app.mjs synchronize tempo changes:

  1. setTempoBpm() clamps the input to $[36, 208]$ BPM and updates #tempo-value and #score-pulse.
  2. scheduleAhead() dynamically evaluates livePulse = activeTempoBpm || score.pulse on every scheduling cycle.
  3. Calculates unit = 60 / livePulse / 2 and assigns step durations stepDuration = unit * lengthMultiplier to all active instruments.
  4. Delay line time is bounded to 1.45s to avoid buffer overruns while maintaining smooth acoustic resonance.

Why it works this way

Different listeners prefer leisurely ambient contemplation (e.g. 50 BPM) or energetic driving pulses (e.g. 140 BPM). Allowing dynamic tempo adjustment while defaulting to the creature's deterministic score gives the user expressive control while preserving specimen identity (ADRs D-005, D-009).

Evidence
  • Tempo slider handler src/app.mjs
  • Tempo markup and controls index.html
  • Static tempo test assertions tests/static.test.mjs

The Five Esoteric Accompaniment Plates (Plates I–V)

Authentic virtual machine execution across Malbolge, Brainfuck, Befunge-93, Piet, FRACTRAN, and Shakespeare Programming Language.

Plate I: Malbolge 1998 59,049-Word Ternary Beat Automaton

#
esolangmalbolgepercussion

Executes authentic Malbolge code on a ternary tape to generate 12-step drum patterns.

What it does

Executes src/beat.mal inside a spec-compliant 1998 Malbolge virtual machine (src/malbolge.mjs). Decomposes 12 output bytes into a 12-step 3-trit matrix controlling a synthesized bellows kick, clockwork snare, and escapement chime across eight cadence families, with interactive step cycling and mutation controls.

How it works

The virtual machine implements Ben Olmstead's 1998 Malbolge specification:

  1. Initializes a $3^{10} = 59,049$-word ternary memory tape.
  2. Executes ternary crazy operation crazy(a, b) and ternary right rotation rotr(val).
  3. Applies load-time opcode validation (c + [c]) % 94 and runtime XLAT2 post-instruction encryption.
  4. Limits execution to a 50-instruction budget to protect browser responsiveness.
  5. Web Audio synthesizes kick (pitch-ramped sine), snare (highpass noise burst), and chime (resonant twin sines).

Why it works this way

Malbolge is renowned as one of the most notoriously difficult programming languages in history. Writing a genuine deterministic Malbolge program that generates rhythmic trits gives the parlor percussion an authentic esoteric pedigree rather than pseudo-random approximation (ADR D-013).

Evidence
  • Malbolge VM implementation src/malbolge.mjs
  • Canonical Malbolge source src/beat.mal
  • VM execution unit tests tests/oracle.test.mjs
  • Architecture Record D-013 docs/DECISIONS.md

Plate II: Brainfuck 1993 256-Cell Walking Tape Bassline

#
esolangbrainfuckbass

Drives a 12-cell walking sub-bass and acid-organ ostinato from an executed Brainfuck tape.

What it does

Executes src/bass.bf inside a 1993 Urban Müller Brainfuck interpreter (src/brainfuck.mjs). Uses pointer movement, cell addition/subtraction, and [->+<] transfer loops across 256 byte cells to generate a 12-cell bass ostinato across eight groove archetypes, featuring portamento slide, cell cycling, and tape-shift controls.

How it works

runBrainfuck() in src/brainfuck.mjs executes the 8-command language:

  1. Pre-validates matching bracket pairs [ and ] at load time, reporting exact line/column offsets on failure.
  2. Executes >, <, +, -, ., ,, [, and ] on a Uint8Array(256) memory tape with a 4,096-step budget.
  3. Maps tape values into pitch intervals, octave registers, slide flags, and accent levels.
  4. Synthesizes bass tones via a sub-sine oscillator mixed with a portamento-gliding sawtooth routed through a resonant lowpass filter.

Why it works this way

Brainfuck's single-tape linear memory layout is the ideal computational counterpart to an acoustic walking bassline. Transfer loops naturally create rhythmic bass stepping and scalar walking patterns (ADR D-014).

Evidence
  • Brainfuck interpreter src/brainfuck.mjs
  • Canonical Brainfuck program src/bass.bf
  • Bracket and tape tests tests/oracle.test.mjs
  • Architecture Record D-014 docs/DECISIONS.md

Plate III: Befunge-93 2D Torus Mirror Chord Organ

#
esolangbefungeharmony

Voices polyphonic 3-note organ triads from a 2D boustrophedon toroidal playfield.

What it does

Executes src/harmony.bfg inside an 80×25 2D torus Befunge-93 interpreter (src/befunge.mjs). Employs directional arrows (> < ^ v), # bridges, arithmetic, and diagonal mirrors (\ / / \) to voice polyphonic 3-note reed-organ and glass-harp triads across eight organ archetypes, with live mirror cycling and deflection controls.

How it works

runBefunge() implements Chris Pressey's 1993 2D grid specifications:

  1. Navigates a 2D character grid wrapping toroidally across rows and columns.
  2. Maintains a LIFO operand stack for math, duplicates, swaps, and conditional branching (_, |).
  3. Outputs pitch classes and strum velocities; / triggers ascending harp arpeggios while \ triggers descending rolls.
  4. Synthesizes 3-voice polyphony through twin triangle and pulse organ oscillators with slight chorus detune.

Why it works this way

Befunge's two-dimensional playfield and reflective mirrors model physical acoustic reflections and counterpoint. The path of the instruction pointer through 2D space naturally maps to harmonic inversions and strum directions (ADR D-014).

Evidence
  • Befunge interpreter src/befunge.mjs
  • Canonical Befunge grid src/harmony.bfg
  • Torus execution tests tests/oracle.test.mjs
  • Architecture Record D-014 docs/DECISIONS.md

Plate IV: Piet Codel Canvas & FRACTRAN Prime-Ratio Spectral Chimes

#
esolangpietfractranjust-intonation

Drives 7-limit Just Intonation bells and spectral chorus pads from 2D codels and prime fractions.

What it does

Executes a 49-step 25×5 clockwise Piet 2001 codel canvas (src/pad.piet) across all 18 chromatic codels paired with a 12-step 1987 John Conway FRACTRAN prime-ratio program (src/chimes.frac) over $2^a 3^b 5^c 7^d 11^e 13^f$. Voices pure 5-limit and 7-limit Just Intonation overtone bells and synesthetic codel-filtered chorus pads across eight archetypes.

How it works

src/fractran.mjs executes both esolangs deterministically:

  1. Piet interpreter tracks Direction Pointer (DP) and Codel Chooser (CC) transitions between 6 hues and 3 lightness levels, computing hue and lightness delta commands (push, add, roll, out).
  2. FRACTRAN engine multiplies BigInt state $N$ by a sequence of fractions $P_i / Q_i$, finding the first fraction producing an integer and factoring exponents via prime factorization.
  3. Prime exponents ($2, 3, 5, 7$) select pure Just Intonation frequency ratios (1/1, 9/8, 6/5, 5/4, 4/3, 7/5, 3/2, 8/5, 5/3, 7/4, 15/8, 2/1).
  4. Chimes are synthesized as pure non-dispersive sine partials with exponential bell decay.

Why it works this way

Combining Piet's geometric visual codels with FRACTRAN's pure arithmetic prime ratios directly links visual color to acoustic overtones. Evaluating rational fractions eliminates 12-TET tuning dissonance and produces crystal-clear Just Intonation chimes (ADR D-014).

Evidence
  • Piet & FRACTRAN interpreter src/fractran.mjs
  • Piet codel program src/pad.piet
  • FRACTRAN fractions src/chimes.frac
  • Codel and prime tests tests/oracle.test.mjs
  • Architecture Record D-014 docs/DECISIONS.md

Plate V: Shakespeare Programming Language 3-Act Formant Vowel Choir

#
esolangshakespeare-splformant-synthesis

Schedules a 3-formant vowel choir from an authentic Elizabethan tragedy script.

What it does

Executes src/chant.spl (The Oracular Tragedy of the Parlor Glass.), a 3-Act, 12-Scene Elizabethan drama with four dramatis personae (Hamlet Tenor, Ophelia Soprano, Prospero Basso, Hecate Alto) inside an SPL interpreter (src/shakespeare.mjs). Drives a 3-formant ($F_1, F_2, F_3$) parallel bandpass vowel choir across six distinct vowels (/ɑ/, /ɛ/, /i/, /o/, /u/, /æ/), with live scene cycling and recast mutation.

How it works

runShakespeare() interprets the 2001 Jon Åslund and Karl Hasselström specification:

  1. Parses character declarations, dramatic entrances/exits ([Enter Hamlet and Ophelia], [Exeunt]), and dialogues.
  2. Computes positive and negative poetic valences from noun/adjective combinations (a noble, charming prince, a vile, cursed toad).
  3. Manages stack pushes and pops via Remember me and Recall statements.
  4. Formant vowel synthesis routes a sawtooth excitation source through three parallel second-order resonant bandpass filters configured with human vocal tract resonances.

Why it works this way

The Elizabethan tragic voice provides theatrical gravitas to the parlor seance. Formant synthesis gives the choir unmistakable human phonetic presence without relying on prerecorded audio samples (ADR D-014).

Evidence
  • Shakespeare SPL interpreter src/shakespeare.mjs
  • Theatrical tragedy script src/chant.spl
  • SPL execution tests tests/oracle.test.mjs
  • Architecture Record D-014 docs/DECISIONS.md

Parlor Bandstand Six-Language Jam Console

#
uiaudioconsolemixing

Coordinates live ensemble mixing, soloing, and synchronized multi-player mutations.

What it does

Provides an ensemble mixing console (#bandstand-engine) coordinating all six esoteric instruments (LOLCODE 1.2, Malbolge 1998, Brainfuck 1993, Befunge-93, Piet 2001 / FRACTRAN 1987, Shakespeare 2001). Offers FULL ENSEMBLE engage, SOLO ORACLE LEAD, and synchronized MUTATE ALL PLAYERS jam controls.

How it works

src/app.mjs manages individual bus gains and group mutations:

  1. Maintains separate Web Audio gain busses (beatBus, bassBus, harmonyBus, chimeBus, chantBus) with 25 ms smooth gain transitions to prevent audio clicks.
  2. FULL ENSEMBLE engages all six engines simultaneously with balanced default mix gains.
  3. SOLO ORACLE LEAD ramps accompaniment busses to zero while keeping visual step matrices active.
  4. MUTATE ALL PLAYERS fires simultaneous re-incantation steps across all five accompaniment plates and triggers the harmonic conductor.

Why it works this way

Allowing six esoteric languages to run simultaneously is exciting, but listeners need the ability to isolate individual players, hear the solo bandleader, or mutate the entire band in sync without reloading the page (ADR D-014).

Evidence
  • Bandstand UI and bus handlers src/app.mjs
  • Bandstand markup index.html
  • Ensemble structural tests tests/static.test.mjs
  • Architecture Record D-014 docs/DECISIONS.md

Eight-Channel Parlor Mixing Console

#
mixeraudiometeringaccessibility

Gives each of the eight ensemble voices a fader, stereo pan, mute, solo, and live VU meter.

What it does

A console (#mixer-engine) in the Mix wing, between the Bandstand and the parlor room, with eight strips: LEAD (LOLCODE), MANUAL (Fun Machine), PULSE (Malbolge), BASS (Brainfuck), ORGAN (Befunge), CHIMES (Piet/FRACTRAN), CHOIR (Shakespeare), and MYCELIUM (bio-acoustics). Each strip has a vertical fader with a dB readout, a pan slider, M and S switches, and a post-fader VU column with peak hold and clip warning. Plate ENGAGE/SILENCE switches are the same mutes, and WAV exports follow the mix.

How it works

src/mixer.mjs holds the pure console state; buildEnsembleGraph() in src/ensemble.mjs builds the strips; updateMixer() in src/app.mjs applies changes:

  1. Each bus routes through a 2-channel GainNode fader and a StereoPannerNode; upmixing first lets a centered pan pass mono voices at unity.
  2. channelSettings() turns faders, pans, mutes, and solos into per-strip gain and pan; any solo isolates the soloed channels, and an explicit mute still wins.
  3. The fader taper is square-law (v / 80)² below unity and linear in dB above it, so 40 is −12 dB, 80 is unity, and 100 is +12 dB; changes ramp over a 20 ms time constant.
  4. Live strips carry a post-pan AnalyserNode; a requestAnimationFrame loop turns meterReading() RMS and peak into meter fills with fast attack, a slow fall, and a 0.9 s peak hold.
  5. Each strip opens with a fixed voicing trim from CHANNEL_VOICING_DB before its fader (lead +6 dB, choir +12 dB), so the default balance favors the melody and voices while every fader still reads 0.0 dB. A Math.SQRT1_2 trim on the vitrine drag panner keeps its path at the pre-mixer level.

Why it works this way

Players asked to balance the six-language band and hear one bandmate at a time (roadmap P5-19). Building the strips into the shared graph means live playback, WAV export, and the planned stem export (P5-21) all hear the same mix. Folding plate switches into mixer mutes leaves one mute per bandmate instead of two that could disagree (ADR D-024).

Evidence
  • Mixer state, taper, and meter math src/mixer.mjs
  • Channel strips in the shared graph src/ensemble.mjs
  • Console rendering and VU loop src/app.mjs
  • Mixer model tests tests/mixer.test.mjs
  • Strip routing tests tests/transport.test.mjs
  • Architecture Record D-024 docs/DECISIONS.md

Harmonic & Rhythmic Synchronization (src/conductor.mjs)

Pure mathematical harmonization uniting six chaotic esoteric engines into consonant chamber music.

Neo-Riemannian Tonnetz Triadic Progression

#
music-theorytonnetzharmony

Organizes the 12-step bar into four parsimonious triadic regions sharing common tones.

What it does

Generates a 4-region, 12-step harmonic spine using Hugo Riemann's Neo-Riemannian Tonnetz operations: Parallel (P), Leading-Tone (L), and Relative (R) involutions. Each step transition preserves exactly two common pitch classes and moves the remaining voice by 1 or 2 semitones.

How it works

buildTonnetzSpine() and applyTonnetzOperation() in src/conductor.mjs construct the chord progression:

  1. Calculates the tonic triad root and quality (major or minor) from score melody mode and scale.
  2. Executes geometric involutions: P toggles major/minor; L swaps the root for a leading tone; R shifts to the relative major/minor.
  3. Generates 4 harmonic regions of 3 steps each (steps 0..2, 3..5, 6..8, 9..11).
  4. Supplies the active triad (root, third, fifth, seventh, ninth) to guide all instrument voicing.

Why it works this way

Independent virtual machines generating raw numbers simultaneously produce dissonant tone clusters. Neo-Riemannian voice leading creates rich, cinematic chord progressions that sound mysterious and coherent while allowing esoteric programs to retain their native rhythms (ADR D-016).

Evidence
  • Tonnetz engine src/conductor.mjs
  • Tonnetz mathematical unit tests tests/oracle.test.mjs
  • Architecture Record D-016 docs/DECISIONS.md

Leonhard Euler's 1739 Gradus Suavitatis Consonance Sieve

#
mathematicseulerconsonanceacoustics

Quantifies interval consonance mathematically to snap melodies and basslines onto consonant chord tones.

What it does

Computes Leonhard Euler's 1739 Gradus Suavitatis (degree of agreeableness) $G(n) = 1 + \sum e_i (p_i - 1)$ over frequency ratios. Snaps strong-beat LOLCODE lead notes, Brainfuck bass roots/fifths, Befunge-93 chord inversions, and Shakespeare formant choir lines onto the most consonant available pitch classes.

How it works

eulerGradus() and projectConsonantPitch() in src/conductor.mjs evaluate harmonic tension:

  1. Calculates prime factorizations of interval fractions $p/q$, evaluating prime penalties for factors 2, 3, and 5.
  2. Unison (1:1) yields degree 1; Octave (2:1) yields degree 2; Perfect Fifth (3:2) yields degree 4; Perfect Fourth (4:3) yields degree 5; Major Third (5:4) yields degree 7; Tritone (45:32) yields degree 14.
  3. projectConsonantPitch() finds the candidate note minimizing pitch distance and Euler Gradus score relative to the active Tonnetz triad.
  4. Strong beats (0, 3, 6, 9) require strict triad chord tones, while weak subdivisions permit consonant color extensions (9th, 4th, 6th, 7th).

Why it works this way

Hard-coding scale presets destroys the authenticity of esoteric VM execution, but unguided output is discordant noise. Euler's 1739 formula provides an objective, historic mathematical sieve that sculpts raw VM output into pure consonant intervals without discarding program logic (ADR D-016).

Evidence
  • Euler Gradus implementation src/conductor.mjs
  • Euler Gradus mathematical tests tests/oracle.test.mjs
  • Architecture Record D-016 docs/DECISIONS.md

E. Bjorklund's Euclidean Rhythm Hocketing

#
algorithmsbjorklundrhythmeuclidean

Interlocks lead, chimes, choir, and percussion into complementary rhythmic pockets.

What it does

Applies E. Bjorklund's 2003 Euclidean algorithm $E(k, n)$ to distribute $k$ pulses across $n=12$ steps as evenly as possible. Creates interlocking hockets between the LOLCODE lead, Malbolge kick, Piet/FRACTRAN chimes, and Shakespeare vowel choir so voices breathe in complementary pockets.

How it works

bjorklund() in src/conductor.mjs generates cyclic binary timing masks:

  1. Computes Bresenham-like recursive pulse distributions $E(7, 12)$ for lead melody and $E(5, 12)$ for spectral chimes.
  2. Rotates masks based on score turn fields to vary downbeat syncopation.
  3. Locks Brainfuck bass downbeats to Malbolge kick pulses on step 0 of each 3-step harmonic region.
  4. Suppresses chime and choir triggers when lead notes occupy the subdivision, creating acoustic space for each voice to ring clearly.

Why it works this way

When six instruments trigger on every 16th-note subdivision simultaneously, the sonic result is a wall of rhythm mud. Euclidean hockets distribute pulses with maximal mathematical spacing, creating infectious polyrhythmic grooves where each instrument has room to be heard (ADR D-016).

Evidence
  • Bjorklund algorithm implementation src/conductor.mjs
  • Euclidean pulse unit tests tests/oracle.test.mjs
  • Architecture Record D-016 docs/DECISIONS.md

Kapellmeister Music-Theory & Genre Rulebook Console

#
music-theorygenrescounterpointbluesjazztonnetz

Enables real-time switching between seven music-theory rulebooks with live harmonic readouts.

What it does

Allows the user to select and manipulate the harmonic rulebook governing the six-language esoteric ensemble (#kapellmeister-engine). Offers twenty-two rulebooks, grouped into families in the menu: Victorian Neo-Riemannian Tonnetz, 12-Bar Delta & Parlor Blues, Smoky Parlor Jazz, Palestrina Modal Counterpoint, Mystic Modal Drone, Parlor Ragtime & Cakewalk Strains (a Joplin-style strain with an oom-pah stride bass, added purely in Inform 7), Doo-Wop Parlor Ballad, Sacred Harp Shape-Note Hymnody, Andalusian Flamenco Cadence, Klezmer Freygish Dance, Sea Shanty & Hornpipe, Silent-Film Lydian Dream (the six of D-041 wave 1), Bossa Nova Salon, Baroque Chorale, Gothic Horror Organ, Gospel Shout & Revival, Tango Habanera, Neo-Soul Lo-Fi (the six of D-041 wave 2), Vaudeville Viennese Waltz, Swing-Era Savoy Ballroom, Javanese Gamelan Pelog (the three feel-driven genres of D-041 wave 3 / D-060), and Raw Esoteric Chaos. Each creature varies its genre's changes by the moves that genre's rulebook permits (rotation, relative and tritone substitutions, secondary dominants, modal borrowing, cadences, harmonic pace), chosen by the creature's own harmony fields (D-043), so no two creatures need share a progression. The VARIATION line names those moves, and AS WRITTEN switches them off. The harmony moves on a four-pass clock (D-044): each chord holds a whole loop and changes on its downbeat, the readout shows the step and the pass (05 / 12 · 3/4), and the compass lights the pass that is playing. THE CREATURE'S OWN, first in the menu and the rulebook a fresh creature opens in, is a rulebook each creature writes from its own scale through a functional grammar in Inform 7 (tonic, predominant, and dominant regions, and chord shapes tried in order), in the character of a genre it borrows. Displays active Step (01..12), Chord Name (e.g. C Maj, F7, Cmaj9), Harmonic Vector, and Euler Consonance score in real time alongside an interactive SVG Tonnetz compass.

How it works

src/rulebooks.ni states the genres; src/conductor.mjs and src/app.mjs apply them and show harmonic telemetry:

  1. Each genre is written in Inform 7 in src/rulebooks.ni (D-033): buildGenreSpine() reads its changes table (I7-IV7-V7, Imaj9-vi9-ii9-♭II7alt, suspensions with a Picardy third, root/fifth drone ladders) or walks the Tonnetz, and the menu, title, and motto are built from the same file.
  2. projectConsonantPitch() adapts to genre rules: blue-note sieve for blues, guide-tone approach for jazz, and stepwise conjunct motion for counterpoint.
  3. The Euler consonance strictness slider modulates the maximum permissible Gradus threshold from strict (G ≤ 5) to permissive (G ≤ 14).
  4. highlightBeatStep() updates the live readout on each 16th-note step and highlights the active region on the SVG Tonnetz compass.

Why it works this way

Different listeners enjoy different musical aesthetics—from tight contrapuntal elegance to smoky blues to raw, unfiltered avant-garde noise. Exposing the Kapellmeister console puts harmonic mastery directly in the user's hands without destroying the genuine execution of the underlying esoteric programs (ADR D-019).

Evidence
  • Kapellmeister conductor engine src/conductor.mjs
  • Kapellmeister unit tests tests/oracle.test.mjs
  • Console UI and handlers src/app.mjs
  • Architecture Record D-019 docs/DECISIONS.md

Discovery Drawers & the Whole Cabinet

#
accessibilitydiscoveryprogressive-disclosuredrawersstorage

A first visit opens on a small playable instrument; the Kapellmeister, Mix, Keep, and Band drawers open themselves as the visitor plays.

What it does

The page starts in discovery: the phrase box, the vitrine, the transport, and the Fun Machine are open, and four drawers wait below with a one-line invitation each. Holding a Fun Machine key wakes the Kapellmeister, finishing a loop opens the Mix, changing something worth keeping opens Keep, and soloing or silencing a voice (or four loops) opens The Band. OPEN THE WHOLE CABINET lays every control bare.

How it works

src/cabinet.mjs holds the state and rules; src/app.mjs adds the drawer chrome around existing elements:

  1. cabinetReduce() applies unlock, toggle, and mode events: a trigger opens a drawer only the first time, and a drawer the visitor closes stays closed.
  2. Sealed drawer bodies use hidden, leaving the tab order and the accessibility tree (55 tab stops at first instead of 172); openings are announced through a polite status region without moving focus.
  3. The mode and drawers are remembered in localStorage (whimsy-machine.cabinet.v1), validated by parseCabinetState(); without scripts every drawer simply stays open.

Why it works this way

Fifteen panels of esoteric machinery at once overwhelmed newcomers and keyboard and screen-reader users alike. Discovery lets the depth arrive as the visitor plays, and the whole cabinet keeps everything one switch away (D-037).

Evidence
  • Cabinet state and rules src/cabinet.mjs
  • Cabinet tests tests/cabinet.test.mjs
  • Architecture Record D-037 docs/DECISIONS.md

Inform 7 Kapellmeister Rulebooks

#
inform-7rulebooksgenresinterpreternatural-language

The seven genres are written in a strict subset of Inform 7 and compiled at load into the data the conductor plays.

What it does

src/rulebooks.ni states everything a Kapellmeister genre decides, in Inform 7's English: its chord colours, changes, Fun Machine progressions, melody snapping, bass walk, organ voicing, chime overtones, menu title, and motto. src/inform.mjs reads it, rejects anything outside the subset with a line number, and compiles it into frozen genre data before the app plays a note.

How it works

A purpose-built interpreter for the subset (D-033):

  1. Kinds, values, properties with defaults, either/or adjectives (Delta Blues is an insistent voiced genre.), globals that vary, tables with -- blanks and (continued), and genre-based rulebooks that produce values.
  2. Rules such as Colouring rule for Smoky Parlor Jazz when the interval above the tonic is listed in {0, 5}: rule succeeds with result maj9. fire in source order, first match wins (a documented departure from Inform's specificity ordering).
  3. compileRulebooks() follows every rulebook over its whole domain (12 intervals, strictness 1–14), so playing never runs Inform. The true algorithms a genre names (Tonnetz walking, Euler sieving, contrary motion, cell choosing, inverted triads) stay in src/conductor.mjs.
  4. The app installs the compiled rulebooks before anything reads a genre: the Kapellmeister menu, the Fun Machine's key colours, the conductor, and session presets.
  5. tests/fixtures/rulebooks-golden.json froze every genre decision before the migration, and the conductor still reproduces it exactly.

Why it works this way

The genres are the project's most-edited musical knowledge. As English prose and tables they read like a music-theory notebook, and adding or retuning a genre no longer means editing six JavaScript functions. Inform 7's kinds, tables, and rulebooks already had the right shape (D-033).

Evidence
  • Inform 7 rulebooks src/rulebooks.ni
  • Inform 7 subset interpreter src/inform.mjs
  • Interpreter and rulebook tests tests/inform.test.mjs
  • Migration contract tests/rulebooks.test.mjs
  • A test-only genre in Inform 7 alone tests/seventh-genre.test.mjs
  • Architecture Record D-033 docs/DECISIONS.md

Antique Parlor Room Acoustic Space & Phonograph Ambience

#
audioacousticsreverbconvolvercracklephonograph

Synthesizes authentic 1890s Edison cylinder crackle, wood-and-velvet chamber convolution reverb, and clockwork escapement ticking.

What it does

Embeds the synthetic chamber ensemble into an authentic 1890s Victorian parlor acoustic environment (#parlor-acoustics-engine). Combines procedural wax-cylinder surface crackle and horn bandpass resonance, a 1.6-second wood-and-velvet chamber convolution reverb, and brass grandfather clock escapement ticks on quarter-beats, captured faithfully in live Web Audio and offline 16-bit WAV loop exports.

How it works

src/app.mjs procedurally generates the acoustic space using Web Audio API nodes:

  1. ensureWaxCrackleBuffer() generates a 3.0s stereo buffer synthesizing acoustic recording horn resonance (350–3200 Hz bandpass), Poisson-distributed dust pops, and 78 RPM turntable groove rumble.
  2. ensureParlorImpulseResponse() generates a 1.6s stereo impulse response modeling discrete early reflections (12–98 ms) and high-frequency velvet drape absorption for a Web Audio ConvolverNode. Every voice but the bass is heard in the room, post-fader (the pulse at half strength), sitting about 14–21 dB under the mix at the default ambience (D-034).
  3. Levels per unit of the ambience slider live in src/ensemble.mjs: PARLOR_REVERB_PER_LEVEL (1.0) and PARLOR_CRACKLE_PER_LEVEL (0.21, halved after listening found the crackle overpowering).
  4. scheduleClockworkTick() synthesizes mechanical brass escapement clicks on quarter-beats (steps 0, 3, 6, 9) with high 'tick' (2600 Hz) and lower 'tock' (1800 Hz) transients and a wooden case knock, loud enough to read through the band (peaks near the mix's).
  5. exportSpecimenWav() incorporates the identical crackle, chamber convolution, and clockwork escapement ticks into rendered 16-bit PCM WAV loops.

Why it works this way

Pure mathematical synthesis sounds dry, clinical, and artificial without physical acoustic grounding. Wrapping the esoteric instruments in an authentic 1890s Edison cylinder parlor chamber binds disparate synthesizers into a believable acoustic space with zero external audio assets (ADR D-019).

Evidence
  • Parlor acoustic generators src/app.mjs
  • Static acoustic tests tests/static.test.mjs
  • Architecture Record D-019 docs/DECISIONS.md

The Whimsy Machine One-Finger Accompanist

#
accompanistkeyboardpadarpeggiofun-machine

Hold one key and a synth pad plays a swell, arpeggio, or progression while Casio arranger buttons trigger 1-pass intro, bridge, or outro sections in the band's rhythm while the band follows your chord.

What it does

A 13-key manual (C..C') and computer keys ([A..K]) drive a one-finger accompanist inspired by Baldwin home organs and vintage Casio keyboards. Hold a key and choose a style chip: SWELL holds one pad chord on the key, ARPEGGIO ripples its tones two per step, and PROGRESSION walks the genre's four-chord progression with a singing lead line. Dedicated Casio section buttons trigger live 1-pass movements from the active rulebook: INTRO plays an opening prelude and rolls directly into the groove, BRIDGE plays a 1-pass contrasting departure and automatically returns to the groove, and OUTRO plays the closing cadence and automatically stops the omen. The band is re-conducted onto the chord while the LOLCODE lead steps back. The streamlined Loop Machine (#looper, D-039, P5-26, D-045, D-046, D-052) records held keys into chained loops with up to four stacked layers, with audible-clock latching that preserves sustained arpeggios and swells without truncation, armed downbeat sync with anticipation latching, an interactive 12-step tracker ribbon, auto-advancing STEP REC note sequencing, and mechanical metronome ticks.

How it works

src/accompaniment.mjs turns a key into a performance; src/app.mjs voices and schedules it on the band's grid:

  1. buildPerformance(key, style, genre, tonic) returns four region chords and twelve steps; the genre colours each chord through buildFunChord(key, "auto", …).
  2. schedulePadChord() plays the chord in the current voice: a validated patch from src/voices.mjs (D-040). By default that is THE CREATURE'S OWN: creatureVoice() takes the preset the spell's fun_voice names, tilts its filters by fun_bright, and spreads its detune and width by fun_spread. The VOICE chips also offer seven presets (VELVET PAD, HARMONIUM, GLASS HARMONICA, THEATRE ORGAN, STRING MACHINE, MUSIC BOX, ÆTHER CHOIR), whose patches may add a tremolo, formant bands, or a struck, rolled chord. The default, VELVET PAD, is two saws detuned ±8 cents and a triangle under a slowly opening lowpass, with an attack scaled to the chord's length and a release that crossfades into the next. padVoicing() voice-leads each change.
  3. scheduleArpNote() plucks arpeggioNotes() two per step in each step's real duration; scheduleFunLeadNote() glides between progression notes with late-arriving vibrato. The Fun Machine strip feeds the delay and chamber reverb.
  4. A held key calls applyEnsembleConductor() with the performance's chords converted by toTonicRelative(), so the band plays the pad's chord in the right key, and ducks the LOLCODE lead and drones by 10 dB until release.
  5. The Loop Machine (src/looper.mjs, #looper) records takes from held keys or step sequencing: arms with downbeat sync and anticipation latching, sounds an audible clockwork count-in, provides an interactive 12-step tracker ribbon with click-to-edit note placement and auto-advancing STEP REC mode, plays loops sequentially for their repeats, stacks layers with undo, and exports the full song across stems and MIDI.

Why it works this way

The maintainer wanted pressing a key to feel like a composer leading a band, not like playing a combo organ. Playing on the band's own rhythm and room, re-conducting the band to the held chord, and letting the lead step back makes the player's part the lead (ADR D-029).

Evidence
  • Accompanist styles, voicing, arpeggios src/accompaniment.mjs
  • Fun Machine voice patches and synths src/voices.mjs
  • Fun Machine keys, and scheduler src/app.mjs
  • Accompanist tests tests/accompaniment.test.mjs
  • Architecture Record D-020 docs/DECISIONS.md
  • Architecture Record D-029 docs/DECISIONS.md
  • Architecture Record D-052 docs/DECISIONS.md
  • Loop machine model src/looper.mjs
  • Loop machine tests tests/looper.test.mjs

INTERCAL 1972 Grand Ensemble Conductor & Dynamic Arrangement Orchestrator

#
intercalconductorarrangementpolitenesscome-frombreathing

Master conductor virtual machine executing src/conductor.i to orchestrate dynamic sectional breathing, politeness-checked consonance, and COME FROM turnaround cadences.

What it does

Overcomes the ensemble's continuous wall of sound by executing a purpose-built 1972 INTERCAL interpreter across the 12-step loop. Uses canonical Woods & Lyon mechanics (PLEASE DO politeness quotient, PLEASE IGNORE / REMEMBER variable masks, and COME FROM cadence interceptions) to dynamically orchestrate channel breathing across Exposition, Antiphony, Tutti, and Breakdown sections.

How it works

src/intercal.mjs and src/conductor.i execute genuine INTERCAL 1972 rules:

  1. Statement Politeness Checking: enforces the INTERCAL 1972 politeness rule (0.20 <= P/N <= 0.334), rejecting impolite programs with ICL079 and groveling programs with ICL099. The conductor score executes with 8 polite statements out of 35 (22.9%).
  2. Per-phrase form: the host avalanche-mixes the score seed into a 16-bit arrangement word, and DO WRITE IN .5 / .6 read it and its complement. Seven select (~) choices then decide who colours the opening, who answers the choir, what sits under the breakdown, and whether the turnaround (#3 $ .7, a mingle) starts on step 10 or 11. Guardrails keep at least five band voices on every step and pulse and bass under the first three sections (D-032).
  3. Registers are the arrangement: twospot registers :1..:8 hold one channel each (#1 plays, #0 rests), .1 <- #n opens section n (Exposition, Antiphony, Tutti, Breakdown), and the VM snapshots the registers at each marker, so the program itself decides who plays. Malformed form is rejected at summon.
  4. PLEASE IGNORE :8 freezes the Fun Machine register, so the breakdown's DO :8 <- #0 does nothing and the player is never rested.
  5. COME FROM (60) Turnaround Cadence: .3 starts the turnaround on step 10 or 11 and COME FROM skips the lead's exit, so pulse, bass, and lead come home through the loop's end.
  6. IntercalVM bitwise operations: supports authentic 16-bit and 32-bit registers, bitwise mingle ($) and select (~), statement labels, and GIVE UP termination.
  7. The workstation shows the form: the transport names the section, console strips light TACET while rested, MIDI exports carry section Marker events, and the stem README lists section times.

Why it works this way

In real ensemble performance, musicality requires breathing space, call-and-response dynamics, and sectional contrast rather than an unceasing wall of sound where every instrument blasts at maximum density on every step (ADR D-028).

Evidence
  • INTERCAL conductor score src/conductor.i
  • INTERCAL interpreter & arrangement src/intercal.mjs
  • INTERCAL conductor tests tests/oracle.test.mjs
  • Architecture Records D-028, D-030, D-031, and D-032 docs/DECISIONS.md

Utterance Metre & Multi-Instrument Synchronizer

#
metresynchronizationconductiontempo-pocketanti-clash

Eliminates metric drift and vertical clashing by synchronizing all esoteric voices, schedulers, and delay reflections across 12-step and 16-step metres.

What it does

Unifies the metric division and harmonic alignment of all seven ensemble voices across both vintage 12-step compound shuffle and 16-step straight time. It scales step units, dynamic arrangement passes, fungal mycelium events, delay line taps, clockwork escapement clicks, and voice filter modulations to barline strides without polyrhythmic drift.

How it works

src/tuning.mjs, src/ensemble.mjs, src/schedulers.mjs, src/mycelium.mjs, src/accompaniment.mjs, and src/conductor.mjs coordinate metric synchronization:

  1. stepUnitSeconds() in src/tuning.mjs calculates true step duration for both 12-step and 16-step bar-aligned playback.
  2. delayTimeFor() in src/ensemble.mjs receives active step unit duration, locking echo reflection intervals to tempo and metre.
  3. myceliumEvents() in src/mycelium.mjs parameterizes step count, scaling biological spore puffs and hyphal triggers cleanly across the entire bar.
  4. scheduleClockworkTick() in src/schedulers.mjs pulses on true quarter notes and half-bars, eliminating triplet polyrhythms under straight time.
  5. Conductor and Accompaniment engines generate 16-chord spines and 4-step region strides, avoiding out-of-bounds exceptions and aligning chord changes.

Why it works this way

When native 16-step straight metre was introduced alongside 12-step compound time, hardcoded assumptions produced metric drift, vertical harmonic clashes, and runtime indexing errors. Utterance-level synchronization ensures all voices speak a unified musical language in either metre (D-081).

Evidence
  • Utterance Coherence Suite tests/utterance-coherence.test.mjs
  • Metre and Bar Lock Engine src/tuning.mjs
  • Harmonic Conductor src/conductor.mjs
  • Architecture Decision Record D-081 docs/DECISIONS.md

Kapellmeister Fluid Grouped Layout & Ergonomics

#
uikapellmeisterergonomicslayoutresponsive

Groups genre rulebook controls and concert tuning overrides into responsive flex containers to prevent visual overlap and whitespace glitches.

What it does

Organizes the Kapellmeister console controls into two semantic functional groupings: rulebook genre/scratchpad controls and concert pitch/scale transposition tools. Responsive wrapping guarantees legible presentation across both expansive desktop displays and narrow mobile screens.

How it works

index.html and styles.css structure the Kapellmeister action bar:

  1. Encapsulates genre selection, as-written toggle, and manuscript drawer toggle within .kapellmeister-group-rulebook.
  2. Encapsulates root override, scale override, and A4 reference pitch within .kapellmeister-group-tuning.
  3. Applies flex wrapping and responsive gap rules in styles.css to prevent rigid overflow and visual crowding.
  4. Preserves strict typographic floors (0.6rem) and high-contrast parchment and brass Victorian aesthetics.

Why it works this way

Rapid addition of tuning overrides, scale selectors, and custom manuscript editors caused button crowding, awkward line wraps, and whitespace glitches. Semantic grouping ensures controls remain intuitive, uncluttered, and robust under varying window dimensions (D-082).

Evidence
  • Workstation Shell Markup index.html
  • Responsive Stylesheet styles.css
  • Architecture Decision Record D-082 docs/DECISIONS.md

Specimen Sharing & High-Resolution Broadsheets

Privacy-preserving URL fragment sharing and 1200×1520 engraved Victorian broadsheet PNG export.

Client-Only #omen=... URL Fragment Sharing

#
sharingprivacyurlssecurity

Shares exact specimen links via URL hash fragments without transmitting phrases to servers.

What it does

Encodes the confidant's phrase into the browser location hash (#omen=<encoded_phrase>). Enables one-click link copying (COPY OMEN LINK), live address bar synchronization, and instant specimen restoration on link visit or hashchange without transmitting data over HTTP request headers.

How it works

src/share.mjs handles hash encoding and restoration:

  1. encodeOmenHash() percent-encodes normalized phrases into #omen=... format.
  2. decodeOmenHash() extracts and decodes phrases, ignoring foreign hash targets.
  3. showScore() synchronizes browser address bar state via history.replaceState(null, '', nextHash).
  4. When opened from a shared link, the application restores the score immediately while holding audio in suspension until the user clicks Summon, Replay, or Unmute, respecting browser autoplay policies.

Why it works this way

Traditional web apps use ?query parameters, which transmit sensitive user input in plain text to web servers, CDN access logs, and HTTP Referer headers. RFC 3986 URL fragments (#) are processed exclusively on the client, guaranteeing 100% privacy for confidences (ADR D-015).

Evidence
  • Share URL helper functions src/share.mjs
  • Hash round-trip tests tests/oracle.test.mjs
  • Architecture Record D-015 docs/DECISIONS.md

1200×1520 Engraved Broadsheet Specimen PNG Export

#
exportpngcanvasbroadsheet

Renders an archival Victorian specimen plate combining live portrait capture, phrase, and ensemble telemetry.

What it does

Composites an archival 1200×1520 pixel engraved Victorian specimen broadsheet on an offscreen <canvas> (ENGRAVE PNG PLATE). Downloads the image as hai-oracle-<name>-<seed>.png, featuring the live apparition portrait, specimen name, confided phrase, hexadecimal seed, and six-language ensemble telemetry ledger.

How it works

renderSpecimenBroadsheetCanvas() in src/app.mjs builds the plate from vector primitives:

  1. Fills aged parchment background with double oxblood and brass framing rules and corner rosettes.
  2. Draws typographical masthead, specimen name, and wrapped quotation of the confided phrase.
  3. Captures the live apparition vitrine from #vision into an arched bell-jar illustration frame with astrolabe corner spandrels.
  4. Inscribes full ensemble telemetry: hexadecimal seed, LOLCODE score attributes, and executed instruction counts across Plates II through VI.
  5. exportSpecimenPng() triggers an immediate browser file download via a temporary data anchor.

Why it works this way

Users love collecting and saving their discoveries. Rather than downloading a generic square icon, generating a high-resolution 1200×1520 Victorian natural history broadsheet turns every summoned creature into a framed work of art suitable for printing or archival collection (ADR D-015).

Evidence
  • Broadsheet canvas renderer src/app.mjs
  • Filename generator and tests tests/oracle.test.mjs
  • Architecture Record D-015 docs/DECISIONS.md

16-Bit Uncompressed Deterministic WAV Audio Export

#
exportwavaudiooffline-audio-contextpcm

Renders and exports a broadcast-quality 16-bit 44.1 kHz WAV recording of the chamber ensemble loop.

What it does

Generates a deterministic, uncompressed 16-bit stereo 44.1 kHz PCM WAV recording of the complete 12-step esoteric chamber ensemble loop (RECORD WAV LOOP). Uses the browser-native OfflineAudioContext and a dependency-free pure JavaScript RIFF/WAVE encoder (audioBufferToWavBlob()) to synthesize and download hai-oracle-<name>-<seed>.wav in under 60 milliseconds on-device.

How it works

exportSpecimenWav() in src/app.mjs and audioBufferToWavBlob() in src/share.mjs execute offline audio synthesis and PCM packaging:

  1. Calculates precise loop duration from active tempo BPM and score rhythm multipliers, adding a 1.35-second tail for delay and reverb decay.
  2. Instantiates a 2-channel 44.1 kHz OfflineAudioContext and builds the same graph as live playback with buildEnsembleGraph() from src/ensemble.mjs, so the export renders the listener's exact routing (ADR D-023).
  3. Schedules all six conducted esoteric instruments (LOLCODE lead, Malbolge beat, Brainfuck bass, Befunge-93 organ, Piet/FRACTRAN chimes, Shakespeare choir) plus fungal bio-acoustics.
  4. audioBufferToWavBlob() constructs a canonical 44-byte RIFF/WAVE header and writes interleaved clamped 16-bit signed integer samples.
  5. Triggers immediate browser download via an ephemeral object URL anchor with automatic cleanup.

Why it works this way

Confidants wanted high-fidelity audio keepsakes of their summoned creatures. Offline Web Audio rendering guarantees bit-exact acoustic determinism without server roundtrips, network telemetry, or heavyweight external audio libraries (ADR D-018).

Evidence
  • WAV audio exporter src/app.mjs
  • Shared ensemble graph src/ensemble.mjs
  • Pure PCM WAV encoder src/share.mjs
  • Audio encoding unit tests tests/oracle.test.mjs
  • Architecture Record D-018 docs/DECISIONS.md

Nine-Stem WAV Bundle & Type 1 MIDI Score

#
exportstemszipmididaw

Exports every channel as an aligned WAV stem in one ZIP, and the whole loop as a multi-track MIDI file.

What it does

EXPORT 9 STEMS (ZIP) downloads …-stems.zip holding eight channel stems (lead, manual, pulse, bass, organ, chimes, choir, mycelium), a parlor-room stem of crackle and clockwork, and a README with tempo and loop length. WRITE MIDI SCORE downloads a Standard MIDI File (Type 1) with a tempo track and seven named instrument tracks, ready to drop into any DAW.

How it works

renderEnsembleLoop() in src/app.mjs drives both exports through the shared graph; src/zip.mjs and src/midi.mjs write the files:

  1. Each channel stem renders the loop with only that strip open at its fader and pan (stemSettings()), mute and solo ignored, keeping its own chamber reverb; the room stem renders with every strip closed.
  2. createStoredZip() writes STORED entries with CRC-32 and the DOS epoch date, so the same stems always make the same archive, and rejects path-traversal entry names.
  3. During a schedule-only pass, each pitched scheduler records its note through logNote(), so MIDI comes from the code that makes the sound.
  4. buildMidiFile() writes 480 PPQ tracks with General MIDI programs (drums on channel 10), clips notes to the loop, trims overlapping repeats, merges unisons, and scales velocity from each part's loudest event. funVoiceTracks() gives each Fun Machine voice in the loop its own MANUAL track, channel, and program, so stacked layers in different voices open as separate instruments.

Why it works this way

Players wanted to carry a creature into a real studio (roadmap P5-21). Rendering through the shared graph means stems sound exactly like their channel in the mix; capturing notes from the schedulers keeps MIDI from drifting away from the audio. Both writers are a few hundred lines of browser-native code, keeping the zero-dependency boundary (ADR D-025).

Evidence
  • Offline renderer and exporters src/app.mjs
  • STORED ZIP writer src/zip.mjs
  • SMF Type 1 writer src/midi.mjs
  • Writer tests tests/export.test.mjs
  • Architecture Record D-025 docs/DECISIONS.md

Session Ledger: On-Device Presets & .fun Files

#
sessionspresetslocalstorageprivacyboundary

Saves and restores the whole apparatus as named browser presets or portable session files.

What it does

The ledger (#session-engine) captures the phrase, every plate's mutation count and cell edits, the Fun Machine accompaniment style and voice and its loop-machine song, every recorded slot keeping the voice it was played in (format v6, with the AS WRITTEN switch; older files open in VELVET PAD and as written), the Kapellmeister rulebook and strictness, the parlor room, tempo, master volume, and the full mixing console. SAVE PRESET keeps it under a name in this browser only; SAVE .FUN FILE and OPEN .FUN FILE move it between machines.

How it works

src/session.mjs defines and validates the format; captureSession() and applySession() in src/app.mjs read and restore live state:

  1. Sessions are versioned JSON; validateSession() requires every field, refuses unknown and prototype keys, range-checks integers, checks enums, and limits files to 64 KB, rejecting a bad file whole and naming the field.
  2. Chords are stored as (root, quality) and rebuilt by buildFunChord(); plate edits are per-cell click counts replayed through each plate's cycler, since cells cycle independently.
  3. Restoring re-summons the phrase through the normal score path, then layers plates, progression, rulebook, room, tempo, volume, and console, restarting a playing loop.
  4. Presets live in one localStorage key, revalidated on every read; every storage call is wrapped so blocked storage falls back to files.

Why it works this way

A jam that vanishes with the tab is hard to build on (roadmap P5-20). Keeping presets on the device and moving everything else through player-held files preserves the client-only privacy model, and a strict allowlist keeps a shared file from steering the score, audio graph, or page (ADR D-026).

Evidence
  • Session format and validator src/session.mjs
  • Capture, restore, and ledger UI src/app.mjs
  • Session boundary tests tests/session.test.mjs
  • Architecture Record D-026 docs/DECISIONS.md
  • Security boundaries docs/SECURITY.md

Studio Deck: Web MIDI & Audio Sink Interconnect

#
midiweb-midiaudio-sinkpipewiredaw

Connects the apparatus directly to digital audio workstations via bidirectional Web MIDI and multi-channel audio sink routing.

What it does

The Studio Deck (#studio-engine) turns the machine into a studio synthesizer and algorithmic MIDI generator. It receives hardware and DAW MIDI notes, sustain pedal (CC 64), modulation wheel (CC 1), master volume (CC 7/11), and transport control (start/stop/continue), and broadcasts the generative score out across 8 independent MIDI channels to drive external instruments. It also provides Web Audio output sink device selection for routing directly to virtual audio patchbays (PipeWire, JACK, BlackHole).

How it works

src/midi-io.mjs interfaces with standard Web MIDI and AudioContext.setSinkId APIs:

  1. Incoming MIDI Note On messages fold into manual semitones 0..12 and trigger triggerFunKey(), allowing real-time keyboard accompaniment and step programming.
  2. CC 64 acts as a true sustain pedal, latching manual chords until released; CC 1 modulates vitrine agitation and spore release; CC 7/11 scales master volume.
  3. Broadcasting transmits conducted note events from logNote() with sample-accurate Web Audio timestamp offsets across Channels 1 (Manual), 2 (Lead), 3 (Bass), 4 (Harmony), 5 (Chimes), 6 (Choir), 7 (Mycelium), and 10 (Beat).
  4. Audio sink device selection redirects the audio graph's output to PipeWire or virtual cable endpoints without requiring third-party plugins.

Why it works this way

Allowing the esoteric engines and Euler-Tonnetz harmonic conductor to interface seamlessly with modern DAWs gives producers an algorithmic generative MIDI generator and tabletop synthesizer companion while maintaining the zero-dependency browser core (ADR D-061).

Evidence
  • Web MIDI and Audio Sink adapter src/midi-io.mjs
  • Studio Deck wiring and event handlers src/app.mjs
  • Studio MIDI unit tests tests/midi-io.test.mjs
  • Architecture Record D-061 docs/DECISIONS.md
  • Architecture Record D-068 docs/DECISIONS.md

Under the Parlor Glass: Live Esoteric VM Step Inspector

#
inspectoresotericmalbolgebrainfuckbefungepietfractranshakespeare

Exposes real-time virtual-machine registers, tape windows, 2D torus coordinates, prime exponents, and dramatic cues across Plates I–V.

What it does

Each of the five esoteric accompaniment plates in Wing III offers an expandable INSPECT VM ⌕ loupe (.vm-inspector) that displays the exact virtual-machine state of the active step during playback or when any step cell is clicked: Malbolge 10-trit rotr/crazy words, Brainfuck 6-cell tape windows and [->+<] shuttles, Befunge-93 2D torus (x, y) coordinates and / vs. \ mirror deflections, Piet codel transitions and FRACTRAN prime-exponent registers, and Shakespeare Act/Scene [SPEAKER ➔ ADDRESSEE] dialogue cues and formant bandpass frequencies.

How it works

src/inspector.mjs formats pure per-step VM telemetry without mutating interpreter state:

  1. toTernary10() converts Malbolge integers into 10-trit strings (0t..........) alongside rotr(d) and crazy(a, d) trace summaries.
  2. inspectBassStep(), inspectHarmonyStep(), inspectChimeStep(), and inspectChantStep() format each machine's step snapshot into fixed-field { title, primary, secondary, badge } records.
  3. Closed inspector panels perform zero DOM updates during playback (if (!inspectorOpen[id]) return;), and open panels use aria-live="off" and single-line tabular monospace (white-space: nowrap) so live step updates never wrap or shift page layout.

Why it works this way

Visitors curious about how the five esoteric languages compute each musical step can peer under the parlor glass in real time without compromising playback performance, layout stability, or screen-reader silence (roadmap P5-34, ADR D-069).

Evidence
  • VM step inspector module src/inspector.mjs
  • Inspector unit tests tests/inspector.test.mjs
  • Architecture Record D-069 docs/DECISIONS.md

The Naturalist's Herbarium: Curio Gallery & Trait Comparator

#
herbariumcuriolocalstoragecomparisonsvg

Bookmarks up to 24 favorite summoned creatures on-device with miniature SVG portraits, one-click re-summoning, and side-by-side trait comparison.

What it does

The Naturalist's Herbarium (#herbarium-engine in Wing IV) lets visitors pin summoned specimens into an on-device curio drawer (whimsy-machine.herbarium.v1), view deterministic 48-vertex miniature SVG silhouette portraits, re-summon any pinned specimen in one click, and compare any two pinned specimens side-by-side across 8 canonical anatomical and musical traits.

How it works

src/herbarium.mjs enforces a strict 16-key validation boundary and deterministic portrait/comparison math:

  1. validateSpecimen() and specimenFromScore() enforce an exact 16-field allowlist, rejecting unknown or prototype keys and out-of-range values with HerbariumError.
  2. parseHerbariumStore() drops corrupt entries individually while preserving valid neighbors, and writeHerbariumStoreTo() evicts oldest specimens first on QuotaExceededError.
  3. specimenMiniatureData() computes a 48-vertex SVG polygon and 3-hue palette from shapeFamilyRadius() and paletteFor() (src/vitrine-canvas.mjs).
  4. compareSpecimens() diffs two specimens across SPECIMEN, PHRASE, FOLIO & CLASS, PULSE & WAVE, SILHOUETTE, MELODY MOTIF, SPOROPHORE, and CHROMATIC HUE.

Why it works this way

Exploring an 83.8-million-specimen phase space rewards a lightweight curio cabinet for bookmarking and comparing favorite creatures alongside full .fun session files, while maintaining the strict client-only boundary (roadmap P5-35, ADR D-070).

Evidence
  • Herbarium boundary, SVG geometry, and comparator src/herbarium.mjs
  • Herbarium unit tests tests/herbarium.test.mjs
  • Architecture Record D-070 docs/DECISIONS.md

The Kapellmeister's Manuscript: Live Inform 7 Rulebook Sandbox

#
inform7rulebookskapellmeistersandboxcompiler

Compiles visitor-authored Inform 7 music-theory rulebooks live in the browser with 1-based manuscript line diagnostics.

What it does

The Kapellmeister's Manuscript (#kapellmeister-manuscript inside #kapellmeister-engine) opens a collapsible Inform 7 rulebook editor preloaded with a complete custom genre ("celestial_music_box" / "CELESTIAL MUSIC BOX"). Pressing COMPILE & CONDUCT ✦ compiles the custom Inform 7 source alongside src/rulebooks.ni, reports 1-based manuscript line diagnostics on syntax or semantic errors, adds the new genre to the RULEBOOK menu, and immediately re-conducts the ensemble.

How it works

src/manuscript.mjs wraps compileRulebooks() (src/inform.mjs) with canonical-genre immutability guards and line-number translation:

  1. compileManuscript(canonicalSource, manuscriptSource) compiles ${canonicalSource}\n${manuscriptSource} through compileRulebooks().
  2. If InformError is thrown, the canonical line count is subtracted so diagnostics point directly to the 1-based line in the manuscript editor (MANUSCRIPT LINE <n>: ...).
  3. Every canonical genre in src/rulebooks.ni is checked bit-for-bit after compilation; manuscripts that alter a canonical genre or declare no new genre are refused.

Why it works this way

Since all Kapellmeister genres are written in Inform 7 (D-033), exposing the live compiler in the cabinet lets visitors author and audition their own harmonic progressions, bass walks, organ voicings, and overtone tables without touching JavaScript (roadmap P5-36, ADR D-071).

Evidence
  • Manuscript sandbox compiler src/manuscript.mjs
  • Inform 7 subset compiler src/inform.mjs
  • Manuscript unit tests tests/manuscript.test.mjs
  • Architecture Record D-071 docs/DECISIONS.md

M-VAVE FM-1 Pocket Synthesizer: Hardware Companion & Native Firmware

#
fm1hardwarefirmwarecmidijielitft

Transforms The Whimsy Machine into a physical handheld synthesizer via out-of-the-box Web MIDI companion mode or native standalone firmware for the JieLi AC791N SoC.

What it does

The Whimsy Machine connects to the M-VAVE FM-1 battery-powered pocket synthesizer in two distinct ways: first, as an out-of-the-box hardware controller companion profile over Web MIDI (27-key auto-chord split, CC bindings for cutoff, strictness, volume, and mixer faders); second, as an entirely standalone native C firmware container (whimsy-machine.fwsc) running on the FM-1's JieLi AC791N RISC processor or inside Joakim Eriksson's browser-based hardware emulator (fm1-emu).

How it works

The integration spans zero-dependency Web MIDI routing, pure C reference ports, fixed-point synthesis, and UFW/JLFS firmware container packaging:

  1. src/midi-io.mjs detects FM-1 ports via isFm1Port() and maps lower keys ($F_3\dots B_3$) to Casio section/style triggers and upper keys ($C_4\dots G_5$) to the manual, while CC 70–73 bind to mixer faders, CC 2/74 to filter cutoff, and CC 75 to Euler strictness (D-072).
  2. firmware-c/whimsy_esoteric.c ports FNV-1a, Euler Gradus Suavitatis, and all 7 esoteric VMs to pure C, while firmware-c/whimsy_fm1_synth.c renders 44.1 kHz 128-frame Q23 stereo audio with precomputed phase tables and zero libm floating point (D-073).
  3. firmware-c/whimsy_fm1_ui.c renders the 240×240 RGB565 Vitrine (bell jar arch, specimen silhouette, tracker ribbon) via 16-row DMA banded transfers (D-074).
  4. tools/build_fm1_firmware.py compiles the RISC ELF image using JieLi clang (-target pi32v2 -mcpu=r3) and packages whimsy-machine.fwsc with CRC-16 keystream encryption, verified under fm1-emu in tests/fm1-firmware.test.mjs (D-075).

Why it works this way

Physical instruments provide tactile immediacy that glass touchscreens cannot replicate. Pairing an out-of-the-box Web MIDI controller profile with an authentic standalone embedded firmware container achieves the best of both worlds: zero-install browser playability and true off-grid pocket synth hardware (roadmap P7-01–P7-06, ADRs D-072–D-075).

Evidence
  • FM-1 Web MIDI Controller Profile src/midi-io.mjs
  • Standalone C reference engine firmware-c/whimsy_esoteric.c
  • FM-1 native audio synthesis engine firmware-c/whimsy_fm1_synth.c
  • FM-1 240×240 color TFT UI renderer firmware-c/whimsy_fm1_ui.c
  • FM-1 firmware build & packaging tool tools/build_fm1_firmware.py
  • FM-1 emulator smoke test tests/fm1-firmware.test.mjs
  • Architecture Records D-072–D-075 docs/DECISIONS.md

The Keep Wing Segmented Telegraph Decks

#
uikeep-wingtelegraph-deckergonomicspersistence

Eliminates vertical bloat and jagged multi-column wrapping in Wing IV by providing a tabbed telegraph selector across Export, Session, Studio, and Herbarium.

What it does

Refactors Wing IV (The Keep Wing) into a segmented deck architecture featuring four dedicated operator views: Specimen Audio/PNG Export, Session Ledger, Studio DAW Routing, and The Naturalist's Herbarium. An interactive telegraph selector toggles the active deck while persisting the user's choice locally.

How it works

index.html, styles.css, and src/app.mjs orchestrate the segmented deck interface:

  1. Renders .keep-deck-nav with four accessible tab buttons (#keep-tab-export, #keep-tab-session, #keep-tab-studio, #keep-tab-herbarium).
  2. Controls visibility of #export-engine, #session-engine, #studio-engine, and #herbarium-engine via the HTML hidden attribute.
  3. Applies display: none !important to hidden engines in styles.css to eliminate dangling borders and grid reflow artifacts.
  4. Persists the active tab in window.localStorage under whimsy-machine.keep-deck through guarded helpers (readKeepDeck(), writeKeepDeck()).
  5. Formats studio WAV parameters into a cohesive 2x2 grid (.export-format-grid) with explicit sublabels for bit depth, sample rate, loop mode, and stem processing.

Why it works this way

Wing IV had accumulated multiple complex sub-engines into a single scrolling container, resulting in overwhelming vertical bloat and awkward CSS grid breaks. Segmented decks provide focused, purposeful workspaces while maintaining document outline order and instant keyboard accessibility (D-082).

Evidence
  • Keep Wing Shell Markup index.html
  • Desktop & Responsive Stylesheet styles.css
  • Host Application Controller src/app.mjs
  • Architecture Decision Record D-082 docs/DECISIONS.md