With all the hectic home renovation, moving, class teaching, and the general shitshow that we are calling 2025, I haven’t had time to do some fun projects in a very long while. But not today! Today, we - are - counting - birbs!
As someone who grew up in NYC, outside of what you can learn from watching TV, I could honestly recognize less than 10 different birds: flying rats – I mean pigeons, sparrows, starlings, mockingbirds, blue jays, cardinals, geese, ducks, and “seagulls”. Moving out into the suburbs this year has made me more aware of the chirping birbs nearby, though I am completely at a loss as to what kinds of birds they are. Plus my eyes are crap so good luck finding one way up in a 50 foot high oak tree.
Enter Birdnet
Years ago, researchers at Cornell made something co…
With all the hectic home renovation, moving, class teaching, and the general shitshow that we are calling 2025, I haven’t had time to do some fun projects in a very long while. But not today! Today, we - are - counting - birbs!
As someone who grew up in NYC, outside of what you can learn from watching TV, I could honestly recognize less than 10 different birds: flying rats – I mean pigeons, sparrows, starlings, mockingbirds, blue jays, cardinals, geese, ducks, and “seagulls”. Moving out into the suburbs this year has made me more aware of the chirping birbs nearby, though I am completely at a loss as to what kinds of birds they are. Plus my eyes are crap so good luck finding one way up in a 50 foot high oak tree.
Enter Birdnet
Years ago, researchers at Cornell made something cool, a neutral net framework trained to identify birds by their songs called birdnet. After all, if skilled humans can do it, surely a classifier can, right? Well, the end result is Birdnet, which is a suit of tools that successfully does this.
More importantly, the research project open sourced the tools and it’s been incorporated into various things, like for example the Merlin phone app which lets you run the model live on your phone. The phone model is great for when you are walking out in the woods or park and need help identifying what birds you are hearing.
While a phone model is great for many reasons, it’s a battery and space drain to keep it running. Plus it also hogs your microphone. If you wanted to run the model more continuously, like putting a mic out by your home somewhere, you’d have to set up a computer that records audio and passes it to the project’s audio segmenter tool and analyzer tool for classification. Or, you use a tool like birdnet-pi (or a more modern fork) or birdnet-go that does it all for you in a neat little setup on a (relatively) cheap piece of hardware. I had a raspberry pi 4 in my parts bin for ages and all I needed to get was a cheap microphone setup (more on that later).
As of this writing, birdnet-pi seems to have more features, but doesn’t have as much active development compared to birdnet-go. It’s probably worth checking out both over time.
Once I had birdnet-pi setup, it started immediately listening through the attached mic. Every 15 seconds or so it saves a recording file and runs the analyzing software on it. Detections that pass a certain (adjustable) threshold of certainty by the model are then saved into a SQLite database along with the recorded snippet of that bird’s sound. It can even report the data up to birdweather if you allow it.
The default daily visualization for the current day of bird data
I also found that the SQLite database can be queried from within the web interfaces tool menu. It’s a super simple 1-table setup but makes for an easy dataset to practice basic SQL queries with. You can also use it to practice making your own data visualizations from scratch. So for anyone who wants to practice with some live, real data, this is a great place to start.
Screenshot of the data in the detection table (minus lat/lon)
After having it run for a few days, I learned that a lot more bird species were living nearby than I had expected. Even more interesting was how some species were simply passing by on their spring migration to lands further north. With the help of its labeling and the recordings, I’ve actually slowly started to become familiar with more calls now as I’m walking around. I won’t ever become a birder because I don’t have the motivation to really go down that route, but it’s cool to be able to just passively learn more over time.
So anyways, it’s a fun little project to do for the cost of slightly older raspberry pi hardware. The software even runs on the old 3b+ and small pi zero 2 boards with some extra swap. Some people have also got it to run on x86 containers with some code tweaks.
Things to know about setting one up
Getting the software setup wasn’t hard, essentially just follow the instructions on the project page. The modern raspberry pi image flasher software already allows you to preset details like the hostname and Wi-Fi credentials. Very slick and simple.
The only hiccup I encountered was apache2 started up and took over port 80 when it wasn’t supposed to. Disabling apache2 and restarting caddy service fixed things.
# stop and disable apache2
sudo systemctl stop apache2
sudo systemctl disable apache2
# now restart the failed caddy service
sudo systemctl start caddy
Microphones are a different story
While the usability of small Linux systems have improved vastly over the decades, microphone technology still carries a lot of legacy compatibility baggage.
For my setup, I got a very cheap ($14) lavalier condenser mic (the kind you clip to your clothing) that came with a USB adapter. But like all condenser mics, it requires power to work, supplied by a LR44 cell battery that I did not want to constantly have to change. Since it had a 3.5mm TRRS connector, buying another adapter that supplies the correct power would work. Except there are two competing standards for the wiring (CTIA and OMTP) and vendors may not label their compatibility well. The TRRS adapter I got didn’t work correctly with my mic, and ultimately instead of buying another and playing more parts roulette, I slapped together a dummy LR44 battery system with a scrap power-only USB cable, a LM2596 buck converter to convert the 5V USB power to 1.4V, some wire, and a 3d printed dummy battery. It’s sounds sketchy but it actually works.
When you have more spare parts than willingness to ever change a battery...
Cheap mics are nice because you need to record sounds outdoors for this, which means they’re susceptible to potential weather damage from temperature swings, wind, rain, sunlight, and humidity. Waterproof mics are expensive (plus inherently can’t sound as good), nice mics that are very sensitive and make great recordings are expensive and sensitive to damage without even more spendy enclosures/shields. Figuring out placement, weather protection, power, mounting is a whole DIY project you can obsess over if you wanted. To save some money, you can also build your own really nice mics for significantly cheaper using easily obtainable parts, it’s a fun electronics hobby.
For anyone interested in building their own mic to do field recording, the nerds (I mean that as praise) at the micbuilders group are a great resource. They have lots of diagrams and resources available in their file archives. You can also build a simple48 mic or an Alice mic circuit which don’t cost too much but are “studio quality”.
As for me, I currently just have my raspberry pi plugged into an outlet in my office, the mic is clipped to a part of the window screen, with the rest of the window gently closed on the wire to avoid damaging it too much. Much as I’d love to drag my old Blue Yeti mic out of retirement for this, I don’t have a good place to put such a giant mic where it can hear the outside.
After running this thing for close to two weeks now, it’s managed to collect recordings from 37 different species – much more than I had ever expected. Who knew there were so many birds around?
In the future I’ll probably move the setup somewhere that gets fewer sounds from the nearby streets to hopefully collect better data. After I figure out how to adapt a 3d printed weather temperature shield to house the mic nicely.
Standing offer: If you created something and would like me to review or share it w/ the data community — just email me by replying to the newsletter emails.
Guest posts: If you’re interested in writing something, a data-related post to either show off work, share an experience, or want help coming up with a topic, please contact me. You don’t need any special credentials or credibility to do so.
“Data People Writing Stuff” webring: Welcomes anyone with a personal site/blog/newsletter/book/etc that is relevant to the data community.
About this newsletter
I’m Randy Au, Quantitative UX researcher, former data analyst, and general-purpose data and tech nerd. Counting Stuff is a weekly newsletter about the less-than-sexy aspects of data science, UX research and tech. With some excursions into other fun topics.
All photos/drawings used are taken/created by Randy unless otherwise credited.
- randyau.com — homepage, contact info, etc.
Supporting the newsletter
All Tuesday posts to Counting Stuff are always free. The newsletter is self hosted. Support from subscribers is what makes everything possible. If you love the content, consider doing any of the following ways to support the newsletter:
- Consider a paid subscription – the self-hosted server/email infra is 100% funded via subscriptions, get access to the subscriber’s area in the top nav of the site too
- Send a one time tip (feel free to change the amount)
- **Share **posts you like with other people!
- Join the Approaching Significance Discord — where data folk hang out and can talk a bit about data, and a bit about everything else. Randy moderates the discord. We keep a chill vibe.
- Get merch! If shirts and stickers are more your style — There’s a survivorship bias shirt!