Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

3.3 KB
Raw Blame
<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Blue hour</title><style>*{box-sizing:border-box}body{margin:0;padding:7%;background:#315be4;color:#f5edcc;font-family:Arial,sans-serif}header{font-size:10px;letter-spacing:3px}h1{font-size:clamp(65px,14vw,160px);letter-spacing:-.075em;line-height:.8;margin:45px 0;font-weight:700}.steps{display:grid;grid-template-columns:repeat(8,1fr);gap:8px}button,select{font:inherit;color:inherit;background:transparent;border:0;cursor:pointer}select{width:100%;text-align:center;padding:12px 1px;font-size:12px}option{background:#315be4}.step{background:#ffffff16;padding-top:10px}.step.active{background:#f5edcc;color:#315be4}.step small{display:block;text-align:center;font-size:9px}nav{display:flex;align-items:center;gap:25px;margin-top:32px;flex-wrap:wrap}nav button{font-size:18px;min-width:80px;padding:10px 0;text-align:left}label{font-size:11px;display:flex;gap:10px;align-items:center}input{max-width:100px;accent-color:#f5edcc}p{font-size:11px;color:#d2dbff;margin-top:25px;line-height:1.6}</style><header>A LITTLE INSTRUMENT</header><h1>BLUE<br>HOUR.</h1><div class="steps" id="steps"></div><nav><button id="play">Play</button><label>Tempo <input id="tempo" aria-label="Tempo" type="range" min="60" max="140" value="92"><span id="bpm">92</span></label></nav><p>Change a note. Find a feeling.<br>Sound starts when you press Play. Turn your volume down for the first listen.</p><script>const notes={Rest:0,C:261.63,D:293.66,E:329.63,G:392,A:440},pattern=['C','G','A','E','G','D','E','Rest'];for(let i=0;i<8;i++){const div=document.createElement('div');div.className='step';const small=document.createElement('small');small.textContent=i+1;const s=document.createElement('select');s.setAttribute('aria-label','Note '+(i+1));Object.keys(notes).forEach(n=>{const o=document.createElement('option');o.textContent=n;o.selected=n===pattern[i];s.append(o)});s.onchange=()=>pattern[i]=s.value;div.append(small,s);document.getElementById('steps').append(div)}let audio,timer,running=false,step=0;function tick(){document.querySelectorAll('.step').forEach((el,i)=>el.classList.toggle('active',i===step));const frequency=notes[pattern[step]];if(frequency){const osc=audio.createOscillator(),gain=audio.createGain();osc.type='sine';osc.frequency.value=frequency;gain.gain.setValueAtTime(0,audio.currentTime);gain.gain.linearRampToValueAtTime(.09,audio.currentTime+.025);gain.gain.exponentialRampToValueAtTime(.001,audio.currentTime+.5);osc.connect(gain).connect(audio.destination);osc.start();osc.stop(audio.currentTime+.55)}step=(step+1)%8;timer=setTimeout(tick,30000/Number(document.getElementById('tempo').value))}function stop(){running=false;clearTimeout(timer);document.querySelectorAll('.step').forEach(el=>el.classList.remove('active'));document.getElementById('play').textContent='Play'}document.getElementById('play').onclick=async()=>{if(running){stop();return}try{audio??=new AudioContext();await audio.resume();running=true;document.getElementById('play').textContent='Stop';tick()}catch{document.getElementById('play').textContent='Audio unavailable'}};document.getElementById('tempo').oninput=e=>document.getElementById('bpm').textContent=e.target.value;addEventListener('pagehide',stop);document.addEventListener('visibilitychange',()=>{if(document.hidden)stop()});</script></html>