Last active
August 29, 2015 14:04
-
-
Save jacksonhenry3/6f0ee51db01199d8d45d to your computer and use it in GitHub Desktop.
webaudioTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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