Class that stores state and functions for the microphone on CircuitPlayground boards.
More...
#include <Adafruit_CPlay_Mic.h>
|
int | peak (uint16_t ms) __attribute__((deprecated)) |
| Reads ADC for given interval (in milliseconds, 1-65535). Uses ADC free-run mode w/polling on AVR. Any currently-installed ADC interrupt handler will be temporarily disabled while this runs. More...
|
|
void | capture (int16_t *buf, uint16_t nSamples) |
| capture the passed number of samples and place them in buf. More...
|
|
void | fft (uint16_t *spectrum) |
| AVR ONLY: Performs one cycle of fast Fourier transform (FFT) with audio captured from mic on A4. Output is 32 'bins,' each covering an equal range of frequencies from 0 to 4800 Hz (i.e. 0-150 Hz, 150-300 Hz, 300-450, etc). Needs about 450 bytes free RAM to operate. More...
|
|
float | soundPressureLevel (uint16_t ms) |
| Returns somewhat-calibrated sound pressure level. More...
|
|
Class that stores state and functions for the microphone on CircuitPlayground boards.
◆ peak()
int Adafruit_CPlay_Mic::peak |
( |
uint16_t |
ms | ) |
|
Reads ADC for given interval (in milliseconds, 1-65535). Uses ADC free-run mode w/polling on AVR. Any currently-installed ADC interrupt handler will be temporarily disabled while this runs.
- Parameters
-
ms | the number of milliseconds to sample |
- Returns
- max deviation from DC_OFFSET (e.g. 0-341)
- Deprecated:
- THIS FUNCTION IS DEPRECATED AND WILL BE REMOVED IN A FUTURE RELEASE. please use soundPressureLevel(ms) instead
- Note
- THIS FUNCTION IS DEPRECATED AND WILL BE REMOVED IN A FUTURE RELEASE. please use soundPressureLevel(ms) instead
◆ capture()
void Adafruit_CPlay_Mic::capture |
( |
int16_t * |
buf, |
|
|
uint16_t |
nSamples |
|
) |
| |
capture the passed number of samples and place them in buf.
- Parameters
-
buf | the buffer to store the samples in |
nSamples | the number of samples to take |
- Note
- ON AVR: Captures ADC audio samples at maximum speed supported by 32u4 (9615 Hz). Ostensibly for FFT code (below), but might have other uses. Uses ADC free-run mode w/polling. Any currently-installed ADC interrupt handler will be temporarily disabled while this runs. No other interrupts are disabled; as long as interrupt handlers are minor (e.g. Timer/Counter 0 handling of millis() and micros()), this isn't likely to lose readings.
◆ fft()
void Adafruit_CPlay_Mic::fft |
( |
uint16_t * |
spectrum | ) |
|
AVR ONLY: Performs one cycle of fast Fourier transform (FFT) with audio captured from mic on A4. Output is 32 'bins,' each covering an equal range of frequencies from 0 to 4800 Hz (i.e. 0-150 Hz, 150-300 Hz, 300-450, etc). Needs about 450 bytes free RAM to operate.
- Parameters
-
spectrum | the buffer to store the results in. Must be 32 bytes in length. |
- Note
- THIS FUNCTION IS DEPRECATED AND WILL BE REMOVED IN A FUTURE RELEASE.
◆ soundPressureLevel()
float Adafruit_CPlay_Mic::soundPressureLevel |
( |
uint16_t |
ms | ) |
|
Returns somewhat-calibrated sound pressure level.
- Parameters
-
ms | Milliseconds to continuously sample microphone over, 10ms is a good start. |
- Returns
- Floating point Sound Pressure Level, tends to range from 40-120 db SPL
The documentation for this class was generated from the following files: