Closed smgdesign closed 5 years ago
Thanks! Well, depending on which device you run your app on, not all samplerates are supported. I believe that on iOS for example, the minimum samplerate is 22050Hz. Could that explain your issue?
Hi, thanks for the reply. I did some more investigation and can confirm that the minimum sample rate for iOS is actually 8kHz so that definitely wasn't the issue. I forked the plugin and set it up locally to do some debugging and found that the sample rate was being followed by the capture event. I had an issue converting the data, once I corrected that problem, the number of samples reflected what I was expecting. Many thanks for getting back to me.
Good to hear that you solved this, and thanks for the update.
Hi there, great plugin, it's really useful!
I'm using it in Cordova and recording wav input from the microphone into an array buffer that I then pass to a C library for audio analysis.
It's all working really well, but the audioinput event doesn't seem to be listening to the sample rate I set. I'm probably using it wrong, or misunderstanding the way the event is utilised but was wondering if you could identify if there's an issue?
This is my captureCfg:
sampleRate: window.audioinput.SAMPLERATE.VOIP_16000Hz, bufferSize: 8192, channels: window.audioinput.CHANNELS.MONO, format: window.audioinput.FORMAT.PCM_16BIT, normalize: false, audioSourceType: window.audioinput.AUDIOSOURCE_TYPE.DEFAULT
And I have confirmed when I run
window.audioinput.getCfg()
that the sample rate is being used by the plugin. But the capture event is running containing 8192 samples far more frequently than I am expecting with 16kHz.Initiating the audioinput event with
window.addEventListener('audioinput', this.onAudioInputCapture, false)
and I simply concatenate the evt.data to an object each time.I hope this is enough information to help highlight where I'm going wrong with it!