Fourier Harmonic Series & Acoustic Wave Interference Studio

Adjust fundamental frequency and overtone amplitudes (n=1..7) to inspect waveform superposition, consonance ratios, and WebAudio synthesis. · Creator: @openie-steam · License: CC-BY-4.0 · Sandbox: opaque-origin + connect-src 'none'

Inspect Verified Source & Ed25519 Receipt (BLAKE3 a6d9f8318239e1a2…)
BLAKE3:  a6d9f8318239e1a25ef3400072902c5a2d358cdbc9990d8781c406d51084d3be
Ed25519: 3206676ed26cb6a567ac634fd70c4624521ccb4798a8e33384c82b54dc49eae5bed2de462665158d9bd74567fdec0daedc4c9e489b130538e402c4d992247c07
PubKey:  fcfa833e7541ffbda4235fa7b41340c52fb1fe76ee7cad14fe0244361d838367
<!doctype html><html><head><meta charset="utf-8"><style>
body{margin:0;padding:16px;background:#0a0c10;color:#eceef3;font:14px/1.5 system-ui,sans-serif}
.row{display:flex;gap:12px;flex-wrap:wrap;align-items:center;margin-bottom:10px}
label{display:flex;flex-direction:column;font-size:12px;color:#8e97a8;gap:4px}
canvas{width:100%;height:190px;background:#131720;border:1px solid #252c3a;border-radius:10px}
button{background:#d4af61;color:#181200;border:0;border-radius:8px;padding:8px 14px;font-weight:600;cursor:pointer}
</style></head><body>
<div class="row">
  <label>H1 <input id="h1" type="range" min="0" max="100" value="100"></label>
  <label>H2 (Octave) <input id="h2" type="range" min="0" max="100" value="45"></label>
  <label>H3 (Fifth) <input id="h3" type="range" min="0" max="100" value="30"></label>
  <label>H4 <input id="h4" type="range" min="0" max="100" value="15"></label>
  <label>H5 (Major 3rd) <input id="h5" type="range" min="0" max="100" value="20"></label>
  <button type="button" id="tone">▶ Pluck Chord (220 Hz)</button>
</div>
<canvas id="cv" width="760" height="190"></canvas>
<div id="readout" style="margin-top:8px;font-family:monospace;font-size:12px;color:#46e0c0"></div>
<script>
const ids=['h1','h2','h3','h4','h5'];
const cv=document.getElementById('cv'),ctx=cv.getContext('2d');
let phase=0;
function amps(){return ids.map(i=>Number(document.getElementById(i).value)/100);}
function draw(){
  const a=amps(); ctx.clearRect(0,0,cv.width,cv.height);
  ctx.strokeStyle='#252c3a'; ctx.beginPath(); ctx.moveTo(0,95); ctx.lineTo(cv.width,95); ctx.stroke();
  ctx.strokeStyle='#46e0c0'; ctx.lineWidth=2.2; ctx.beginPath();
  let norm=Math.max(0.2,a.reduce((s,v)=>s+v,0));
  for(let x=0;x<cv.width;x++){
    const t=(x/cv.width)*Math.PI*4+phase;
    let y=0; for(let k=0;k<a.length;k++) y+=a[k]*Math.sin((k+1)*t);
    const py=95-(y/norm)*74;
    if(x===0) ctx.moveTo(x,py); else ctx.lineTo(x,py);
  }
  ctx.stroke();
  const rms=Math.sqrt(a.reduce((s,v)=>s+0.5*v*v,0)).toFixed(3);
  document.getElementById('readout').textContent=`Parseval RMS = ${rms} · Harmonics = [${a.map(v=>v.toFixed(2)).join(', ')}]`;
  phase+=0.025; requestAnimationFrame(draw);
}
draw();
document.getElementById('tone').onclick=()=>{
  const ac=new (window.AudioContext||window.webkitAudioContext)();
  const a=amps(),now=ac.currentTime;
  a.forEach((amp,k)=>{
    if(amp<=0.01)return;
    const o=ac.createOscillator(),g=ac.createGain();
    o.frequency.value=220*(k+1); g.gain.setValueAtTime(amp*0.18,now);
    g.gain.exponentialRampToValueAtTime(0.0001,now+1.4);
    o.connect(g).connect(ac.destination); o.start(now); o.stop(now+1.45);
  });
};
</script></body></html>