/** The mockup's click feedback: a short rising blip per interaction. */ let context: AudioContext | null = null; export function playPop(frequency: number): void { try { context ??= new AudioContext(); const now = context.currentTime; const oscillator = context.createOscillator(); const gain = context.createGain(); oscillator.type = "sine"; oscillator.frequency.setValueAtTime(frequency, now); oscillator.frequency.exponentialRampToValueAtTime(frequency * 1.8, now + 0.08); gain.gain.setValueAtTime(0.15, now); gain.gain.exponentialRampToValueAtTime(0.001, now + 0.15); oscillator.connect(gain).connect(context.destination); oscillator.start(); oscillator.stop(now + 0.16); } catch { // No audio context before the first user gesture, and on some browsers never. } }