Audio triggered recording
The software implements different criteria to decide when and how long to record the audio from the microphones. For audio triggered recordings, it implements the following decisions in the order given below:
1.) Does the real time clock RTC from the Teensy indicate that the time is inside the given acquisition windows?
- T1,T2; // first aquisition window (from T1 to T2) in Hours of day
- T3,T4; // second aquisition window (from T1 to T2) in Hours of day
- If yes, goto 2.), if no, go to sleep and wake up in the next acquisition window
2.) The recorder listens to the sound from the microphones and calculates the SNR (signal-noise-ratio). If the SNR exceeds the preset threshold (SNIP_parameter thresh), goto 3.), else go back to 1.)
3.) Open a file, write the header to the SD card and start recording the audio to the SD card.
4.) Recording is continued for the preset minimum extraction window (SNIP_parameter extr)
5.) Has the preset acquisition file size ad (acquisition file size in seconds) been reached? If yes, close the file and goto 1.), else goto 6.)
6.) If the SNR is higher than the threshold, goto 4.), else goto 7.)
7.) Close the file on the SD card
8.) Goto 1.)
fig 1 - Audio triggered recording parameters. BLUE - RECORDING TIME.
Figure 1 shows a typical audio triggered recording with three audio trigger events occuring, eg. calls from a frog.
- even when not recording, the microSoundRecorder buffers the sound from the microphone inputs in a variable all the time and waits for an audio signal that exceeds the preset threshold ("trigger event"). The buffered time is given by MDEL (no. of audio blocks to buffer, see below)
- The first trigger starts the recording and a new file is opened on the SD card
- The audio in the buffer (from before the event) is written to the SD card file
- The current audio is written to the SD card. The minimum time for this is extr
- if another trigger event appears, the minimum extraction time extr starts again
- the recording is stopped and the files is closed on the SD card, if the minimum extraction time extr has expired (without a new trigger event) OR the maximum file size ad has been reached
- During the inhib time span, no trigger is accepted for the audio detector.
The MDEL parameter is the number of audio blocks (audio 128 samples each) which are buffered before the recording begins (pre-trigger period). This achieves that the recording (once triggered by an audio signal) contains the beginning of an audio signal. Multiply MDEL with (128 / sample rate) to obtain the pre-trigger period in seconds. With 48ksps sample rate and MDEL = 20 blocks, the pre-trigger period would be 53.3msec, i.e. the recording will contain all the audio from 53.3msec BEFORE the begin of the audio trigger signal.