← THESE 7
Self · The Observer Within
Chapter I · Self
साक्षी
The Witness Within
Wonder at the Edge of Neuroscience
with Dileep Saxena
Scene I · The Observer Awakens
Wonder & Neuroscience
0:00 THE WITNESS WITHIN -0:00
0:00
paused · space or tap to resume
EFTC
--- s
scene --- s remaining

You are not the thoughts.
You are not the feelings.
You are the one who notices them.

// ================================================================ // SCENE ANIMATIONS // ================================================================ function animScene(idx, t, elapsed){ const prog=Math.min(elapsed/SCENES[idx].dur,1); if(idx===0){ const emerge=Math.min(1,elapsed/6500); const starRise=Math.min(1,elapsed/11000); const bob=Math.sin(t*.6)*.06; objs.forEach(o=>{ if(o.userData.id==='bgStars'){ o.material.opacity=starRise*.35; o.rotation.y=t*.008; } if(o.userData.id==='head'){ o.material.opacity=emerge*.92; o.material.color.setHSL(.13+Math.sin(t*.3)*.02,.9,.7+.1*Math.abs(Math.sin(t))); o.position.y=1.8+bob; } if(o.userData.id==='headGlow'){ o.material.opacity=emerge*.55; o.scale.setScalar(1+.15*Math.abs(Math.sin(t*1.2))); o.position.y=1.8+bob; } if(o.userData.id==='torso'){ o.material.opacity=emerge*.85; if(Math.abs(o.position.y-.3)<0.2) o.position.y=.3+bob*.7; else if(o.position.y>0.9) o.position.y=1.1+bob; else o.position.y=-.5+bob*.5; } if(o.userData.id==='limb'){ o.material.opacity=emerge*.8; } if(o.userData.id==='aura'){ const i=o.userData.idx; const d=Math.min(1,Math.max(0,(elapsed-i*1600)/3200)); o.material.opacity=d*(.05-.009*i)*(1+Math.abs(Math.sin(t*.8+i*.5))); o.scale.setScalar(1+.07*Math.sin(t*.5+i*.3)); } if(o.userData.id==='figStars'){ const d=Math.min(1,Math.max(0,(elapsed-3500)/7000)); o.material.opacity=d*.82; o.rotation.y=t*.045; o.rotation.x=t*.018; } }); camera.position.set(Math.sin(t*.1)*.5,Math.cos(t*.08)*.3+.3,12-prog*1.5); camera.lookAt(0,.4,0); } else if(idx===1){ const cyc=(elapsed%8000)/8000; const zIn=cyc<.5, zF=zIn?cyc*2:(1-cyc)*2; objs.forEach(o=>{ if(o.userData.id==='figC'){ o.material.opacity=.72+.18*Math.abs(Math.sin(t*.5)); } if(o.userData.id==='nuc'){ const a=o.userData.idx, ang=o.userData.baseAng+elapsed/3200; o.position.set(Math.cos(ang)*(.65+a*.16),1+Math.sin(ang)*(.32+a*.09),0); o.material.opacity=zIn?zF*.88:0; o.scale.setScalar(2.2+zF*3.5); } if(o.userData.id==='elec'){ const a=o.userData.a, ang=o.userData.baseAng||0; const nucAng=(a/5)*Math.PI*2+elapsed/3200; const nx=Math.cos(nucAng)*(.65+a*.16), ny=1+Math.sin(nucAng)*(.32+a*.09); const ea=o.userData.ph+t*o.userData.spd; o.position.set(nx+Math.cos(ea)*(.26+a*.04),ny+Math.sin(ea)*(.26+a*.04),0); o.material.opacity=zIn?zF*.75:0; o.scale.setScalar(2+zF*2.5); } if(o.userData.id==='orb'){ const a=o.userData.idx, ang=(a/5)*Math.PI*2+elapsed/3200; o.position.set(Math.cos(ang)*(.65+a*.16),1+Math.sin(ang)*(.32+a*.09),0); o.material.opacity=zIn?zF*.35:0; o.scale.setScalar(2.2+zF*3.5); } if(o.userData.id==='galaxy'){ o.material.opacity=zIn?0:zF*.65; o.scale.setScalar(.3+zF*1.2); o.rotation.y=t*.04; } if(o.userData.id==='streak'){ o.material.opacity=.04+.1*Math.abs(Math.sin(t*1.5+o.userData.ph)); } }); camera.position.set(Math.sin(t*.1)*.6,Math.cos(t*.08)*.4+.3,12+Math.sin(t*.3)*2); camera.lookAt(0,.4,0); } else if(idx===2){ const interval=32000/12; objs.forEach(o=>{ if(o.userData.id==='fig3'){ o.material.opacity=Math.min(1,elapsed/1500)*.85; } if(o.userData.id==='nd'){ const i=o.userData.i; const a=Math.min(1,Math.max(0,(elapsed-i*interval)/1600)); o.material.opacity=a*(.78+.22*Math.abs(Math.sin(t*2+i*.5))); if(a>.5) o.scale.setScalar(1+.14*Math.abs(Math.sin(t*2.2+i*.8))); } if(o.userData.id==='nhl'){ const i=o.userData.i; const a=Math.min(1,Math.max(0,(elapsed-i*interval)/1600)); o.material.opacity=a*.48*Math.abs(Math.sin(t*1.5+i*.4)); o.scale.setScalar(1+.2*Math.abs(Math.sin(t*2+i*.6))); } if(o.userData.id==='nln'){ const i=o.userData.i; const a=Math.min(1,Math.max(0,(elapsed-(i+.6)*interval)/2000)); o.material.opacity=a*(.55+.2*Math.sin(t*2+i*.3)); } if(o.userData.id==='fd'){ o.userData.t+=.032; const ang=(o.userData.t%(Math.PI*2))-Math.PI/2; o.position.set(4.6*Math.cos(ang),4.6*Math.sin(ang),0); o.material.opacity=Math.min(1,elapsed/4500)*.82; } }); camera.position.set(Math.sin(t*.1)*.4,Math.cos(t*.08)*.25+.2,13-prog*2); camera.lookAt(0,.25,0); } else if(idx===3){ const ap=Math.min(1,elapsed/3200); objs.forEach(o=>{ if(o.userData.id==='viewer'){ o.material.opacity=ap*.85; } if(o.userData.id==='bdot'){ const i=o.userData.i, d=Math.min(1,Math.max(0,(elapsed-i*800)/1300)); o.material.opacity=d*(.48+.3*Math.abs(Math.sin(t*1.5+i))); o.scale.setScalar(1+.12*Math.sin(t*2+i)); } if(o.userData.id==='cloud'){ const d=Math.min(1,Math.max(0,(elapsed-2600)/2200)); o.material.opacity=d*.11; o.scale.setScalar(1+.06*Math.sin(t*.8)); } if(o.userData.id==='cring'){ const i=o.userData.i, d=Math.min(1,Math.max(0,(elapsed-2200)/2200)); o.material.opacity=d*(.28-i*.06)*(1+.3*Math.sin(t+i*.5)); o.scale.setScalar(1+.07*Math.sin(t*.7+i*.3)); } if(o.userData.id==='qualia'){ const d=Math.min(1,Math.max(0,(elapsed-4200)/2200)); o.material.opacity=d*.78; o.scale.setScalar(1+.24*Math.abs(Math.sin(t*2))); o.material.color.setHSL(.95+Math.sin(t*.4)*.03,.9,.55); } if(o.userData.id==='qring'){ const i=o.userData.i, d=Math.min(1,Math.max(0,(elapsed-4700)/2200)); const ex=1+.5*Math.abs(Math.sin(t*2.5+i*.6)); o.scale.setScalar(ex); o.rotation.x=t*.15; o.rotation.y=t*.1; o.material.opacity=d*(.33-i*.07)*(1-Math.abs(Math.sin(t*2.5+i*.6))*.3); } if(o.userData.id==='gplane'){ const i=o.userData.i, d=Math.min(1,Math.max(0,(elapsed-2000)/2200)); const sh=.5+.5*Math.abs(Math.sin(t*3.2+i*.5)); o.material.opacity=d*(.28-i*.035)*sh; o.scale.y=1+.05*Math.sin(t*2.2+i*.4); } if(o.userData.id==='gparts'){ const d=Math.min(1,Math.max(0,(elapsed-2500)/2200)); o.material.opacity=d*(.58+.4*Math.abs(Math.sin(t*1.5))); o.rotation.y=t*.25; } if(o.userData.id==='reach'){ const d=Math.min(1,Math.max(0,(elapsed-3200)/2200)); o.material.opacity=d*(.28+.2*Math.abs(Math.sin(t*.8+o.userData.ph))); } }); camera.position.set(Math.sin(t*.1)*.8,Math.cos(t*.08)*.5+.2,13-prog*1.5); camera.lookAt(-.25,.45,0); } else if(idx===4){ const ap=Math.min(1,elapsed/2200); objs.forEach(o=>{ if(o.userData.id==='figJ'){ o.material.opacity=ap*.88; const y=o.position.y>0.5?1.3:.2; o.position.y=y+Math.sin(t*.6)*.04; } if(o.userData.id==='figJglow'){ const i=o.userData.i; o.material.opacity=ap*(.38-i*.1)*Math.abs(Math.sin(t*1.2+i*.5)); o.scale.setScalar(1+.14*Math.sin(t*.8+i*.3)); o.position.y=.75+Math.sin(t*.6)*.04; } if(o.userData.id==='lpath'){ o.material.opacity=Math.min(1,elapsed/3200)*.55; } if(o.userData.id==='rpath'){ o.material.opacity=Math.min(1,elapsed/3200)*.55; } if(o.userData.id==='crystal'){ o.rotation.x+=o.userData.spd*.01; o.rotation.y+=o.userData.spd*.008; o.material.opacity=ap*(.38+.4*Math.abs(Math.sin(t*.5+o.userData.ph))); } if(o.userData.id==='lstr'){ o.userData.t+=.022; const st=o.userData.t; o.position.set(-7.5+(st%7.5)*1,o.userData.y,0); o.material.opacity=ap*(.68+.3*Math.sin(st*3)); o.material.color.setHSL(.52,.9,.6+.2*Math.sin(st)); } if(o.userData.id==='blob'){ o.userData.t+=.025; const st=o.userData.t; o.position.set(o.userData.x,o.userData.baseY+Math.sin(st+o.userData.x)*.85,0); o.material.opacity=ap*(.38+.4*Math.abs(Math.sin(st))); o.material.color.setHSL(.07+Math.sin(st*.2)*.02,.9,.6); } if(o.userData.id==='rstr'){ o.userData.t+=.018; const st=o.userData.t; o.position.set(1.5+(st%6.5)*1,o.userData.y+Math.sin(st+t)*.42,0); o.material.opacity=ap*(.68+.3*Math.sin(st*2.5)); o.material.color.setHSL(.07,.9,.7); } }); camera.position.set(Math.sin(t*.1)*.4,Math.cos(t*.08)*.3+.2,13-prog*2); camera.lookAt(0,.25,0); } else if(idx===5){ const p6=Math.min(1,elapsed/SCENES[5].dur); objs.forEach(o=>{ if(o.userData.id==='coreH'){ o.material.opacity=Math.max(0,1-p6*2.2)*.65; } if(o.userData.id==='coreB'){ o.material.opacity=Math.max(0,1-p6*2.2)*.6; } if(o.userData.id==='onion'){ const i=o.userData.i; const sp=i*4600, pk=sp+2200, ds=pk+6000; let op=0; if(elapsed>sp&&elapsedsp&&elapsed{ if(o.userData.id==='bgS7'){ o.material.opacity=settle*.22; } if(o.userData.id==='gpoint'){ o.material.opacity=settle*.94; o.scale.setScalar(1+.07*Math.sin(t*.75)); o.material.color.setHSL(.13+Math.sin(t*.18)*.01,.9,.78); } if(o.userData.id==='gring'){ const i=o.userData.i; const ap=Math.min(1,Math.max(0,(elapsed-i*1300)/2800)); o.material.opacity=ap*(.11-i*.014)*(.5+.5*Math.abs(Math.sin(t*.5+o.userData.ph))); o.scale.setScalar(1+.055*Math.sin(t*.4+i*.28)); o.rotation.x=Math.sin(t*.14+i*.18)*.05; o.rotation.y=Math.sin(t*.11+i*.14)*.04; } if(o.userData.id==='gaura'){ o.material.opacity=settle*.038*(1+.28*Math.sin(t*.55)); o.scale.setScalar(1+.045*Math.sin(t*.38)); } }); camera.position.set(Math.sin(t*.045)*.12,Math.cos(t*.038)*.08,12-settle*.5); camera.lookAt(0,0,0); } } // ================================================================ // LABELS / PROGRESS / TRANSITIONS // ================================================================ function setBrainLabel(idx){ const s=SCENES[idx]; document.getElementById('blnum').textContent='Scene '+s.num; const ln=document.getElementById('blname'); ln.textContent=s.name; ln.className='blname '+s.cls; document.getElementById('blsub').textContent=s.sub; document.getElementById('brain-label').classList.add('on'); document.getElementById('neuro-annotation').classList.add('on'); document.getElementById('brain-region-label').classList.add('on'); } function hideBrainLabel(){ document.getElementById('brain-label').classList.remove('on'); document.getElementById('neuro-annotation').classList.remove('on'); document.getElementById('brain-region-label').classList.remove('on'); } function updateDots(idx){ document.querySelectorAll('.pd').forEach((d,i)=>{ d.classList.toggle('active',i===idx); d.classList.toggle('done',i=SCENES.length){ audioEnd(); cur=SCENES.length; const e=document.getElementById('end'); if(e){e.style.opacity='1';e.style.pointerEvents='all';} inTrans=false; return; } clearTypeTimers(); hideBrainLabel(); const diss=document.getElementById('diss'); if(diss) diss.style.opacity='1'; setTimeout(()=>{ try{ objs.forEach(o=>{ try{scene.remove(o);}catch(ex){} try{if(o.geometry)o.geometry.dispose();}catch(ex){} try{if(o.material)(Array.isArray(o.material)?o.material:[o.material]).forEach(m=>m.dispose());}catch(ex){} }); while(scene.children.length) scene.remove(scene.children[0]); }catch(ex){} objs=[]; cur=idx; try{builders[idx]();}catch(ex){console.error('BUILD',idx,ex);} sceneT0=(performance.now()-_t0)/1000; try{updateDots(idx);}catch(ex){} if(diss) diss.style.opacity='0'; try{setBrainLabel(idx);}catch(ex){} try{launchCommentary(idx);}catch(ex){console.error('commentary',ex);} try{startChime(idx);}catch(ex){console.error('chime',ex);} try{if(idx===0) eftcStart();}catch(ex){} const bl=document.getElementById('back-link'); if(bl) bl.classList.add('on'); inTrans=false; },1500); } let _inTransSince=0; function loop(){ requestAnimationFrame(loop); if(isPaused){renderer.render(scene,camera);return;} const t=(performance.now()-_t0)/1000; if(inTrans){ if(_inTransSince===0)_inTransSince=t; else if(t-_inTransSince>4){inTrans=false;_inTransSince=0;} } else {_inTransSince=0;} if(cur>=0&&cur=SCENES[cur].dur-1400&&window._commentaryDone) goTo(cur+1); } renderer.render(scene,camera); } function startAnim(){ initAudio(); const ts=document.getElementById('title-screen'); ts.style.opacity='0'; setTimeout(()=>{ts.style.display='none'; goTo(0);},2500); } // ================================================================ // VIDEO PROGRESS BAR // ================================================================ function fmtTime(ms){ const s=Math.max(0,Math.floor(ms/1000)); return Math.floor(s/60)+':'+(String(s%60).padStart(2,'0')); } function vidbarInit(){ const track=document.getElementById('vidbar-track'); if(!track)return; let acc=0; SCENE_DURATIONS.forEach((dur,i)=>{ acc+=dur+(i>0?TRANSITION_MS:0); if(i===SCENE_DURATIONS.length-1)return; const pct=Math.min(99.5,(acc/TOTAL_MS)*100); const mk=document.createElement('div'); mk.className='vidbar-marker'; mk.style.left=pct+'%'; track.appendChild(mk); }); track.addEventListener('mousemove',e=>{ const rect=track.getBoundingClientRect(), pct=Math.max(0,Math.min(1,(e.clientX-rect.left)/rect.width)), ms=pct*TOTAL_MS; const tip=document.getElementById('vidbar-tooltip'), thumb=document.getElementById('vidbar-thumb'); tip.textContent=fmtTime(ms); tip.style.left=(pct*100)+'%'; thumb.style.left=(pct*100)+'%'; }); track.addEventListener('click',e=>{ if(eftcStartTime===null)return; const rect=track.getBoundingClientRect(), pct=Math.max(0,Math.min(1,(e.clientX-rect.left)/rect.width)); scrubToMs(pct*TOTAL_MS); }); document.getElementById('vidbar').classList.add('on'); } function scrubToMs(targetMs){ targetMs=Math.max(0,Math.min(TOTAL_MS,targetMs)); eftcStartTime=performance.now()-targetMs; let acc=0,targetScene=0; for(let i=0;ia+b,0)+targetScene*TRANSITION_MS; sceneT0=(performance.now()-_t0)/1000-(targetMs-ss)/1000; } if(!isPaused) vidbarTick(); } const SCROLL_STEP=15000; let scrollTimer=null; function showScrollIndicator(dir,sec){ let ind=document.getElementById('scroll-ind'); ind.innerHTML=(dir>0?'\u25B6\u25B6':'\u25C0\u25C0')+'
'+(dir>0?'+':'-')+Math.abs(sec)+'s'; ind.style.opacity='1'; clearTimeout(scrollTimer); scrollTimer=setTimeout(()=>{ind.style.opacity='0';},800); } document.addEventListener('wheel',e=>{ if(eftcStartTime===null)return; e.preventDefault(); const dir=e.deltaY>0?1:-1, elapsed=performance.now()-eftcStartTime; showScrollIndicator(dir,SCROLL_STEP/1000); scrubToMs(elapsed+dir*SCROLL_STEP); },{passive:false}); function vidbarTick(){ if(eftcStartTime===null||isPaused)return; const elapsed=performance.now()-eftcStartTime, remaining=Math.max(0,TOTAL_MS-elapsed), pct=Math.min(1,elapsed/TOTAL_MS); document.getElementById('vidbar-elapsed').textContent=fmtTime(elapsed); document.getElementById('vidbar-remaining').textContent='-'+fmtTime(remaining); const fill=document.getElementById('vidbar-fill'); fill.style.width=(pct*100)+'%'; document.getElementById('vidbar-thumb').style.left=(pct*100)+'%'; if(cur>=0&&cur0) requestAnimationFrame(vidbarTick); } // ================================================================ // EFTC // ================================================================ const SCENE_DURATIONS=SCENES.map(s=>s.dur); const TRANSITION_MS=1750; const TOTAL_MS=SCENE_DURATIONS.reduce((a,b)=>a+b,0)+(SCENES.length-1)*TRANSITION_MS; let eftcStartTime=null; function eftcStart(){ eftcStartTime=performance.now(); document.getElementById('eftc').classList.add('on'); vidbarInit(); eftcTick(); vidbarTick(); } function eftcTick(){ if(eftcStartTime===null||isPaused)return; const elapsed=performance.now()-eftcStartTime, remaining=Math.max(0,TOTAL_MS-elapsed), ds=Math.ceil(remaining/1000); const el=document.getElementById('eftc-value'); el.textContent=ds+' s'; el.classList.toggle('warn',ds<=20&&ds>8); el.classList.toggle('final',ds<=8); document.getElementById('eftc-bar-fill').style.transform='scaleX('+remaining/TOTAL_MS+')'; if(cur>=0&&cura+b,0)-cur*TRANSITION_MS; const sr=Math.max(0,Math.ceil((SCENE_DURATIONS[cur]-Math.max(0,se))/1000)); document.getElementById('eftc-scene-rem').textContent='scene \u00B7 '+sr+'s left \u00B7 '+(SCENES.length-cur-1)+' to go'; } if(remaining>0) requestAnimationFrame(eftcTick); else{el.textContent='0 s'; document.getElementById('eftc').style.opacity='0';} } // ================================================================ // AUDIO ENGINE — Warm chime/bell tones (triangle osc, high freq, short decay) // ================================================================ let audioCtx=null, masterGain=null, sceneNodes=[], audioReady=false, isMuted=false; function toggleMute(){ if(!audioReady||!audioCtx)return; isMuted=!isMuted; const btn=document.getElementById('mute-btn'), now=audioCtx.currentTime; if(isMuted){ masterGain.gain.cancelScheduledValues(now); masterGain.gain.setValueAtTime(masterGain.gain.value,now); masterGain.gain.linearRampToValueAtTime(0,now+.3); if(btn)btn.classList.add('muted'); document.getElementById('mute-path').setAttribute('d','M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z'); } else { masterGain.gain.cancelScheduledValues(now); masterGain.gain.setValueAtTime(0,now); masterGain.gain.linearRampToValueAtTime(0.72,now+.4); if(btn)btn.classList.remove('muted'); document.getElementById('mute-path').setAttribute('d','M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z'); if(audioCtx.state==='suspended') audioCtx.resume(); } } function initAudio(){ if(audioReady)return; try{ audioCtx=new(window.AudioContext||window.webkitAudioContext)(); masterGain=audioCtx.createGain(); masterGain.gain.setValueAtTime(0,audioCtx.currentTime); masterGain.connect(audioCtx.destination); audioReady=true; setTimeout(()=>{ const btn=document.getElementById('mute-btn'); if(btn){btn.style.opacity='1';btn.style.pointerEvents='all';btn.classList.add('on');} },3000); }catch(e){console.warn('Audio init failed:',e);} } function stopScene(fadeMs=1800){ if(!audioReady||!audioCtx)return; const now=audioCtx.currentTime; sceneNodes.forEach(n=>{ try{ if(n.gain){n.gain.cancelScheduledValues(now);n.gain.setValueAtTime(n.gain.value,now);n.gain.linearRampToValueAtTime(0,now+fadeMs/1000);} if(n.stop)setTimeout(()=>{try{n.stop();}catch(e){}},fadeMs+100); }catch(e){} }); sceneNodes=[]; } function mkGain(val){ const g=audioCtx.createGain(); g.gain.setValueAtTime(val,audioCtx.currentTime); g.connect(masterGain); return g; } // Core chime function: triangle oscillator, high freq, quick decay — warm bell tone function chime(freq, vol, decay, delayMs){ setTimeout(()=>{ if(!audioReady||!audioCtx)return; const n=audioCtx.currentTime; const o=audioCtx.createOscillator(); o.type='triangle'; o.frequency.setValueAtTime(freq,n); // Slight pitch drop for warmth o.frequency.exponentialRampToValueAtTime(freq*.92,n+decay*1.2); const g=audioCtx.createGain(); g.gain.setValueAtTime(vol,n); g.gain.exponentialRampToValueAtTime(0.0001,n+decay); o.connect(g); g.connect(masterGain); o.start(n); o.stop(n+decay+.05); }, delayMs); } // Scene 1: Single gentle awakening chime, then slow bell cascade function startS1Chime(){ const now=audioCtx.currentTime; // Soft ambient pad — triangle at low vol const padG=mkGain(0); padG.gain.linearRampToValueAtTime(0.06,now+5); const padO=audioCtx.createOscillator(); padO.type='triangle'; padO.frequency.setValueAtTime(220,now); const lfo=audioCtx.createOscillator(); lfo.frequency.setValueAtTime(.05,now); const ld=audioCtx.createGain(); ld.gain.setValueAtTime(3,now); lfo.connect(ld); ld.connect(padO.frequency); padO.connect(padG); padO.start(); lfo.start(); sceneNodes.push({stop:padO.stop.bind(padO),gain:padG.gain},{stop:lfo.stop.bind(lfo),gain:ld.gain}); // Awakening chimes — sparse, wonder-filled [800,2500,5000,7200,9800,13000,17000,21000,26000,31000,37000,42000].forEach((ms,i)=>{ const freqs=[880,1320,1760,1100,1540,880,2200,1320,1760,1100,880,1320]; chime(freqs[i], .14, 2.2, ms); if(i%3===0) chime(freqs[i]*1.5, .06, 1.4, ms+180); }); } // Scene 2: Zoom chimes — ascending when zooming in, descending when zooming out function startS2Chime(){ const now=audioCtx.currentTime; const ascend=()=>{ [440,554,659,880,1108,1318,1760].forEach((f,i)=>chime(f,.12,1.6,i*200)); }; const descend=()=>{ [1760,1318,1108,880,659,554,440].forEach((f,i)=>chime(f,.1,1.8,i*200)); }; ascend(); [8000,16000,24000,32000,40000].forEach((ms,i)=>{ setTimeout(i%2===0?ascend:descend,ms); }); const padG=mkGain(0); padG.gain.linearRampToValueAtTime(0.05,now+2); const padO=audioCtx.createOscillator(); padO.type='triangle'; padO.frequency.setValueAtTime(110,now); padO.connect(padG); padO.start(); sceneNodes.push({stop:padO.stop.bind(padO),gain:padG.gain}); } // Scene 3: Bell cycle — each node gets its own chime as it appears function startS3Chime(){ const now=audioCtx.currentTime; const nodeFreqs=[261,294,330,349,392,440,494,523,587,659,698,784]; nodeFreqs.forEach((f,i)=>{ const interval=32000/12; chime(f*2, .18, 2.5, i*interval); chime(f*4, .07, 1.3, i*interval+120); }); // Repeat cycle [40000].forEach(ms=>{ nodeFreqs.forEach((f,i)=>{ chime(f*2,.12,2,.ms+i*400); }); }); const padG=mkGain(0.045); const padO=audioCtx.createOscillator(); padO.type='triangle'; padO.frequency.setValueAtTime(87,now); padO.connect(padG); padO.start(); sceneNodes.push({stop:padO.stop.bind(padO),gain:padG.gain}); } // Scene 4: Mysterious — high shimmering chimes with slight dissonance for the gap function startS4Chime(){ const now=audioCtx.currentTime; // Gap shimmer — slightly detuned pair [0,2500,5500,9000,13000,18000,24000,30000,37000,42000].forEach(ms=>{ chime(1760,.08,2.8,ms); chime(1848,.05,2.2,ms+80); // slightly sharp — uncanny chime(880,.06,3.5,ms+350); }); // Qualia pulse — warm but unreachable const padG=mkGain(0); padG.gain.linearRampToValueAtTime(0.08,now+4); const padO=audioCtx.createOscillator(); padO.type='triangle'; padO.frequency.setValueAtTime(440,now); const lfo=audioCtx.createOscillator(); lfo.frequency.setValueAtTime(.06,now); const ld=audioCtx.createGain(); ld.gain.setValueAtTime(5,now); lfo.connect(ld); ld.connect(padO.frequency); padO.connect(padG); padO.start(); lfo.start(); sceneNodes.push({stop:padO.stop.bind(padO),gain:padG.gain},{stop:lfo.stop.bind(lfo),gain:ld.gain}); } // Scene 5: Two tones — high crisp (logic), warm flowing (intuition), harmonize at center function startS5Chime(){ const now=audioCtx.currentTime; // Logic chimes — crisp, regular intervals [0,2000,4000,6000,8000,10000,12000,14000,16000,18000,20000,22000,24000,26000,28000,30000,32000,34000,36000,38000].forEach((ms,i)=>{ if(i%2===0) chime(1318+i*22,.1,1.5,ms); // crisp logic else chime(880+i*18,.12,2.2,ms); // warm intuition if(i>8) chime(1046,.07,2.8,ms+600); // harmony emerges }); const padG=mkGain(0.04); const padO=audioCtx.createOscillator(); padO.type='triangle'; padO.frequency.setValueAtTime(261,now); padO.connect(padG); padO.start(); sceneNodes.push({stop:padO.stop.bind(padO),gain:padG.gain}); } // Scene 6: Dissolving — forms appear as chimes then fade, pure tone rises function startS6Chime(){ const now=audioCtx.currentTime; const formMs=[0,900,1800,2700,3600,4500,5400,6400,7600,9000,10500,12000,13500,15000,17000,19000,21000,23500,26000,28500,31000,33500,36000,38500,41000]; formMs.forEach((ms,i)=>{ chime(200+Math.random()*900, .1, 2.5+Math.random(), ms); }); // Pure witness tone rises gradually const wG=mkGain(0); wG.gain.linearRampToValueAtTime(0.13,now+32); const wO=audioCtx.createOscillator(); wO.type='triangle'; wO.frequency.setValueAtTime(528,now); wO.connect(wG); wO.start(); sceneNodes.push({stop:wO.stop.bind(wO),gain:wG.gain}); // Ambient pad const padG=mkGain(0.04); const padO=audioCtx.createOscillator(); padO.type='triangle'; padO.frequency.setValueAtTime(132,now); padO.connect(padG); padO.start(); sceneNodes.push({stop:padO.stop.bind(padO),gain:padG.gain}); } // Scene 7: Single chime, then stillness with barely-audible breath function startS7Chime(){ const now=audioCtx.currentTime; // Opening chime — pure and clear chime(1760,.22,4.5,200); chime(2640,.09,3.2,500); chime(880,.08,5,1000); // Occasional subtle chimes — like a clock in silence [6000,14000,22000,31000].forEach(ms=>{ chime(1320,.07,3.5,ms); chime(1760,.04,2.8,ms+800); }); // Barely-audible presence tone const presG=mkGain(0); presG.gain.linearRampToValueAtTime(0.025,now+8); const presO=audioCtx.createOscillator(); presO.type='triangle'; presO.frequency.setValueAtTime(432,now); presO.connect(presG); presO.start(); sceneNodes.push({stop:presO.stop.bind(presO),gain:presG.gain}); } function startChime(sceneIdx){ if(!audioReady||!audioCtx)return; if(audioCtx.state==='suspended') audioCtx.resume(); stopScene(1600); const now=audioCtx.currentTime; masterGain.gain.cancelScheduledValues(now); masterGain.gain.setValueAtTime(isMuted?0:0,now); if(!isMuted) masterGain.gain.linearRampToValueAtTime(0.72,now+1.8); if (sceneIdx===0) startS1Chime(); else if(sceneIdx===1) startS2Chime(); else if(sceneIdx===2) startS3Chime(); else if(sceneIdx===3) startS4Chime(); else if(sceneIdx===4) startS5Chime(); else if(sceneIdx===5) startS6Chime(); else if(sceneIdx===6) startS7Chime(); } function audioPause(){ if(!audioReady||!audioCtx)return; if(audioCtx.state==='running') audioCtx.suspend(); } function audioResume(){ if(!audioReady||!audioCtx||isMuted)return; if(audioCtx.state==='suspended') audioCtx.resume(); } function audioEnd(){ if(!audioReady||!audioCtx)return; const now=audioCtx.currentTime; masterGain.gain.cancelScheduledValues(now); masterGain.gain.setValueAtTime(masterGain.gain.value,now); masterGain.gain.linearRampToValueAtTime(0,now+4.0); } initThree();