Skip to content

Instantly share code, notes, and snippets.

@geelen

geelen/index.html

Forked from anonymous/index.html
Created Dec 19, 2012
Embed
What would you like to do?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
</head>
<body>
<script>
(function ( window, document ) {
// Pinched domready
// http://www.dustindiaz.com/smallest-domready-ever/
var readyState = function ( fn ) {
if( /in/.test( document.readyState ) ) {
window.setTimeout( function () {
readyState( fn );
}, 9 );
} else {
fn();
}
},
init = function () {
var context = new webkitAudioContext(),
oscillator = context.createOscillator();
oscillator.connect(context.destination); // Connect to speakers
oscillator.noteOn(0); // Start generating sound immediately
oscillator.frequency.value = 200;
};
// DOM ready
readyState( init );
}( this, this.document ));
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment