Am I bats? Part 1
How walking the dog with my daughter turned into a technology odyssey.
I enjoy walking my dog (a Shiba Inu) with my daughter, especially when the weather is pleasant. Earlier this week it was a particularly pleasant evening in Chapel Hill: the sweet air was cool like nighttime in summer, but the sun had at least 10 minutes to go before setting. All of a sudden, we both saw a bat swoop around a street lamp, eagerly pursuing its evening meal.
"IT'S A BAT!" my daughter exclaimed.
My mind raced into action: what should I do with this information? And before I could consider the consequences of my response, I blurted out "Let's go back home and get the digital recorder! I'll be we can record it!"
She looked at me seriously: "Don't be silly, Daddy. Humans can't hear bats!"
And that's when I said what any techno-parent would say: "True. But I know how to make it so we can hear the bats..."
We hurried back home (much to the consternation of the dog). I grabbed my trusty SONY PCM-D1 and began to work out just how I was going to make good on my promise.
By the time we'd return to where we'd seen the bats, the sun had set and we couldn't see anything. We stayed by the streetlight for as long as I could hold my daughter's attention, but in the end we saw no more bats and had to return home. Never one to disappoint, I said "that's OK, we can try again tomorrow".
"REALLY?!" my duaghter exclaimed. When we got home, she yelled to my wife "GUESS WHAT!? DADDY IS AWESOME!" Talk about pressure!
We returned the following night, and the night after that, but both times we were hounded by threatening skies, flashes of light, and other portents of evening thunderstorms. I seriously thought about writing a blog entry titled "No Blogs Lately? I blame the weather...".
It would take another three days before we had our first audio capture of the bats, and each day I realized just how impossibly high I'd set the bar for myself. It's one thing to bring home a present that requires some assembly. "Insert Tab A into Slot B" takes on a whole new dimension when Tab A is ultrasonic and you don't know the finite acoustic limits of Slot B.
The PCM-D1 can sample 24-bit audio at 96 kHz, which according to the Nyquist theorem means that the audio should be good to 48 kHz, the lower end of the bat range (which goes up to 200 kHz). The built-in microphones, though very good, are down 10 dB at 20kHz and 20 dB at 30 kHz, and that's more of a problem. What the heck--what is science if not testing the limits?
In the mean time, I had to work out a few details on the software and hardware fronts. My first problem was one of hardware: I stupidly assumed that a USB cable from Kensington that I use for a calculator keypad device was, as the device legends promised, a proper USB cable. It is not. It took me quite some time to try to diagnose why the PCM-D1 would say "PC connect" in its display window and then promptly shut itself down. When my internet search failed to find any mention of such problems, I did what any techno-parent would do: I swapped cables, and that fixed the problem.
My next challenge was to find some software that would slow down the audio so that the 48 kHz frequency would be something we could hear, like, say, 4 kHz. I found two ways to do this: Audacity, an open source package with a nice GUI, and R, a highly advanced mathematic and analytics package which, among its other hundreds of extensions, has a module for playing with sound files. I installed Audacity to my home Fedora computer, and lo, it was very good.
On Thursday night we set out for the street light. My daughter had brought along some rubber bands that she could play by stretching them between her fingers and playing the resulting "string" with her chin. I had my test signal. My next task was to quiet her down enough so that the bats would come. After about 10 minutes, they did come, and I made six attempts to capture them, marking their approaches with my voice.
To be continued...