5#ifndef PHYSICAL_SOUND_H
6#define PHYSICAL_SOUND_H
45 std::array<int16_t, SAMPLE_SIZE>
data;
74 std::array<float, numberOfFFtChanels>
fft_log;
Wrapper of the ArduinoFFT library.
SoundStruct & get_sound_characteristics()
Compute and process sound data.
Definition: sound.cpp:168
void disable()
Disable the microphone data analysis, if its running.
Definition: sound.cpp:64
constexpr float highLevelDb
Microphone is not good enough at after this.
Definition: sound.h:21
bool enable()
Start the microphone data analysis, if not already started.
Definition: sound.cpp:53
constexpr int16_t gainedSignalTarget
Desired output of the auto gain (0-INT16_MAX)
Definition: sound.h:26
constexpr float silenceLevelDb
Decibel level for a silent room.
Definition: sound.h:19
constexpr float desiredoutput
Desired output of the auto gain (0-1)
Definition: sound.h:24
void disable_after_non_use()
disable microphone if last used a target time ago
Definition: sound.cpp:75
Program scope.
Definition: control_fixed_modes.hpp:12
Interface for the platform specific microphone.
Handle the analysis of a sound sample. This structure handled the FastFourrier analysis of a sound sa...
Definition: sound.h:33
std::array< float, SAMPLE_SIZE/2 > fft_raw
Results of the FFT process, in raw Hertz bins.
Definition: sound.h:72
std::array< int16_t, SAMPLE_SIZE > data
raw audio data
Definition: sound.h:45
bool isFFTValid
validity flag for the FFT results
Definition: sound.h:61
std::array< float, numberOfFFtChanels > fft_log_end_frequencies
Results of the FFT process, in maximum frequency for every bin.
Definition: sound.h:76
static constexpr float get_fft_resolution_Hz()
Return the FFT resolution of a single FFT bin in Hertz.
Definition: sound.h:67
float maxAmplitudeFrequency
Maximum detected amplitude frequency of this sample, in Hertz.
Definition: sound.h:54
static constexpr auto SAMPLE_SIZE
Size fo the audio sample.
Definition: sound.h:42
float maxAmplitude
Maximum detected amplitude of this sample.
Definition: sound.h:52
bool isDataValid
flag that indicate sound data validity
Definition: sound.h:39
std::array< int16_t, SAMPLE_SIZE > rectifiedData
audio data with auto gain enabled
Definition: sound.h:47
static constexpr uint8_t numberOfFFtChanels
Define the number of FFt bins to use. You should set this number close to the lamp max X coordinates.
Definition: sound.h:64
std::array< float, numberOfFFtChanels > fft_log
Results of the FFT process, in scaled logarithmic bins. This is closer to the sound sensitivity of th...
Definition: sound.h:74
float sound_level_Db
Sound level of this sample, in Decibels A.
Definition: sound.h:50