Skip to content

Instantly share code, notes, and snippets.

@vighnesh153
Created May 4, 2020 04:07
Show Gist options
  • Save vighnesh153/7c6819a8c0a6c3ebe9ab4f18db788b77 to your computer and use it in GitHub Desktop.
Save vighnesh153/7c6819a8c0a6c3ebe9ab4f18db788b77 to your computer and use it in GitHub Desktop.
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
const play = (freq = 440, time = 2000) => {
const oscillator = audioContext.createOscillator();
oscillator.connect(audioContext.destination);
oscillator.frequency.value = freq;
oscillator.start();
setTimeout(() => {
oscillator.stop();
}, time)
};
const annoyingSound = () => {
play(220, 50000);
play(420, 50000);
play(620, 50000);
play(820, 50000);
play(1020, 50000);
play(1220, 50000);
};
annoyingSound();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment