Skip to content

Astro Devosfera

LIVE LOFI

A space where curiosity turns into code. Exploring web development, software architecture, and everything that makes the tech world go round.

Tuesday • Code Sandbox
1 2 3 4 5 6 7 8 9 10 11 12
// 🎵 Fast in-browser Web Audio Scale Synthesis
function playScale(notes = ["C", "D", "E", "F", "G"]) {
  const ctx = new AudioContext();
  notes.forEach((note, i) => {
    const osc = ctx.createOscillator();
    const gain = ctx.createGain();
    osc.frequency.setValueAtTime(
      getFreq(note), ctx.currentTime + i * 0.13
    );
    osc.connect(gain).connect(ctx.destination);
    osc.start(ctx.currentTime + i * 0.13);
    osc.stop(ctx.currentTime + (i + 1) * 0.13);
  });
}

Recent

[6/ 25]