ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
MicrophoneSimple Class Reference

A simple class for processing microphone signals. More...

#include <MicrophoneSimple_MAX9814.h>

Collaboration diagram for MicrophoneSimple:

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ MicrophoneSimple() [1/3]

Constructs a default MicrophoneSimple instance.

Definition at line 3 of file MicrophoneSimple_MAX9814.cpp.

References startMillis.

◆ MicrophoneSimple() [2/3]

MicrophoneSimple ( uint8_t  pin,
float  gain = 1.0f,
float  clipping = 1.0f 
)

Constructs a MicrophoneSimple instance with specified parameters.

Parameters
pinThe pin number for the microphone input.
gainThe gain to apply to the microphone signal (default is 1.0).
clippingThe 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() [3/3]

Constructs a MicrophoneSimple instance with a specified pin.

Parameters
pinThe pin number for the microphone input.

Definition at line 3 of file MicrophoneSimple_SPW2430.cpp.

References pin, and startMillis.

Member Function Documentation

◆ GetCurrentValue()

float GetCurrentValue ( )

Retrieves the current processed microphone value.

Returns
The current value of the microphone signal.

Definition at line 19 of file MicrophoneSimple_MAX9814.cpp.

References currentValue.

◆ Update() [1/3]

float Update ( )

◆ Update() [2/3]

float Update ( )

Updates the microphone reading and processes the signal.

Returns
The processed microphone value.

◆ Update() [3/3]

float Update ( float  read)

Updates the microphone reading with an externally provided value.

Parameters
readThe external reading to process.
Returns
The processed microphone value.

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.

Member Data Documentation

◆ clipping

float clipping = 1.0f
private

Clipping level for the microphone signal.

Definition at line 37 of file MicrophoneSimple_MAX9814.h.

Referenced by Update(), and Update().

◆ currentValue

float currentValue = 0.0f
private

Current processed microphone value.

Definition at line 40 of file MicrophoneSimple_MAX9814.h.

Referenced by GetCurrentValue(), Update(), and Update().

◆ gain

float gain = 1.0f
private

Gain applied to the microphone signal.

Definition at line 36 of file MicrophoneSimple_MAX9814.h.

Referenced by MicrophoneSimple(), and Update().

◆ minF

MinFilter< 100 > minF = MinFilter<100>()
private

Minimum filter for peak detection.

Definition at line 33 of file MicrophoneSimple_MAX9814.h.

Referenced by Update(), and Update().

◆ mv [1/2]

Moving average filter for smoothing input.

Definition at line 32 of file MicrophoneSimple_MAX9814.h.

Referenced by Update(), and Update().

◆ mv [2/2]

RunningAverageFilter<40> mv = RunningAverageFilter<40>(0.075f)
private

Moving average filter for smoothing input.

Definition at line 31 of file MicrophoneSimple_SPW2430.h.

◆ output [1/2]

RunningAverageFilter<5> output = RunningAverageFilter<5>(0.2f)
private

Filter for smoothing the output.

Definition at line 34 of file MicrophoneSimple_MAX9814.h.

Referenced by Update(), and Update().

◆ output [2/2]

RunningAverageFilter<10> output = RunningAverageFilter<10>(0.1f)
private

Filter for smoothing the output.

Definition at line 33 of file MicrophoneSimple_SPW2430.h.

◆ pin

uint8_t pin
private

Pin number for the microphone input.

Definition at line 31 of file MicrophoneSimple_MAX9814.h.

Referenced by MicrophoneSimple(), MicrophoneSimple(), and Update().

◆ previousMillis

long previousMillis = 0
private

Time of the previous reading.

Definition at line 38 of file MicrophoneSimple_MAX9814.h.

Referenced by Update(), and Update().

◆ previousReading

float previousReading = 0.0f
private

Previous reading from the microphone.

Definition at line 35 of file MicrophoneSimple_MAX9814.h.

Referenced by Update(), and Update().

◆ startMillis

long startMillis = 0
private

Start time for processing.

Definition at line 39 of file MicrophoneSimple_MAX9814.h.

Referenced by MicrophoneSimple(), MicrophoneSimple(), and MicrophoneSimple().


The documentation for this class was generated from the following files: