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

crackling with web audio #100

Open bigxd123 opened 5 years ago

bigxd123 commented 5 years ago

Is it crackling for anyone else? I tried playing around with the sample rate, enhance the queue directly of the chunks with the web audio api and timing of the context itself but nothing helped the voice streamed from the microphone has little cracks here and there.

And ofc I also tried my own web audio chain with proper timing and not using setTimeout but even that crackles its very minor but its not great.

bigxd123 commented 5 years ago

I played around with it a bit and changed some performance intensive parts and achieved some good results and wanted to share it:

https://pastebin.com/EVQu4X30

this pretty much is a drop in replacement for getUserMedia as well which ofc doesnt support any actual constraints, those still need to be configured via the cfg of audioinput BUT it does handle starting and stopping of the underlying recording and keeps track of Tracks.

This should only be used as rough idea since its lacking error handling of the library itself and enough testing to be used in production.

pgcan commented 5 years ago

I am also getting the same crackling sound on WebAudio. The sound is input via USB input in my mobile device. It works fine when I record the audio as WAV file but when sound is converted to Web Audio and sent over WebRTC there is crackling sound. I tested with a constant frequency tone but check the sound wave graph at this link https://ibb.co/Wv0LpRg.