<html> | |
<body> | |
<script> | |
// use the HTML5 audio API to make a beep. | |
var context = new webkitAudioContext(); | |
var volume = context.createGain(); | |
volume.gain.value = 0.5; | |
volume.connect(context.destination); | |
var synth = context.createOscillator(); | |
synth.connect(volume); | |
// I think 0 is the default type? Let’s see what we get. | |
synth.type = 0; | |
// Play an ‘A’ at 440Hz, the typical tone used to tune an instrument. | |
synth.frequency_value = 440; | |
// Actually play a note. | |
synth.noteOn(0); | |
// In 2 seconds, stop playing the note. | |
setTimeout(synth.noteOff, 2000); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment