From c7f12c72b93dbcd4ce9db988bd2b78d539d9c6f5 Mon Sep 17 00:00:00 2001 From: you Date: Sun, 22 Mar 2026 18:45:47 +0000 Subject: [PATCH] Audio: log2 voice scaling (up to 8), wider detune spread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1 obs = solo, 3 = duo, 8 = trio, 15 = quartet, 30 = quintet, 60 = sextet. Wider detune (±8, ±13, ±18...) so stacked voices shimmer instead of sounding like the same oscillator copied. --- public/audio-v1-constellation.js | 7 ++++--- public/index.html | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/public/audio-v1-constellation.js b/public/audio-v1-constellation.js index 64c9ca3d..fab01cb9 100644 --- a/public/audio-v1-constellation.js +++ b/public/audio-v1-constellation.js @@ -52,8 +52,9 @@ const filterFreq = mapRange(Math.min(hopCount, 10), 1, 10, 8000, 800); // Volume from observations - const volume = Math.min(0.5, 0.15 + (obsCount - 1) * 0.03); - const voiceCount = Math.min(obsCount, 4); + const volume = Math.min(0.6, 0.15 + (obsCount - 1) * 0.02); + // More observers = richer chord: 1→1, 3→2, 8→3, 15→4, 30→5, 60→6 + const voiceCount = Math.min(Math.max(1, Math.ceil(Math.log2(obsCount + 1))), 8); // Audio nodes const filter = audioCtx.createBiquadFilter(); @@ -85,7 +86,7 @@ const noteEnd = noteStart + duration; for (let v = 0; v < voiceCount; v++) { - const detune = v === 0 ? 0 : (v % 2 === 0 ? 1 : -1) * (v * 7); + const detune = v === 0 ? 0 : (v % 2 === 0 ? 1 : -1) * (v * 5 + 3); // ±8, ±13, ±18, ±23... const osc = audioCtx.createOscillator(); const envGain = audioCtx.createGain(); diff --git a/public/index.html b/public/index.html index b4c1389e..cfb2589f 100644 --- a/public/index.html +++ b/public/index.html @@ -91,7 +91,7 @@ - +