Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microphone Sensitivity/Support #45

Open
Ricat87 opened this issue May 4, 2024 · 31 comments
Open

Microphone Sensitivity/Support #45

Ricat87 opened this issue May 4, 2024 · 31 comments

Comments

@Ricat87
Copy link

Ricat87 commented May 4, 2024

Hi! Thanks so much for doing this, I found it on F-Droid and it introduced me to the entire birdNET family. I understand you must have reasons for only releasing the app through F-Droid, even if it's inconvenient for me to export the APK to share the app with my friends who would never download F-Droid themselves.

I've been using whoBIRD on my Pixel 8 and I find that it often has a hard time picking up birds unless they're fairly loud even to my ears. My friend used it at a beach and I was thinking that it was probably windy there, but I've used it in a few places where it wasn't windy and struggled as well.

Is there any kind of microphone level that can be adjusted in Android in general that could be incorporated into the app? Now that I'm typing this, I'm thinking I should comb through my settings and see if there are any noise cancelling or other features globally that could be getting in the way. I don't think I've turned anything on, though.

If there's not really anything on that front, would it be possible to support USB microphones with much better sensitivity?

Thanks!!!

@woheller69
Copy link
Owner

Unfortunately there is no setting for the microphone level in Android. I do not have a USB microphone, so I do not know if that would provide an advantage.

Publication on Google Play is considered commercial use by BirdNET which is not allowed by their license. Just help your family and friends installing F-Droid. So send them the fdroid apk. From there they can install tons of apps free from tracking, malware and ads, not just whoBIRD :-)

@woheller69
Copy link
Owner

Support for USB seems quite difficult. But supporting Bluetooth microphones might be simple according to ChatGPT.
If someone has a BT microphone (I don't have one) and has it configured as audio input device, please try this and let me know if it works:
app-release.apk.zip

-Uninstall
-Remove .zip and install

@Ricat87
Copy link
Author

Ricat87 commented May 5, 2024

I agree about encouraging people to use F-Droid, but it seems a lot of people just don't trust anything that's not the Play Store :<

Thank you! I only have some Galaxy Buds and a BT Logitech headset so I don't think those are quite right, but I work for a school district and I can possibly get ahold of a Bluetooth microphone on Monday. I'll let you know if I do!

@woheller69
Copy link
Owner

ok, great.

I don't trust anything that's IN Play Store :-)

@nishantnnb
Copy link

Unfortunately there is no setting for the microphone level in Android. I do not have a USB microphone, so I do not know if that would provide an advantage.

Publication on Google Play is considered commercial use by BirdNET which is not allowed by their license. Just help your family and friends installing F-Droid. So send them the fdroid apk. From there they can install tons of apps free from tracking, malware and ads, not just whoBIRD :-)

Hello @woheller69 ,
As I remember, I think your very first version had mic sensitivity control or gain control slider.

Keep up the good work.
best regards,
Nishant.

@woheller69
Copy link
Owner

yes, but they had no effect. The BirdNET model adjusts the gain itself.

@Ricat87
Copy link
Author

Ricat87 commented May 19, 2024

ok, great.

I don't trust anything that's IN Play Store :-)

Hey, I'm sorry that it took me so long to get back to you. At one point I wrote most of a reply and then lost it somehow.

Unfortunately I couldn't get my hands on a BT mic from work, it would seem we're too fancy and all of the rooms with AV equipment have more professional wireless setups.

I was going to borrow a USB microphone and just try plugging it in with an adapter, to see if Android itself would just use it in the app, but I haven't quite got that far yet. Plus the mics they have are probably optimized for close up use but I don't really know microphones that well. Maybe they can do both.

I wandered around outside my place this morning with the app running and I didn't pick up a ton despite the cacophony of bird noises all around me. I did downgrade to the F-Droid build first, and downloaded the 32 bit model to see if it seemed different. (Is it better in any way?)

I'm beginning to suspect that perhaps my Pixel's microphones are clogged with pocket lint, because I'm certain the app worked a lot better right around the time I got the phone a few months ago. So I'm going to find the best way to clean them out that I can and try again after.

For these purposes, what would qualify as the "correct" kind of BT mic? Obviously not a headset. When I search Amazon for a BT mic I see a lot of lavalier and karaoke mics. I feel like these are all probably optimized for picking up nearby sounds and wonder if there's something out there that would be better suited to catching bird calls omnidirectionally.

@Bernd-Vogelgesang
Copy link

Hi, I dare to chime in into this thread.
Long story long: The idea of the app is just great and it might be even a huge help for my job. The possibility to geolocate recognitions and monitor that in real-time is just awesome!
Running the data later though some geostatistical routines might be a great addtion to the classical bird mapping approaches.

But the inbuilt microphones have a huge drawback: In case of only a little wind, the recognitions often drop to zero due to the noise at the microphone itself.

So 2 years ago, I bought a directional USB-C mic ( https://rode.com/de/microphones/on-camera/videomic-go-ii ) which works out of the box and even has the possibility to plug in an analog headset, so I can monitor real-time what gets picked up by the microphone and a "dead cat" reduces wind noises to a great extend.

But this mic has a drawback as well: It is too sensitive for lower frequencies. The spectrogram in BirdNET shows a thick bar of noise up to 1000 Hz. Cars from 1km away literally roll through my head.

The original app from Rode is just a bad joke. It offers a high-pass filter, but only up to 150 Hz.
So even with this mic, the recognition rate is not getting better or sometimes even worse.

Have been searching high and low for any drop-in audio filters for two years now, but can't find anything.
In principle, my setup would be perfect if I only could find ways to calibrate / filter the audio input.
I mean, it sounds very obvious to me that the quality of the input has to affect the quality of the recognition, but it seems to be near to impossible on Androids to influence that.

Anyone any ideas?

@woheller69
Copy link
Owner

does the USB-C mic work without code changes with whoBIRD?

@Bernd-Vogelgesang
Copy link

yes, it works out of the box on a Samsung Galaxy Active Tab 3 with Android 11 both within BirdNet (where i can see the spectrogram) and also in whoBird. The Rodin Central app just adds the useless filter and gains for record and monitor, but is actually not necessary.

@woheller69
Copy link
Owner

So that means other mics might work. Are you using whoBIRD from F-Droid or the modified version for Bluetooth above?

Have you tried to use Voice Recognition as audio input in BirdNet settings? If yes, does it improve the situation?

@erikhb
Copy link

erikhb commented May 25, 2024

I have just tested a Thomann tbone USB microphone I use for conferencing and it was automatically used by Android 11, probably in a similar way it uses USB headsets. I have not tested if it does help with Whobird recognition, but will try to test in the next days.

@Bernd-Vogelgesang
Copy link

So that means other mics might work. Are you using whoBIRD from F-Droid or the modified version for Bluetooth above?

I just discovered whoBird and F-Droid some days ago, so i installed the normal version when I found it.

Have you tried to use Voice Recognition as audio input in BirdNet settings? If yes, does it improve the situation?

Short answer: Yes, I did. Looking at the spectrogram, it seems to reduce a tiny bit of the lower noises in the lowest end, but it seems it has no effect or makes things even worse. When a tried it today, it seemed that recognitions suddenly all were "Columba oenas", which i remembered from my last years testings, but I then could not tell if this was just ordinary BirdNET behavior, my microphone, other settings, whatever ...

Long answer:
It is incredibly hard to test those things in the field. There are so many parameters I tried to adjust beforehand in BirdNET to figure out the best settings, but this was always a pretty confuse trial-and-error approach.

Having no idea which of the four input options to use: Just recently read in one of the issues that "unprocessed" is the expected input. Was not able to find that information anywhere else beforehand.

Playing around with different settings for the amplification, leave default or reduce at different stages.

Using the Rode Connetect App as preprocessor or not: switching high-frequency boost on/off, switching high-pass filter on 75 Hz/150 Hz / off.
Leaving the gain to zero or a small amout or medium or full

Doing all this while switching back and forth to BirdNet to watch the spectrogram, waiting for a bird to sing, relistening the recording of the snipped, testing the recognition, changing settings ....

Now in whoBird, I do not even have a spectrogram, so this adds switching from BirdNet to whoBird, settings there, settings in Rode app, while facing ever changing environmental conditions ... wind is blowing or not, birds sing or not, a plane crosses the sky or not, cars, lawn mowers, tractors, chainsaws in the forest ......

If anyone has an idea how to systematically approach this problem, it would help me a lot.

@Ricat87
Copy link
Author

Ricat87 commented May 25, 2024

This is all awesome, thank you all. I forgot to bring home a USB mic for the weekend 😅

@Bernd-Vogelgesang
Copy link

fun fact: My growling stomach was just recognized by whoBird as "Botaurus stellaris" with 54% confidence. I think I have to reduce the gain ... and eat something

@woheller69
Copy link
Owner

I am just doing some experiments with filtering.
Maybe you want to try this version. It should have a high pass-filter with @ 1000Hz.
Not sure if it works...

-Uninstall
-Remove .zip and install
app-release.apk.zip

@erikhb
Copy link

erikhb commented Jun 6, 2024

Short feedback on the USB microphones: In silent environments the USB mic had a superior detection rate on my phone, but with background noises (engines, people etc) it was on par with the phone or worse. This could be because of the mic itself or other characteristics. High pass-filtering sounds promissing. I will try the apk when I find some time

@woheller69
Copy link
Owner

Here comes a better version for testing with several options for high-pass and audio source.

app-release.apk.zip

Not sure if the app will finally be released with these options. We need to see if they bring an advantage...

@Ricat87
Copy link
Author

Ricat87 commented Jun 6, 2024

Whoops, lost the post I was going to make this morning...

Thanks! I tried the first high-pass version yesterday morning as I got the opportunity to walk from a clinic to my office early in the morning. To be clear, I am still only using the built-in device microphones.

I could see and hear birds quite clearly in a green belt area but the current published version of the app was not picking anything up. I installed the high-pass v1 on my Pixel 8 and started getting some detections immediately. It still felt like it was not quite as good as I thought it used to be. (Come to think of it, I have not tried installing an older version of the app to check if it did detect more or if that is just me.)

I installed the high-pass v1 on my Z Flip 4 as well and kept walking. Once I got to the edge of a large urban forest park at the edge of a huge parking lot at my office's campus, I stood with both phones trying to get some more detections. I could hear all kinds of birds but only barely picked up a hummingbird very close by.

Afterwards, I made a 30 second recording using the voice recording apps on both devices at roughly the same time to investigate what they were hearing. I am not sure of the best way to share them so I put them in my Google Drive and will paste links here:

https://drive.google.com/file/d/1Ho0NJ_wn3gFdKLeHhqIESxsiYK0aCaiX/view?usp=sharing (Z Flip 4)

https://drive.google.com/file/d/1O_SmgxHn0Nxu1d1DCejuXun-EoG-089d/view?usp=sharing (Pixel 8)

For some reason I had to re-encode the Pixel 8 file using Audacity before I could just listen to it in Drive on the web. It doesn't seem to have affected the volume or quality. The Pixel one is in stereo, the Z Flip one is mono.

So those are examples of what the phones are able to hear, while just before recording that I was not getting any detections save the one very brief 20% or so match to a hummingbird that was on a light post next to me.

I don't know if this will help but I hope so!

@Bernd-Vogelgesang
Copy link

Sorry for the late reply.
Tested the Version #1 yesterday and today with my USB-Microphone

Without a spectrogram it is really a guessing-game how much the influence was, but I "feel" that it had better recognitions with street noises.
At 5am in the morning, a car drove my just some meters way and in the same moment I got a recognition, which, I think, would not have been possible with the other version.
The car noise was really loud in my headphones, but still it picked up the bird behind it.

If anyone could help me to figure out a way to systematically test this, I would be grateful.

Side-notes: Sometimes I hear a bird clearly through the headphones but get no recognition. Then I stop and restart the analysis, and in the same moment, I get a recognition. Might be only coincidences, but, as I said, hard to find out.

Will install #2 today and try it tomorrow.

@woheller69
Copy link
Owner

Here is a new version which has a settings activity.
It allows to select the audio source, set the frequency for a high-pass filter and set the
minimum detection threshold.

Please try.
-uninstall
-remove .zip and install

app-release.apk.zip

@Bernd-Vogelgesang
Copy link

Tested on my Samsung tablet and a Xiaomi Redmi sucessfully.
5% Threshold for the sensitivity is enough to eliminate the complete bogus (walking noises). Fun to play around with.
Thanx for the sliders. Still hard to figure out which setting for the high-pass filter has which (or any) effect.

On the Redmi, the recording indicator did not work.

@woheller69
Copy link
Owner

Recording indicator needs animations. These must not be switched off in Android...

@woheller69
Copy link
Owner

Here is a version that should also support microphones connected as bluetooth headset.

-Uninstall
-Remove .zip and install
-Switch on in settings, maybe you also need to use audio source "microphone" instead of "unprocessed"
app-release.apk.zip

@woheller69
Copy link
Owner

It seems this is experimental. On my phone it works (Moto G54) but according to specs it only supports 8kHz sampling rate and we need 48kHz...
https://developer.android.com/reference/android/media/AudioManager.html#startBluetoothSco()

@woheller69
Copy link
Owner

Another update which requests permission BLUETOOTH_CONNECT. For me it works without but from documentation it is unclear whether it is needed. ("If your app communicates with already-paired Bluetooth devices, declare the BLUETOOTH_CONNECT permission.")

app-release.apk.zip

Let me know if and which Bluetooth devices work for you.

@Ricat87
Copy link
Author

Ricat87 commented Jun 22, 2024

I haven't tested any external microphones, still, but this is AWESOME and you are AWESOME.

With the latest beta I picked up a huge variety of birds just wandering around my front yard. The vast majority of them were between 25% and 5% but for some reason at this time of the morning today there were very few birds anywhere close to me. The detections were all coming from quite far away. Previously I would have been getting nothing but the occasional Steller's Jay (and we probably all know why, haha.)

The high pass definitely helps, but I need to read up on frequency again to get better at tweaking it.

I almost logged a separate issue called "I have fat fingers :(" but this is only relevant to the features in this beta: I have an incredibly hard time trying to fine tune the sliders. Unless I somehow missed it, could you please make it possible to tap on the number and input it directly? I hope that's not hard to do, I honestly know nothing about app development as my work in IT is almost everything except programming and UI design.

I am also unsure what the difference is between Unprocessed, Microphone, and Voice Recognition?

Also what is different about the 32 bit model?

@Ricat87
Copy link
Author

Ricat87 commented Jun 22, 2024

Tested on my Samsung tablet and a Xiaomi Redmi sucessfully.
5% Threshold for the sensitivity is enough to eliminate the complete bogus (walking noises). Fun to play around with.
Thanx for the sliders. Still hard to figure out which setting for the high-pass filter has which (or any) effect.

On the Redmi, the recording indicator did not work.

What kind of microphone are you using?

I have an idea:

Screenshot_20240622-083347.png

Screenshot_20240622-083448~2.png

That exact parabolic microphone is sold by a ton of obvious drop shoppers on Amazon, so I'm willing to bet the thing can be had for less on AliExpress.

I originally looked for a type C line in adapter so no modification would be needed, but that is oddly difficult to find.

I'm sure that the output on it is a processed headphone out, not a raw mic out, so if I got one I would open it up and wire up a bypass coming straight out of the microphone output, probably just use the existing headphone jack to make it clean.

I don't have any money to do this right now, but maybe sometime soon...

@woheller69
Copy link
Owner

Unprocessed etc, see here:
https://developer.android.com/reference/android/media/MediaRecorder.AudioSource

BirdNET is available in 32bit, 16bit, and 8bit.
Best is 32bit, but the performance of 16bit should be almost the same and is recommended.

@woheller69
Copy link
Owner

with manual edit for highpass and threshold (click on value and edit)
app-release.apk.zip

@stevedee
Copy link

stevedee commented Nov 7, 2024

I know this is an old thread, but reading through the posts I notice Bernd-Vogelgesang was asking for a way to test & compare the system when trying different filtering.

I think that testing outside is a waste of time because you cannot control the environment or rely on your ears to compare sound levels.

Testing can be conducted in a reasonably quiet room with soft furnishings (e.g. bed/sofa/curtains) to reduce echo (ideally you want an acoustically 'dead' room).

Here are some of my notes on comparing microphones:-
http://captainbodgit.blogspot.com/2024/01/birdnet-pi-more-thoughts-on-microphones.html

Repeatability is the key point here. You can use a similar approach to check filtering by mixing sound sources, e.g. use a good, clean recording of a common bird, and slowly blend in pre-recorded sounds from (say) your local street or park.

An audio mixer would be ideal, but you could just use 2 phones or computers as sound sources, providing you can control levels in a repeatable way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants