This object is used to process audio data.
float signal
The filtered signal will be stored in this variable.
void update()
Update function.
float signalMax
The maximum level of the signal is stored in this variable.
int pin
Analog input pin of the channel.
float avgPeak
Average peak signal.
float sample
The raw sample will be processed to this variable.
float silentLimit
Silent limit.
musicChannel(int pin_p, float silentLimit_p)
Constructor.
float offset
Offset of the ADC result.
void(* peakFunc)(void)
Function pointer to peak event function.
float avgSampleFilterBeta
Filter constant for average sample.
float sampleFilterBeta
Filter constant for sample.
void attachPeakFunction(void(*peakFunc_p)(void))
Attach a function to every peak event.
float signalPrev
Previous value of the signal.
float avgSample
Holds the average filter level.
bool peak
Flag, that indicates a peak event.
musicChannel peak(SOUND_PEAK, 20.0, 0.0, 0.5, 0.5)
#define SOUND_PEAK
The peak-detector is connected to pin A2 on the Arduino.