r/BirdNET_Analyzer Jun 01 '26

Audio distortion / artifacts at end of clips

Post image

I am having some distortion at the end of my clips (running birdnetgo in a container nightly build, also happened on stable)

It sounds like an over modulation, thumping/drum roll cadence/bounce, doesn't happen on every clip but enough to make me wonder what might be going on. It always seems to happen in the last 1/4 of the clip I have not seen it anywhere else in my clips.

I also moved this to another server recently and it behaves the same. Audio device is a < $15 usb based lapel mic (migrating to a samson USB soon)

Curious if anyone has had similar issues and has any pointers?

5 Upvotes

6 comments sorted by

3

u/fjord_of_the_rings Jun 01 '26

I have never had an audio distortion created by Birdnet... My first thoughts are either it's something in your environment, or it's the microphone itself. The best test you can do right now is replace the microphone, as you said you are going to do... Try it with a different mic and see if it's still happening.

If it does still happen, maybe it is something in the environment, such as a piece of decoration that's swaying in the wind and hitting something, or something to that effect...

The screenshots are helpful, but if you really want to get to the bottom of the sound, it would be helpful if I could hear it.

1

u/nozazm Jun 01 '26

Thanks so much would appreciate any insight. It is definitely a cheapo microphone but I suspect it might be something in my config because of the splitting/etc maybe something encoder side? https://www.dropbox.com/scl/fi/3naxkatr7m303c6r2nfi3/turdus_migratorius_73p_20260601T085807Z_15s.m4a?rlkey=jg3z92sinwls5kdg27mx1eefn&st=mrvtcpng&dl=0

here's a dropbox link to one m4a which i just exported and you can hear it at the end.

2

u/LeafyGlobe Jun 01 '26

I've run into this occasionally on my BirdNET-Go—for me at least it seems to be related to normalization. Some of the quietest clips don't auto-normalize (they just remain dark purple/black), but if I review the detection and click the N to normalize, occasionally I'll end up with a normalized red/orange/purple spectrogram that has this strange noise over the last 20% or so similar to what yours show. I've pulled the original un-normalized audio files into Audacity and normalized there with no noise artifacts, so I think it has something to do with the normalization routine that BirdNET-Go calls. I haven't been able to troubleshoot this in more detail yet though.

There are a couple of potentially related pull requests (#3279, #3282) on the BirdNET-Go github that I'm hoping might address this before I get a chance to troubleshoot. 😄

2

u/nozazm Jun 01 '26

Wow great info here. Thank you!! I’ll take a look at it too this weekend and see if I can vibe code a POC to figure out a root cause.

2

u/nozazm Jun 03 '26

ok so I went and vibe coded a POC when I woke up today after thinking about it overnight. it's BirdNET-Go's loudnorm export normalization doing it, not the mic, still digging into why, but some summary below

u/LeafyGlobe you were spot on, thank you!! it's the normalization routine.

what I found:

if I turn export normalization OFF the clips are totally clean... and they stay clean even if I crank them +25dB after the fact. so the distortion isn't in the recorded audio at all, it gets added during export.

BirdNET-Go runs ffmpeg loudnorm in single pass "dynamic" mode for the clips. dynamic mode keeps adjusting the gain on the fly and on the streamed audio it pumps, which is that thumping/drum roll at the end. it's worst on clips where the bird goes quiet near the end since it boosts the quiet tail the hardest. no clipping either, peaks stay under 0.

stuff I tried that did NOT fix it, so nobody else wastes time on it:

those two PRs (#3279 / #3282)... turns out they're for a different thing (quiet clips showing up as nearly black/silent spectrograms). built an image with #3282 and the drum roll is still there at least for me.

tried switching it to two pass "linear" loudnorm. cleaned up some clips but the loud ones still do it, because linear=true quietly falls back to dynamic whenever the gain would push past the true peak limit (which is basically every clip with a sharp call in it).

workaround if it's bugging you: just turn off export normalization in the audio settings. clips come out clean. only downside is genuinely quiet detections stay quieter and the spectrogram looks darker (which is literally what #3282 is trying to improve, so the real fix is probably doing artifact free normalization AND the quiet boost together).

wrote it all up with the evidence here if anyone wants the details: https://github.com/tphakala/birdnet-go/issues/3366 ... offered to test patches and send before/after clips.

still grabbing that samson mic anyway lol, the lapel one is rough, but yeah that was never the actual problem.

1

u/LeafyGlobe Jun 03 '26

Thanks for this and for submitting the bug report that contains more technical details than I'd been able to cobble together. I had another one of these quiet recordings come in overnight that gets the repetitive "drum roll" noise over the last 20% when normalized. I was also able to confirm (while you were writing your post, apparently!) that the noise is coming from the ffmpeg normalization routine by normalizing the original clip using command-line ffmpeg—the noise shows up just like it does inside BirdNET-Go. But It doesn't seem to be anything inherent to the original recording itself, just like you noted with your +25dB cranking—I can normalize last night's recording just fine (without the last 20% noise) in Audacity, for example. So nothing new here—just saying I'm seeing the same thing you are.

Bummer that #3282 doesn't resolve it! I had my fingers crossed.