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

Enable simultaneous usage of audioinput events and streamToWebAudio

edimuj opened this issue · comments

commented

Today the plugin allows a user to either use audioinput events or streamToWebAudio to get the captured audio data.

It should be possible to specify that both are used at the same time. Since this behavior can be considered as a breaking change, it should not be enabled by default, but instead activated by a new parameter in the capture cfg, like for example, alwaysEnableAudioEvents (default: false), which can be used to override the default behavior.

Sorry... I'm new to Github, but I've forked your repo and added the capability to stream to multiple WebAudio API nodes. This should be useful, because you can access raw audio data while also streaming to a speaker / graphical interface. I've also added the capability to stream to a bluetooth headset.

I would have submitted a fork or PR but I'm new to Github and didn't know how, also my code is a breaking change (it requires an "id" for each audioNode, so that connections and disconnections are made appropriately).

https://github.com/Project-Oblio/cordova-plugin-vybuds-audioinput

commented

Hi and thanks for your contribution. I’m looking forward to study it some more in the coming days, and get back to you regarding how to best incorporate your code into the project.

It might be easier to just explain in words. The problem was that the audioinput.disconnect() method disconnects ALL audio nodes and is called every time you connect to a node. So, everytime you connect to a node, you disconnect from a previous one. Having a dict of connected audioNodes and specifying an "id" (audioinput.connect(audioNode,id) and audioinput.disconnect(id)) makes this an easy fix.

The bluetooth SCO channel is currently only working/tested for android.

commented

Sorry for the loong delay, but I've been really busy with various projects, but I've finally looked at your code. I understand why you implemented these changes, and they make sense in specific scenarios. But since it is breaking changes, I cannot incorporate them in this project. At least not "as is", but it would be a good addition if it was possible to have this feature in the plugin as an option rather than forcing all current users to change their implementations. I'll think about a good way of doing this in a future version of the plugin, but I can't promise that it will happen anytime soon, since my time is limited (sadly) :)

Hi, any news about this? Thank you for your time :)