Raspberry Pi Bat Detector

...and how to do so...
User avatar
kryptonaut
KVRian
735 posts since 25 Apr, 2011

Post Thu Sep 26, 2019 12:04 am

This is not really a music project, but it is an audio gadget.

I built a real-time pitch-shifting time-stretching device, using a Raspberry Pi Zero running in 'bare metal' mode (i.e. without any operating system). It's basically a kind of granulator which slows down incoming audio by up to 4 octaves, but works in approximately real-time by overlapping the slowed down sounds as necessary.

Image

I originally designed it for listening to slowed down birdsong, but the mics I used are responsive up to 100KHz so it's turned out to be a rather effective bat detector - it's very cool to hear them chirping as they fly overhead at dusk.

I recorded the output of a session, trimmed out the silences and tidied it up a bit: Pipistrelle bats audio

There is more info on the project here.

User avatar
whyterabbyt
Beware the Quoth
27619 posts since 4 Sep, 2001 from R'lyeh Oceanic Amusement Park and Funfair

Re: Raspberry Pi Bat Detector

Post Thu Sep 26, 2019 2:20 am

What did you use for the high-frequency audio capture?
"The bearer of this signature is a genuine and authorised pope."

User avatar
kryptonaut
KVRian
735 posts since 25 Apr, 2011

Re: Raspberry Pi Bat Detector

Post Thu Sep 26, 2019 3:39 am

The microphone is a PDM device that emits a stream of 1's and 0's that encode the acoustic pressure - the more 1's in a given interval, the higher the pressure. It's clocked at nearly 5 MHz, so it's quite capable of encoding 100KHz audio. You have to do some noise-shaping/filtering on the stream to reconstruct an audio signal, particularly if you're interested in the higher frequencies, but the processor on the Pi has a built-in 'peripheral' that does some of that for you - I did the rest of the job, and stored/added the signal into a circular buffer.

It's working the processor pretty much flat out, I had to cut a few corners to get it to produce an acceptable sound quality, but in the end I was pretty happy with the result.

User avatar
GaryG
KVRAF
5791 posts since 13 Jan, 2003 from Kent, UK

Re: Raspberry Pi Bat Detector

Post Thu Sep 26, 2019 4:57 am

Nice work, fascinating sounds.
()_()
(O.o)
(")(")

User avatar
CrystalWizard
KVRian
886 posts since 10 Jul, 2008 from Orbit Sol III

Re: Raspberry Pi Bat Detector

Post Thu Sep 26, 2019 5:04 am

Good work
gadgets an gizmos...make noise
https://soundcloud.com/crystalawareness

User avatar
vurt
addled muppet weed
51609 posts since 26 Jan, 2003 from through the looking glass

Re: Raspberry Pi Bat Detector

Post Thu Sep 26, 2019 5:29 am

cool.
pipistrelle are cute little critters too.

kvotchin
KVRist
173 posts since 9 Aug, 2018

Re: Raspberry Pi Bat Detector

Post Thu Sep 26, 2019 9:09 am

Love it. Very cool idea.

Return to “DIY: Build it and they will come”