= window.AudioContext || window.webkitAudioContext;
        const audioContext = new AudioCtx();

        if ( audioContext.state === "suspended" ) {
          try { await audioContext.resume(); } catch { }
        }

        const now = audioContext.currentTime;
        const duration = 0.5; // total beep length

        // --- Nodes ---
        const envGain = audioContext.createGain();              // envelope gain (pre-compressor)
        const compressor = audioContext.createDynamicsCompressor();
     