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.
https://github.com/edimuj/app-audioinput-demo
MIT License
161 stars 88 forks source link

Ionic + iOs 13.1.3 #106

Open aschwersenz opened 4 years ago

aschwersenz commented 4 years ago

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!

nth-chile commented 4 years ago

+1

numerized commented 4 years ago

Same here, I had to go back to 1.0.1

ipostu commented 2 years ago

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