Skip to content

Instantly share code, notes, and snippets.

@sfate
Forked from kylebragger/gist:3901888
Created November 5, 2012 10:44
Show Gist options
  • Save sfate/4016579 to your computer and use it in GitHub Desktop.
Save sfate/4016579 to your computer and use it in GitHub Desktop.
var playSingleChime = function()
{
var context = new webkitAudioContext(),
gain = context.createGainNode(),
osc = context.createOscillator();
osc.connect(gain);
gain.connect(context.destination);
osc.frequency.value = 1000.0;
osc.type = osc.SQUARE;
gain.gain.setValueAtTime(gain.gain.value, context.currentTime);
gain.gain.linearRampToValueAtTime(0.0, 0.5);
osc.noteOn(0);
osc.noteOff(0.5);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment