I'm interesting in accessing both microphone on a phone using the Android Oboe library. Most phones have a dual-mic configuration and I'd like to read data from both at the same time. I've extended the "LiveAffect" sample from Oboe, and tried the following:
Having two oboe::AudioStream, one for each microphone on my phone (Note 9 and Pixel 1). Running only one of the streams works fine, I'm able to read the data and play it back/save to file. But starting both streams doesn't work (I get the following error when attempting to start the second stream via stream->requestStart()
: E/AUDIO-APP: Error starting stream. ErrorInvalidState). Apparently starting two input streams is an Android limitation as discussed in this SO question: Android Oboe Library: 2 streams recording from 2 recording devices possible?
Having one stream but with 2 channels. The two mics on my Note 9 are part of the same group, yet when I open a stream with either of them with 2 channels (->setChannelCount(oboe::ChannelCount::Stereo);
), I get duplicate data in both channels for only one microphone. I've tried playing around with AudioStreamBuilder
settings, for example setting ->setInputPreset(oboe::InputPreset::Camcorder)
. None of the InputPresets
settings fixed it, still mirrored data in both channels.
Both attempts did not work using OpenSL backend either.
I'm fairly sure this is a problem with that particular device. A user reported an identical issue on the JUCE forum here. I have filed a bug internally (id: 133143785) and will attempt to route this to Samsung for further investigation.