Tried in chrome canary and it works! Browser issue, hope they'll fix it soon
Getting audio data as array from microphone
-
01-06-2022 - |
Question
I want to log audio data that i get from microphone:
window.AudioContext = window.AudioContext || window.webkitAudioContext;
var context = new AudioContext();
var analyser = context.createAnalyser();
navigator.webkitGetUserMedia({ audio: true }, function (stream) {
var source = context.createMediaStreamSource(stream);
source.connect(analyser);
analyser.connect(context.destination);
setInterval(function () {
var array = new Uint8Array(analyser.frequencyBinCount);
analyser.getByteFrequencyData(array);
console.log(array);
}, 1000);
}, function () { });
I'm talking in microphone but logged array contains only 0 values every time. Can you tell me what i'm doing wrong? Thanks
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow