The Joy of BirdNetPi

I don’t think I’ve had as much enjoyment for a piece of software for a very long time as I’ve had with BirdNET-Pi. It’s a realtime acoustic bird classification system for the Raspberry Pi. It listens through a microphone you place somewhere near where you can hear birds, and it’ll go off and guess what it’s hearing, using a cut-down version of the BirdNET Sound ID model. It does this 24/7, and saves the samples it hears. You can then go to a web page (running on the same Raspberry Pi) and look up all the species it has heard.

Our Garden

a somewhat overgrown garden with budding green trees against blue sky

Not very impressive, kind of overgrown, in the wrong part of town. Small, too. But birds love it. At this time of year, it’s alive with birds. You can’t make them out, but there’s a pair of Rose-breasted Grosbeaks happily snacking near the top of the big tree. There are conifers next door too, so we get birds we wouldn’t expect.

We are next to two busy subway/train stations, and in between two schools. There’s a busy intersection nearby, too. Consequently, the background noise is horrendous

What I used

This was literally “stuff I had lying around”:

  • Raspberry Pi 3B+ (with power supply, case, thermostatic fan and SD card)
  • USB extension cable (this, apparently, is quite important to isolate the USB audio device from electrical noise)
  • Horrible cheap USB sound card: I paid about $2 for a “3d sound” thing about a decade ago. It records in mono. It works. My one is wrapped in electrical tape as the case keeps threatening to fall off, plus it has a hugely bright flashing LED the is annoying.
  • Desktop mic (circa 2002): before video became a thing, PCs had conferencing microphones. I think I got this one free with a PC over 20 years ago. It’s entirely unremarkable and is not an audiophile device. I stuck it out a back window and used a strip of gaffer tape to stop bugs getting in. It’s not waterproof, but it didn’t rain the whole week it was out the window.
  • Raspberry Pi OS Lite 64-bit. Yes, it has to be 64 bit.
  • BirdNET-Pi installation on top.

I spent very little time optimizing this. I had to fiddle with microphone gain slightly. That’s all.

What I heard

To the best of my knowledge, I have actual observations of 30 species, observed between May 7th and May 16th 2023:

American Goldfinch, American Robin, Baltimore Oriole, Blue Jay, Cedar Waxwing, Chimney Swift, Clay-colored Sparrow, Common Grackle, Common Raven, Gray Catbird, Hermit Thrush, House Finch, House Sparrow, Killdeer, Mourning Dove, Nashville Warbler, Northern Cardinal, Northern Parula, Orchard Oriole, Ovenbird, Red-winged Blackbird, Ring-billed Gull, Rose-breasted Grosbeak, Ruby-crowned Kinglet, Song Sparrow, Veery, Warbling Vireo, White-throated Sparrow, White-winged Crossbill, Wood Thrush

I’ll put the recordings at the end of this post. Note, though, they’re noisy: Cornell Lab quality they ain’t.

What I learned

This is the first time that I’ve let an “AI” classifier model run with no intervention. If it flags some false positives, then it’s pretty low-stakes when it’s wrong. And how wrong did it get some things!

allegedly a Barred Owl, this is clearly a two-stroke leafblower
Black-Billed Cuckoo? How about kids playing in the school yard?
Emergency vehicles are Common Loons now, according to BirdNetPi
Police cars at 2:24 am are Eastern Screech-Owls. I wonder if we could use this classifier to detect over-policed, under-served neighbourhoods?
Great Black-backed Gulls, or kids playing? The latter
Turkey Vulture? How about a very farty two-stroke engine in a bicycle frame driving past?
(This thing stinks out the street, blecch)

There are also false positive for Trumpeter Swans (local dog) and Tundra Swans (kids playing). These samples had recognizable voices, so I didn’t include them here.

The 30 positive species identifications

Many of these have a fairly loud click at the start of the sample, so mind your ears.

American Goldfinch

American Robin

Baltimore Oriole

(I dunno what’s going on here; the next sample’s much more representative)

Blue Jay

Cedar Waxwing

Chimney Swift

Clay-colored Sparrow

Common Grackle

Common Raven

Gray Catbird

Hermit Thrush

House Finch

House Sparrow

Killdeer

Mourning Dove

Nashville Warbler

Northern Cardinal

Hey, we’ve got both of the repetitive songs that these little doozers chirp out all day. Song 1:

and song 2 …

Northern Parula

Orchard Oriole

Ovenbird

Red-winged Blackbird

Ring-billed Gull

Rose-breasted Grosbeak

Ruby-crowned Kinglet

Song Sparrow

Veery

Warbling Vireo

White-throated Sparrow

White-winged Crossbill

Wood Thrush

Boring technical bit

BirdNetPi doesn’t create combined spectrograms with audio as a single video file. What it does do is create an mp3 plus a PNG of the spectrogram. ffmpeg can make a nice not-too-large webm video for sharing:

ffmpeg -loop 1 -y -i 'birb.mp3.png' -i 'birb.mp3' -ac 1 -crf 48 -vf scale=720:-2 -shortest 'birb.webm'

(Minor update, May 2024: the original project maintainer has moved on, so I changed the project link to point to Nachtzuster/BirdNET-Pi: A realtime acoustic bird classification system for the Raspberry Pi 5, 4B 3B+ 0W2 and more. Built on the TFLite version of BirdNET.)

birb chirper v2.0

This is one of those toys that you whirl around on a piece of string and it makes a chirping sound like a flock of sparrows. I have no idea what they’re called, so I called it birb_chirper.

Print Settings

Printer: Reach 3D
Rafts: Doesn’t Matter
Supports: Doesn’t Matter
Resolution: 0.3 mm
Infill: 0%

Notes: This is a thin-walled model, so use at least two shells and no infill for smooth walls.

Post-Printing

Take a piece of thin string about 1 metre long (I used micro-cord, very fine paracord), pass it through the hole in the tip, then tie off a jam knot that’s big enough to stop in the hole in the top but still pass back through the slot in the side. Now whirl the thing around fast by the string, and it should start to chirp.

This is intended for the amusement of small children and the annoyance of adults.

How I Designed This

The tip of this thing is an ogee curve. I’ve included my library for creating simple ogee and ogive profiles in OpenSCAD.

// ogive-ogee example
// scruss, 2018
use <ogive_and_ogee.scad>;
ogive(20, 35);
translate([0, -5])text("ogive(20,35)", size=3);
translate([30, 0])ogee(20, 35);
translate([30, -5])text("ogee(20,35)", size=3);

Download: Thingiverse —birb_chirper by scruss. Local copy: birb_chirper.zip

All the printers I’ve ever owned …

bird you can see: hp print test

  • An ancient (even in 1985) Centronics serial dot-matrix printer that we never got working with the CPC464. The print head was driven along a rack, and when it hit the right margin, an idler gear was wedged in place, forcing the carriage to return. Crude, noisy but effective.
  • Amstrad DMP-2000. Plasticky but remarkably good 9-pin printer. Had an open-loop ribbon that we used to re-ink with thick oily endorsing ink until the ribbons wore through.
  • NEC Pinwriter P20. A potentially lovely 24-pin printer ruined by a design flaw. Print head pins would get caught in the ribbon, and snap off. It didn’t help that the dealer that sold it to me wouldn’t refund my money, and required gentle persuasion from a lawyer to do so.
  • Kodak-Diconix 300 inkjet printer. I got this to review for Amiga Computing, and the dealer never wanted it back. It used HP ThinkJet print gear which used tiny cartridges that sucked ink like no tomorrow; you could hear the droplets hit the page.
  • HP DeskJet 500. I got this for my MSc thesis. Approximately the shape of Torness nuclear power station (and only slightly smaller), last I heard it was still running.
  • Canon BJ 200. A little mono inkjet printer that ran to 360dpi, or 720 if you had all the time in the world and an unlimited ink budget.
  • Epson Stylus Colour. My first colour printer. It definitely couldn’t print photos very well.
  • HP LaserJet II. Big, heavy, slow, and crackling with ozone, this was retired from Glasgow University. Made the lights dim when it started to print. Came with a clone PostScript cartridge that turned it into the world’s second-slowest PS printer. We did all our Canadian visa paperwork on it.
  • Epson Stylus C80. This one could print photos tolerably well, but the cartridges dried out quickly, runing the quality and making it expensive to run.
  • Okidata OL-410e PS. The world’s slowest PostScript printer. Sold by someone on tortech who should’ve known better (and bought by someone who also should’ve known better), this printer jams on every sheet fed into it due to a damaged paper path. Unusually, it uses an LED imaging system instead of laser xerography, and has a weird open-hopper toner system that makes transporting a part-used print cartridge a hazard.
  • HP LaserJet 4M Plus. With its duplexer and extra paper tray it’s huge and heavy, but it still produces crisp pages after nearly 1,000,000 page impressions. I actually have two of these; one was bought for $99 refurbished, and the other (which doesn’t print nearly so well) was got on eBay for $45, including duplexer and 500-sheet tray. Combining the two (and judiciously adding a bunch of RAM) has given me a monster network printer which lets you know it’s running by dimming the lights from here to Etobicoke.
  • IBM Wheelwriter typewriter/ daisywheel printer. I’ve only ever produced a couple of pages on this, but this is the ultimate letter-quality printer. It also sounds like someone slowly machine-gunning the neighbourhood, so mostly lives under wraps.
  • HP PhotoSmart C5180. It’s a network photo printer/scanner that I bought yesterday. Really does print indistinguishably from photos, and prints direct from memory cards. When first installed, makes an amusing array of howls, boinks, squeals, beeps and sproings as it primes the print heads.

tunes I must learn (eventually)

Not all of these could be classed as banjo tunes, but I’d want to try, anyway:

  • The Coo-Coo Bird (it’s not optional)
  • The Old Plank Road (Uncle Dave’s delivery, which was more demented than the Rounders)
  • Hot Corn, Cold Corn (like HMR; just how does one spell moo’m moo’m moo’m de boo’m boo’m de boo’m?)
  • I’m Going In A Field (Nic Jones style)
  • Bridges & Balloons (Joanna’s song’s just crying out to be covered with a broad Glasgow accent)
  • Needle of Death (too many banjo tunes are too happy)
  • Ghost (the Neutral Milk Hotel one)
  • something by Sufjan (even if Peter Stampfel says he plays banjo kind of boringly)
  • I Love How You Love Me (like Mangum, not Spector)

a tiny stub-tailed birdlet

Our tree is filled with Ruby-crowned Kinglets, and the title is Peterson’s poetic description of them. I guess they’re feeding up to migrate a bit south. Give news of yourselves when you bring spring back with you!

people are stupid

There’s going to be some ranting here, so I advise folks to look at this nice picture of a monarch butterfly I took at Bluffer’s Park today, and move along:

monarch butterfly - spotty!

In the park there was a gull that wasn’t moving like the others. I got close to it, and discovered there was a large fishing lure lodged through its beak. I had no way of helping it, and a nearby parks crew couldn’t do anything either. It could fly, just, but the big lure slowed it down, and the trailing fishing line mad it stumble.
I know gulls are often seen as nuisance birds, but no animal deserved
this fate. There’s no fishing and no kite flying in this park because there are so many birds. I’m angry that someone could be so thoughtless.

There’s a picture below the fold. You probably don’t want to see it.

queen west

Went to Canzine today after meeting. Can you belive it, an almost full house and it was a silent meeting?

Anyway, Canzine was full. Bought a couple of Spacing TTC buttons to show my commuter tribe affiliation (Kennedy — Union), and also a m@b book. Eveyone’s favourite Bramptonian Friendly Rich was there, being friendly and well-dressed. Jim Munroe looked in his element in his No Media Kings room.

After that, I walked down to the turbine. The warm weather had brought the ladybirds out. They were all over the deck.

importing mail from Mozilla Thunderbird on Linux to Mac

How lucky that Thunderbird uses the same text mail format for storing messages. All I needed to do was scp individual server directories from under .thunderbird to ~/Library/Thunderbird/Profiles/saltname.default/Mail — that did the job!

I didn’t use the shared global inbox that Thunderbird uses by default. If you do what I did, you probably shouldn’t either.

broken bird

Walked by two agitated starlings. A third starling was on its back in the road, legs kicking. It looked like a fledgling, maybe fallen and couldn’t get up. I went over to pick it up. Red stuff had come out its head. A vehicle had hit it. The parents were hopping about, screaming. There was nothing I could do; nothing to pick it up with. Couldn’t dispatch it with sandals.

I walked back to the verge. There was another starling fledgling hiding in the grass, a sibling maybe. It had soft grey nest-fuzz among its feathers, the wide yellow slash of a nestling’s beak. It ran close to me for comfort, then stopped. Not all moving things might be friends. We watched one another, the parents still screaming. I had to leave.

bird, ice

red tail hawk flying over frozen credit river.