![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
A simple class for processing microphone signals. More...
#include <MicrophoneSimple_MAX9814.h>
Public Member Functions | |
MicrophoneSimple () | |
Constructs a default MicrophoneSimple instance. | |
MicrophoneSimple (uint8_t pin, float gain=1.0f, float clipping=1.0f) | |
Constructs a MicrophoneSimple instance with specified parameters. | |
float | GetCurrentValue () |
Retrieves the current processed microphone value. | |
float | Update () |
Updates the microphone reading and processes the signal. | |
float | Update (float read) |
Updates the microphone reading with an externally provided value. | |
MicrophoneSimple (uint8_t pin) | |
Constructs a MicrophoneSimple instance with a specified pin. | |
float | Update () |
Updates the microphone reading and processes the signal. | |
Private Attributes | |
uint8_t | pin |
Pin number for the microphone input. | |
RunningAverageFilter< 5 > | mv = RunningAverageFilter<5>(0.2f) |
Moving average filter for smoothing input. | |
MinFilter< 100 > | minF = MinFilter<100>() |
Minimum filter for peak detection. | |
RunningAverageFilter< 5 > | output = RunningAverageFilter<5>(0.2f) |
Filter for smoothing the output. | |
float | previousReading = 0.0f |
Previous reading from the microphone. | |
float | gain = 1.0f |
Gain applied to the microphone signal. | |
float | clipping = 1.0f |
Clipping level for the microphone signal. | |
long | previousMillis = 0 |
Time of the previous reading. | |
long | startMillis = 0 |
Start time for processing. | |
float | currentValue = 0.0f |
Current processed microphone value. | |
RunningAverageFilter< 40 > | mv = RunningAverageFilter<40>(0.075f) |
Moving average filter for smoothing input. | |
RunningAverageFilter< 10 > | output = RunningAverageFilter<10>(0.1f) |
Filter for smoothing the output. | |
A simple class for processing microphone signals.
The MicrophoneSimple class handles analog input from a microphone, applies gain and clipping, and uses filters to smooth the output.
The MicrophoneSimple class handles analog input from a microphone, applies smoothing filters, and provides processed signal values.
Definition at line 29 of file MicrophoneSimple_MAX9814.h.
MicrophoneSimple | ( | ) |
Constructs a default MicrophoneSimple instance.
Definition at line 3 of file MicrophoneSimple_MAX9814.cpp.
References startMillis.
MicrophoneSimple | ( | uint8_t | pin, |
float | gain = 1.0f , |
||
float | clipping = 1.0f |
||
) |
Constructs a MicrophoneSimple instance with specified parameters.
pin | The pin number for the microphone input. |
gain | The gain to apply to the microphone signal (default is 1.0). |
clipping | The clipping level for the microphone signal (default is 1.0). |
Definition at line 7 of file MicrophoneSimple_MAX9814.cpp.
References gain, pin, and startMillis.
MicrophoneSimple | ( | uint8_t | pin | ) |
Constructs a MicrophoneSimple instance with a specified pin.
pin | The pin number for the microphone input. |
Definition at line 3 of file MicrophoneSimple_SPW2430.cpp.
References pin, and startMillis.
float GetCurrentValue | ( | ) |
Retrieves the current processed microphone value.
Definition at line 19 of file MicrophoneSimple_MAX9814.cpp.
References currentValue.
float Update | ( | ) |
Updates the microphone reading and processes the signal.
Definition at line 23 of file MicrophoneSimple_MAX9814.cpp.
References clipping, Mathematics::Constrain(), currentValue, MinFilter< memory >::Filter(), RunningAverageFilter< memory >::Filter(), gain, minF, mv, output, pin, previousMillis, and previousReading.
Referenced by ProtogenArtleckAnimation::Update(), WaffleDaProtoAnimation::Update(), and NukudeFaceAnimation::Update().
float Update | ( | ) |
Updates the microphone reading and processes the signal.
Updates the microphone reading with an externally provided value.
read | The external reading to process. |
Definition at line 41 of file MicrophoneSimple_MAX9814.cpp.
References clipping, Mathematics::Constrain(), currentValue, MinFilter< memory >::Filter(), RunningAverageFilter< memory >::Filter(), minF, mv, output, previousMillis, and previousReading.
|
private |
Clipping level for the microphone signal.
Definition at line 37 of file MicrophoneSimple_MAX9814.h.
|
private |
Current processed microphone value.
Definition at line 40 of file MicrophoneSimple_MAX9814.h.
Referenced by GetCurrentValue(), Update(), and Update().
|
private |
Gain applied to the microphone signal.
Definition at line 36 of file MicrophoneSimple_MAX9814.h.
Referenced by MicrophoneSimple(), and Update().
Minimum filter for peak detection.
Definition at line 33 of file MicrophoneSimple_MAX9814.h.
|
private |
Moving average filter for smoothing input.
Definition at line 32 of file MicrophoneSimple_MAX9814.h.
|
private |
Moving average filter for smoothing input.
Definition at line 31 of file MicrophoneSimple_SPW2430.h.
|
private |
Filter for smoothing the output.
Definition at line 34 of file MicrophoneSimple_MAX9814.h.
|
private |
Filter for smoothing the output.
Definition at line 33 of file MicrophoneSimple_SPW2430.h.
|
private |
Pin number for the microphone input.
Definition at line 31 of file MicrophoneSimple_MAX9814.h.
Referenced by MicrophoneSimple(), MicrophoneSimple(), and Update().
|
private |
Time of the previous reading.
Definition at line 38 of file MicrophoneSimple_MAX9814.h.
|
private |
Previous reading from the microphone.
Definition at line 35 of file MicrophoneSimple_MAX9814.h.
|
private |
Start time for processing.
Definition at line 39 of file MicrophoneSimple_MAX9814.h.
Referenced by MicrophoneSimple(), MicrophoneSimple(), and MicrophoneSimple().