edimuj / cordova-plugin-audioinput

This iOS/Android Cordova/PhoneGap plugin enables audio capture from the device microphone, by in near real-time forwarding audio to the web layer of your application. A typical usage scenario for this plugin would be to use the captured audio as source for a web audio node chain, where it then can be analyzed, manipulated and/or played.

Home Page:https://github.com/edimuj/app-audioinput-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ionic + iOs 13.1.3

aschwersenz opened this issue · comments

Hi,

I am trying to do a frequency analysis of the current microphone input using your plugin and ionic. My code looks like this

   const audioContext = new webkitAudioContext();

    audioinput.start({
        audioContext: audioContext, 
        streamToWebAudio: true
    });

    const analyser = audioContext.createAnalyser();
    audioinput.connect(analyser);

    const bufferLength = analyser.frequencyBinCount;
    let dataArray = new Uint8Array(bufferLength);

    for (let i = 0; i < 100; i++) {
        analyser.getByteFrequencyData(dataArray);
        console.log(dataArray);
    }

But the array always just contains 0. I read somewhere that there is a bug with 1.0.2, so I reverted to 1.0.1 but to no avail. Any ideas what I am doing wrong?

Thanks!

Same here, I had to go back to 1.0.1

I had a similar issue related to this, the problem in my case was that I was also using getUserMedia to get microphone data and presumably there was a race condition for the same hardware resource