Last active
August 29, 2015 14:17
-
-
Save quimbs/44f68f011c2c36690f2e to your computer and use it in GitHub Desktop.
Sample of usage of MediaStream as an input to an AnalyserNode in WebAudio API
This file contains hidden or 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
var analyserAudioNode, sourceAudioNode, micStream; | |
var streamReceived = function(stream) { | |
micStream = stream; | |
analyserAudioNode = audioContext.createAnalyser(); | |
analyserAudioNode.fftSize = 2048; | |
sourceAudioNode = audioContext.createMediaStreamSource(micStream); | |
sourceAudioNode.connect(analyserAudioNode); | |
/* This is our pitch detection algorithm. | |
You can find its implementation in the Autocorrelation section of this demo. */ | |
detectPitch(); | |
}; | |
navigator.getUserMedia({audio: true}, streamReceived); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment