woheller69 / whoBIRD

Identify bird sounds in real time with this Android version of BirdNET. Bird sound recognition for more than 6,000 species worldwide.
GNU General Public License v3.0
292 stars 15 forks source link

Audio source selection #20

Closed BlueMax closed 5 months ago

BlueMax commented 6 months ago

An option to choose audio source would be great. On my smartphone external mic/stereo gives unprocessed/raw 2ch-stereo from both built-in microphones (top/bottom) that is much better than just one mic alone (audio paths might differ from device to device though). I've tested this thoroughly with Recforge II. Maybe OpenCamera might be of help here as it is open-source as well.

audio01 audio02

woheller69 commented 6 months ago

there is no such audio source available. And how do you define "better"? Louder? or what?

https://developer.android.com/reference/android/media/MediaRecorder.AudioSource#MIC

BlueMax commented 6 months ago

"Better" in being more sensitive catching more surroundings (as it uses two directional opposite microphones at once). The catch here might not necessarily be "external mic" but rather having both mics in use without noise-cancellation. The way to achieve this might differ from phone to phone (audio render paths) so giving options to the user might be the best choice. Some phones do not allow unprocessed dual-mic so using 'back' or 'front' (as single mic) is the only option there. But at least you can choose.

https://www.androidpolice.com/2019/04/03/android-q-now-has-an-api-that-allows-apps-to-select-which-microphone-to-use/

woheller69 commented 6 months ago

No idea how that would work as there is no such audio source for MediaRecorder as you can see in my link above. If someone knows it - I am looking forward to receiving a pull request.

BlueMax commented 6 months ago

OpenCamera uses setAudioChannels for stereo (both microphones). There is no explicit microphone selection (front/back).

RecForge II has (new API?) microphone selection (front/back). Setting Mono/Stereo has separate menu (maybe same api as above). Unfortunately, its not open source. They might using setPreferredMicrophoneDirection or maybe setPreferredDevice.

RFII01 RFII02

woheller69 commented 6 months ago

We need mono and unprocessed. Mono can also use both microphones.

Mrnofish commented 6 months ago

This is a great suggestion. Another open source app that allows source selection:

https://gitlab.com/axet/android-audio-recorder/

It would also be cool if the app could analyze existing recordings that are stores on the device.

I understand this should be a different ticket but thought I would float it here first.

woheller69 commented 6 months ago

Maybe it is wishful thinking that audio source selection changes anything. In the end those are just processed variants of the currently used unprocessed input. And that is exactly what BirdNET needs - unprocessed 48kHz mono input.

Mrnofish commented 6 months ago

Maybe it is wishful thinking that audio source selection changes anything

Source selection would allow to use external microphones as in actually outside the device, for instance Bluetooth.

The ability to place an inexpensive battery-powered Bluetooth microphone strategically, and then go in hiding, instead of playing scarecrow with device in hand, should open up interesting avenues.

woheller69 commented 5 months ago

this version provides the options provided by AudioSource (same as in BirdNET app)

app-release.apk.zip For me this does not make any difference. So currently I do not plan to merge this.

-Uninstall -Remove .zip and install

Mrnofish commented 5 months ago

Did you give the idea of interfacing with Bluetooth microphones any consideration ?

woheller69 commented 5 months ago

I do not have a Bluetooth microphone. If someone wants to implement and test a PR will be considered

Mrnofish commented 5 months ago

You don't have a headset...?

woheller69 commented 5 months ago

No

Mrnofish commented 5 months ago

Enjoying this app? Help us grow by sharing #whobird with your friends and followers on Instagram! Together, let's build a vibrant community!

Sounds like a plan.