Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Classes | Functions | Variables
lampda::physical::microphone Namespace Reference

Handle the microphone physical interface. More...

Classes

struct  SoundStruct
 Handle the analysis of a sound sample. This structure handled the FastFourrier analysis of a sound sample, sound strenght, sound most active frequency, ... More...
 

Functions

float square (const float v)
 
float decibel_A_scaling (const float frequency)
 Scaling for the DecibelA model.
 
float decibel_B_scaling (const float frequency)
 Scaling for the DecibelB model.
 
float decibel_C_scaling (const float frequency)
 Scaling for the DecibelC model.
 
bool enable ()
 Start the microphone data analysis, if not already started.
 
void disable ()
 Disable the microphone data analysis, if its running.
 
void disable_after_non_use ()
 disable microphone if last used a target time ago
 
SoundStructprocess_sound_data (const platform::microphone::PdmData &data)
 
SoundStructget_sound_characteristics ()
 Compute and process sound data.
 

Variables

utils::fft::FftAnalyzer< platform::microphone::PdmData::SAMPLE_SIZE, SoundStruct::numberOfFFtChanels, float > fftAnalyzer
 
bool isStarted = false
 
uint32_t lastMicFunctionCall = 0
 
float autoGain = 1.0f
 
static constexpr float minAutoGain = 0.0001f
 
static constexpr float maxAutoGain = 30.0f
 
static constexpr float distortionFactor = 0.00005f
 
static constexpr float desiredoutputRMS = desiredoutput * desiredoutput
 
SoundStruct soundStruct
 
constexpr float silenceLevelDb = 30.0
 Decibel level for a silent room.
 
constexpr float highLevelDb = 80.0
 Microphone is not good enough at after this.
 
constexpr float desiredoutput = 0.5f
 Desired output of the auto gain (0-1)
 
constexpr int16_t gainedSignalTarget = INT16_MAX * desiredoutput
 Desired output of the auto gain (0-INT16_MAX)
 

Detailed Description

Handle the microphone physical interface.

Function Documentation

◆ enable()

bool lampda::physical::microphone::enable ( )

Start the microphone data analysis, if not already started.

Returns
True if the process started

◆ get_sound_characteristics()

SoundStruct & lampda::physical::microphone::get_sound_characteristics ( )

Compute and process sound data.

Returns
the last sound data