Skip to content

Instantly share code, notes, and snippets.

@jacksonhenry3
Last active August 29, 2015 14:04
Show Gist options
  • Save jacksonhenry3/6f0ee51db01199d8d45d to your computer and use it in GitHub Desktop.
Save jacksonhenry3/6f0ee51db01199d8d45d to your computer and use it in GitHub Desktop.
webaudioTest
<!doctype HTML>
<html>
<head>
<meta charset='UTF-8'>
<meta name="viewport" content="width=device-width, height=device-height">
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body id = 'a'>
</body>
<script type="text/javascript" src = 'webAudioTest.js'></script>
</html>
function gotStream(stream) {
window.AudioContext = window.AudioContext || window.webkitAudioContext;
var audioContext = new AudioContext();
// Create an AudioNode from the stream.
var mediaStreamSource = audioContext.createMediaStreamSource( stream );
// Connect it to the destination to hear yourself (or any other node for processing!)
mediaStreamSource.connect( audioContext.destination );
}
function onFail(){}
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;
navigator.getUserMedia( {audio:true}, gotStream, onFail );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment