Audio Injector Ultra 2

(Last updated October 2019)

As the Cirrus Logic Audio Card is no longer available, options for recording ultrasound with the Raspberry Pi are unfortunately limited. There is a relatively new sound card available which is specifically designed to record ultrasound with a maximum sample rate of 192kHz: Audio Injector Ultra 2 from Flatmax Studios.

Instructions for setting up this card for use with a Raspberry Pi can be found here.

The card defaults to line input, so a simple bash script is needed to set up recording from the on-board microphones (Knowles SPU0410LR5H Ultrasonic MEMS microphones).

amixer cset name='ADC Mux' 0
amixer cset name='PGA Volume' 40
amixer cset name='ADC HPF Switch' 0
amixer cset name='ADC Soft Ramp Switch' 0
amixer cset name='Loopback Switch' 1

This can be saved as a bash script (e.g. record_from_mic.sh) and set to run at startup by adding the following line to /etc/rc.local just before exit zero (instructions on how to do this are here).

sh /home/pi/record_from_mic.sh &

Here’s the Ultra 2 Sound Card attached to a Raspberry Pi 3A+.  I’m only using the base card that comes with the AudioInjector sound card package, with a separate MEMS ultrasound microphone attached:

SoX can be used for sound-activated recording:

rec -G -c1 -r 192000 -b 16 -V2 /home/pi/temp.wav sinc 10k silence 1 0.01 1% -1 1.0 1% trim 2.0 3.0

These are spectrograms of bat calls from recordings made with the Ultra 2 sound card:

Nathusius’ Pipistrelle (2019-04-17 20:53:50)

Common Pipistrelle + Social Call and Soprano Pipistrelle (2019-04-18 22:36:09)

Soprano Pipistrelle (note feeding buzz) (2019-04-18 20:46:54)

Serotine (2019-04-18 21:42:12)

Noctule (2019-04-18 22:12:21)

Natterer’s Bat?

Soprano Pipistrelle Social Calls, possibly a juvenile (2019-06-21 23:34:03)

Serotine (lower) and Soprano Pipistrelle (upper) Calls (2019-06-29 00:43:17)

Noctule Social Calls (2019-07-1021:53:00)

Greater Horseshoe Bat (2019-09-27 01:42:13)

Social Calls – possibly Daubenton’s (2019-10-06 06:22:31)

 

Automatic Classification of Bat Calls

Bat calls that have been recorded can be automatically analysed using Chris Scott’s “BatClassify“. The version in the link has been compiled for Windows, but it is possible to re-compile the source code for running on a Raspberry Pi (more information to follow).

Bat sounds can be classified in almost real-time (on a Pi3A+, a 3 second file takes about 40 seconds to analyse), and the result displayed on a small OLED screen.