-
Notifications
You must be signed in to change notification settings - Fork 19
Microphone Settings
The microphone of the AudioMoth is powered up and enabled using the function below.
void AudioMoth_enableMicrophone(uint32_t gain, uint32_t clockDivider, uint32_t acquisitionCycles, uint32_t oversampleRate);
Understanding how to set these arguments requires some knowledge of the hardware configuration of the AudioMoth device.
Gain: This is the most straightforward. The analogue microphone signal is passed through a 2-stage amplifier whose gain can be controlled via software. The gain setting should be between 0 and 4 inclusive, with the default value being 2.
Clock Divider: The ADC clock is derived from the main system clock (either the external 48MHz crystal oscillator or any of the internal RC oscillator bands) divided by a constant factor (from 1 to 128). The ADC clock determines the rate at which ADC conversion takes place and the maximum ADC clock speed is 14MHz.
Acquisition Cycles: Before the ADC conversion takes place, the ADC must capture the input voltage on the ADC. The duration of this capture is determined by this argument. The acquisition time can take values of 1, 2, 4, 8 and 16. The minimum acquisition time of 1 cycle is generally too short to capture good quality audio. In the default AudioMoth application we use an acquisition time of 16 cycles.
Oversample Rate: A single ADC conversion results in a 12 bit two's complement sample. It is possible to oversample in hardware from 1 to 128 times (restricted to 2^n values) with each multiple adding another bit to the ADC precision up to a maximum of 16 bits. In our default AudioMoth application the oversampling is done in software rather than hardware.
The arguments above give rise to a maximum possible sample rate:
Maximum Sample Rate = (2 + OverSample Rate * (Acquisition Cycles + 12)) / (Clock Frequency / Clock Divider)
The application should ensure that the sample rate requested in the AudioMoth_startMicrophoneSamples
call is less than this value.
The default AudioMoth application uses the following settings:
Clock Divider = 4
Acquisition Cycles = 16
Oversample Rate = 1
For sample rates of 48kHz, 96kHz, 192kHz and 384kHz, a baseline sampling rate of 384kHz is used, with software oversampling used to generate the slower rates. Similarly, sample rates of 8kHz, 16kHz and 32kHz use a baseline sample rate of 256kHz.