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

有帮助吗?

解决方案

Tried in chrome canary and it works! Browser issue, hope they'll fix it soon

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top