Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript make sound

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 #sound
ADD COMMENT
Topic
Name
6+5 =