Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript make beep

function beep() {
  var context = new AudioContext();
  var oscillator = context.createOscillator();
  oscillator.type = "sine";
  oscillator.frequency.value = 800;
  oscillator.connect(context.destination);
  oscillator.start(); 
  // Beep for 500 milliseconds
  setTimeout(function () {
      oscillator.stop();
  }, 500);
}

beep();

// See source for a parametrized sound
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #beep
ADD COMMENT
Topic
Name
9+9 =