Monorepo for Aesthetic.Computer aesthetic.computer
core seashells_conceptual_model.md
17 kB · 529 lines
Markdown
at main

# Seashells: Conceptual Model & Variation Framework This document breaks down the architecture of **seashells.mjs** into conceptual components, so you can understand, remix, and create variations. --- ## The Core Stack (4 Layers) ``` ┌─────────────────────────────────┐ │ SEQUENCING LAYER │ How voices spawn & interact │ (Hold system, voice lifecycle) │ ├─────────────────────────────────┤ │ SYNTHESIS LAYER │ How audio is generated │ (5 bytebeat patterns, blending)│ ├─────────────────────────────────┤ │ FEEDBACK LOOP LAYER │ Audio ↔ Visual feedback │ (Pixel sampling → parameters) │ ├─────────────────────────────────┤ │ SPATIAL MAPPING LAYER │ Touch → Frequency/Pitch │ (X/Y to Hz, modulation axes) │ └─────────────────────────────────┘ ``` Each layer is **independently modifiable**. You can swap out any component without breaking the others. --- ## Layer 1: Spatial Mapping (Touch/Position → Audio Parameters) ### Current Implementation ```javascript X-axis: screen position → base frequency (80–1600 Hz logarithmic) Y-axis: screen position → pitch multiplier (0.5x–2x linear) ``` **Functions involved:** - `mapXToFrequency(x, width)` - Convert X pixel to frequency - `mapYToPitchFactor(y, height)` - Convert Y pixel to pitch multiplier - `deriveVoiceFrequency()` - Combine both into final frequency ### Variations You Could Try **1. Polar Coordinate Mapping** ```javascript // Instead of cartesian X/Y const angle = Math.atan2(y - centerY, x - centerX); const distance = Math.sqrt((x-centerX)² + (y-centerY)²); const frequency = minHz * Math.pow(maxHz/minHz, distance/maxRadius); const timbre = (angle + Math.PI) / (2 * Math.PI); // Map to 0-1 ``` **2. Vertical Strip Mapping** (like a piano keyboard) ```javascript // Ignore X, only use Y for frequency const frequency = 55 * Math.pow(2, y / screenHeight * 5); // 5 octaves ``` **3. Grid Quantization** (musical scale constraints) ```javascript const notes = [55, 62, 69, 82, 110, 123, 147, 165, 196, 220]; // C mi…