|
FastLED 3.9.15
|
Namespaces | |
| namespace | anonymous_namespace{audio.cpp.hpp} |
| namespace | detector |
| namespace | fft |
| namespace | TeensyI2S |
Classes | |
| class | AudioManager |
| class | AutoGain |
| AutoGain implements adaptive gain control using a PI (proportional-integral) controller with slow peak envelope tracking, inspired by WLED Sound Reactive. More... | |
| struct | AutoGainConfig |
| Configuration for automatic gain control. More... | |
| struct | BandEnergy |
| struct | BeatDetectors |
| class | Config |
| struct | ConfigI2S |
| struct | ConfigPdm |
| class | Context |
| struct | Data |
| class | Detector |
| class | FrequencyBinMapper |
| FrequencyBinMapper maps FFT output bins to perceptually-spaced frequency channels. More... | |
| struct | FrequencyBinMapperConfig |
| Configuration for frequency bin mapping. More... | |
| class | IInput |
| class | ISynthEngine |
| Interface for synth engine that holds BLEP/BLAMP tables. More... | |
| class | ISynthOscillator |
| Interface class for synth oscillator. More... | |
| struct | MicResponseCurve |
| class | NoiseFloorTracker |
| NoiseFloorTracker maintains an adaptive estimate of the background noise floor for audio signals, with hysteresis to prevent "noise chasing" where the floor continuously adjusts to the signal level. More... | |
| struct | NoiseFloorTrackerConfig |
| Configuration for noise floor tracking. More... | |
| class | PerceptualWeighting |
| class | Processor |
| class | Reactive |
| struct | ReactiveConfig |
| class | Sample |
| class | SampleImpl |
| class | SignalConditioner |
| SignalConditioner performs low-level audio preprocessing to clean raw PCM samples before FFT analysis or beat detection. More... | |
| struct | SignalConditionerConfig |
| Configuration for signal conditioning pipeline. More... | |
| class | SilenceEnvelope |
| class | SoundLevelMeter |
| class | SpectralEqualizer |
| SpectralEqualizer applies frequency-dependent gain correction to address mid-frequency dominance and provide perceptual weighting of audio spectra. More... | |
| struct | SpectralEqualizerConfig |
| Configuration for spectral equalizer. More... | |
| class | SpectralFluxDetector |
| class | SynthEngineImpl |
| class | SynthOscillatorImpl |
| struct | SynthParams |
| Waveform parameters for custom waveforms. More... | |
Enumerations | |
| enum class | AGCPreset { AGCPreset_Normal , AGCPreset_Vivid , AGCPreset_Lazy , AGCPreset_Custom } |
| AGC preset selection — derived from WLED Sound Reactive's proven approach. More... | |
| enum class | AudioChannel { Left = 0 , Right = 1 , Both = 2 } |
| enum class | EqualizationCurve { Flat , AWeighting , Custom } |
| Equalization curve type. More... | |
| enum class | FrequencyBinMode { Bins16 = 16 , Bins32 = 32 } |
| Frequency bin mode - controls number of output bins. More... | |
| enum class | I2SCommFormat { Philips = 0X01 , MSB = 0X02 , PCMShort = 0x04 , PCMLong = 0x0C , Max = 0x0F } |
| enum class | MicProfile : u8 { None , INMP441 , ICS43434 , SPM1423 , GenericMEMS , LineIn } |
| Microphone frequency response correction profile. More... | |
| enum class | SynthShape { Sawtooth , Square , Triangle , AlternatingSaw , Custom } |
| Predefined waveform shapes for synth oscillator. More... | |
Functions | |
| static float | clamp01 (float v) |
| static float | clampNeg1To1 (float v) |
| float | computeAudioDt (fl::size pcmSize, int sampleRate) FL_NOEXCEPT |
| Compute the time delta (in seconds) for an audio buffer. | |
| float | computePinkNoiseGain (float freq_hz, float f_ref) |
| Compute pink noise compensation gain for a single frequency. | |
| void | computePinkNoiseGains (const float *binCenters, int numBins, float *out) |
| Compute pink noise compensation gains for all bins. | |
| void | downsampleMicResponse (const MicResponseCurve &curve, const float *binCenters, int numBins, float *out) |
| Downsample a high-resolution mic response curve to N output bins. | |
| FASTLED_SHARED_PTR (ISynthEngine) | |
| FASTLED_SHARED_PTR (ISynthOscillator) | |
| FASTLED_SHARED_PTR (SampleImpl) | |
| float | fl_progmem_read_float (const float *addr) |
| Read a float from PROGMEM. | |
| MicResponseCurve | getMicResponseCurve (MicProfile profile) |
| Get the high-resolution response curve for a given mic profile. | |
| float | interpolateMicResponse (const MicResponseCurve &curve, float freq_hz) |
| Interpolate mic response at an arbitrary frequency (Hz). | |
| FL_LINK_WEAK fl::shared_ptr< IInput > | platform_create_audio_input (const Config &config, fl::string *error_message) |
Variables | |
| static const float | kMicResponse_GenericMEMS [kMicResponsePoints] |
| static const float | kMicResponse_ICS43434 [kMicResponsePoints] |
| static const float | kMicResponse_INMP441 [kMicResponsePoints] |
| static const float | kMicResponse_LineIn [kMicResponsePoints] |
| static const float | kMicResponse_SPM1423 [kMicResponsePoints] |
| static const float | kMicResponseFreqs [kMicResponsePoints] |
| static constexpr int | kMicResponsePoints = 61 |
Controls how quickly the peak tracker forgets old peaks. Longer = more stable.
| struct fl::audio::Data |
| struct fl::audio::FrequencyBinMapperConfig |
| Class Members | ||
|---|---|---|
| u32 | fftBinCount = 256 | Number of FFT bins available from FFT output For 512-sample FFT at 22050 Hz: 256 bins (512/2) |
| float | maxFrequency = 16000.0f | Maximum frequency (Hz) - default 16000 Hz (treble) |
| float | minFrequency = 20.0f | Minimum frequency (Hz) - default 20 Hz (bass) |
| FrequencyBinMode | mode = FrequencyBinMode::Bins16 | Number of output frequency bins (16 or 32) |
| u32 | sampleRate = 22050 | Sample rate (Hz) - must match FFT sample rate. |
| bool | useLogSpacing = true | Use logarithmic spacing (recommended for audio) Logarithmic spacing provides better bass/mid/treble separation. |
| struct fl::audio::MicResponseCurve |
| struct fl::audio::NoiseFloorTrackerConfig |
| struct fl::audio::ReactiveConfig |
| Class Members | ||
|---|---|---|
| u8 | attack = 50 | |
| float | bassThreshold = 0.15f | |
| u8 | decay = 200 | |
| bool | enableLogBinSpacing = true | |
| bool | enableMultiBand = true | |
| bool | enableMultiBandBeats = false | |
| bool | enableMusicalBeatDetection = false | |
| bool | enableNoiseFloorTracking = true | |
| bool | enableSignalConditioning = true | |
| bool | enableSpectralEqualizer = false | |
| bool | enableSpectralFlux = true | |
| u8 | gain = 128 | |
| float | midThreshold = 0.12f | |
| float | musicalBeatConfidence = 0.5f | |
| float | musicalBeatMaxBPM = 180.0f | |
| float | musicalBeatMinBPM = 60.0f | |
| bool | noiseGate = true | |
| u16 | sampleRate = 22050 | |
| u8 | scalingMode = 3 | |
| u8 | sensitivity = 128 | |
| float | spectralFluxThreshold = 0.1f | |
| float | trebleThreshold = 0.08f | |
| struct fl::audio::SignalConditionerConfig |
| struct fl::audio::SpectralEqualizerConfig |
Collaboration diagram for fl::audio::SpectralEqualizerConfig:| Class Members | ||
|---|---|---|
| bool | applyMakeupGain = false | Apply makeup gain to compensate for overall level changes If true, automatically adjusts overall gain to maintain average level. |
| float | compressionRatio = 2.0f | Compression ratio (1.0 = no compression, higher = more compression) 2.0 = 2:1 ratio, 4.0 = 4:1 ratio, etc. |
| float | compressionThreshold = 0.7f | Compression threshold (0.0-1.0) Signals above this level are compressed. |
| EqualizationCurve | curve = EqualizationCurve::Flat | Equalization curve type. |
| vector< float > | customGains |
Custom per-band gain multipliers (only used if curve = Custom) Size must match numBands. Default: all 1.0 (no eq) |
| bool | enableCompression = false | Enable dynamic range compression per band Compresses loud signals to reduce dynamic range. |
| float | makeupGainTarget = 0.5f | Makeup gain target level (0.0-1.0) The equalizer will scale output to maintain this average level. |
| size | numBands = 16 | Number of frequency bands (must match FrequencyBinMapper output) |
|
strong |
AGC preset selection — derived from WLED Sound Reactive's proven approach.
Normal/Vivid/Lazy control how quickly the AGC adapts to source-level changes.
Definition at line 13 of file auto_gain.h.
|
strong |
|
strong |
Equalization curve type.
| Enumerator | |
|---|---|
| Flat | |
| AWeighting | |
| Custom | |
Definition at line 12 of file spectral_equalizer.h.
|
strong |
Frequency bin mode - controls number of output bins.
| Enumerator | |
|---|---|
| Bins16 | |
| Bins32 | |
Definition at line 12 of file frequency_bin_mapper.h.
|
strong |
|
strong |
Microphone frequency response correction profile.
Each profile provides 16-channel gain corrections to flatten the frequency response of a specific microphone. Derived from manufacturer datasheet data.
Set on Processor via setMicProfile() — the correction is applied inside EqualizerDetector before per-bin normalization.
Definition at line 14 of file mic_profiles.h.
|
strong |
|
static |
Definition at line 457 of file audio_processor.cpp.hpp.
References clamp01().
Referenced by clamp01(), fl::audio::Processor::getBackbeatConfidence(), fl::audio::Processor::getBackbeatStrength(), fl::audio::Processor::getBassLevel(), fl::audio::Processor::getBeatConfidence(), fl::audio::Processor::getBuildupIntensity(), fl::audio::Processor::getBuildupProgress(), fl::audio::Processor::getChordConfidence(), fl::audio::Processor::getDownbeatConfidence(), fl::audio::Processor::getDropImpact(), fl::audio::Processor::getEnergy(), fl::audio::Processor::getEqBass(), fl::audio::Processor::getEqBin(), fl::audio::Processor::getEqDominantMagnitude(), fl::audio::Processor::getEqMid(), fl::audio::Processor::getEqTreble(), fl::audio::Processor::getEqVolume(), fl::audio::Processor::getEqVolumeNormFactor(), fl::audio::Processor::getEqZcf(), fl::audio::Processor::getKeyConfidence(), fl::audio::Processor::getMeasurePhase(), fl::audio::Processor::getMidLevel(), fl::audio::Processor::getMoodArousal(), fl::audio::Processor::getPeakLevel(), fl::audio::Processor::getPitchConfidence(), fl::audio::Processor::getTempoConfidence(), fl::audio::Processor::getTransientStrength(), fl::audio::Processor::getTrebleLevel(), and fl::audio::Processor::getVocalConfidence().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 464 of file audio_processor.cpp.hpp.
References clampNeg1To1().
Referenced by clampNeg1To1(), fl::audio::Processor::getDynamicTrend(), and fl::audio::Processor::getMoodValence().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Compute the time delta (in seconds) for an audio buffer.
Each buffer of pcmSize samples at sampleRate Hz represents exactly pcmSize/sampleRate seconds of audio, regardless of when the CPU reads it.
Definition at line 101 of file audio_context.h.
References FL_NOEXCEPT.
Referenced by fl::audio::Reactive::processSample(), fl::audio::detector::EnergyAnalyzer::update(), fl::audio::detector::EqualizerDetector::update(), fl::audio::detector::FrequencyBands::update(), fl::audio::detector::Percussion::update(), fl::audio::detector::Pitch::update(), fl::audio::detector::Vibe::update(), and fl::audio::detector::Vocal::update().
Here is the caller graph for this function:
|
inline |
Compute pink noise compensation gain for a single frequency.
Pink noise has 1/f spectral density → equal power per octave. To flatten it: multiply by sqrt(f / f_ref).
| freq_hz | Bin center frequency in Hz |
| f_ref | Reference frequency (typically geometric mean of all bins) |
Definition at line 284 of file mic_response_data.h.
References fl::sqrtf().
Referenced by computePinkNoiseGains().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Compute pink noise compensation gains for all bins.
Normalizes so the geometric mean of all gains ≈ 1.0.
| binCenters | Array of bin center frequencies (Hz) |
| numBins | Number of bins |
| out | Output array of gains (length numBins) |
Definition at line 294 of file mic_response_data.h.
References computePinkNoiseGain(), fl::expf(), and fl::logf().
Referenced by fl::audio::Reactive::begin(), and fl::audio::detector::EqualizerDetector::recomputePinkNoiseGains().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Downsample a high-resolution mic response curve to N output bins.
| curve | The source mic response curve |
| binCenters | Array of bin center frequencies (Hz), length numBins |
| numBins | Number of output bins |
| out | Output array of gains, length numBins |
Definition at line 266 of file mic_response_data.h.
References interpolateMicResponse().
Referenced by fl::audio::detector::EqualizerDetector::setMicProfile().
Here is the call graph for this function:
Here is the caller graph for this function:| fl::audio::FASTLED_SHARED_PTR | ( | ISynthEngine | ) |
| fl::audio::FASTLED_SHARED_PTR | ( | ISynthOscillator | ) |
| fl::audio::FASTLED_SHARED_PTR | ( | SampleImpl | ) |
|
inline |
Read a float from PROGMEM.
On AVR this reads flash via pgm_read_dword; on other platforms it's a plain memory read via memcpy (no aliasing issues).
Definition at line 25 of file mic_response_data.h.
References FL_BUILTIN_MEMCPY, and FL_PGM_READ_DWORD_ALIGNED.
Referenced by interpolateMicResponse().
Here is the caller graph for this function:
|
inline |
Get the high-resolution response curve for a given mic profile.
Returns a curve with count=0 for MicProfile::None.
Definition at line 197 of file mic_response_data.h.
References GenericMEMS, ICS43434, INMP441, kMicResponse_GenericMEMS, kMicResponse_ICS43434, kMicResponse_INMP441, kMicResponse_LineIn, kMicResponse_SPM1423, kMicResponseFreqs, kMicResponsePoints, LineIn, None, and SPM1423.
Referenced by fl::audio::detector::EqualizerDetector::setMicProfile().
Here is the caller graph for this function:
|
inline |
Interpolate mic response at an arbitrary frequency (Hz).
Uses log-frequency linear interpolation with binary search. Clamps to endpoint values outside the data range.
Definition at line 229 of file mic_response_data.h.
References fl::audio::MicResponseCurve::count, fl_progmem_read_float(), fl::audio::MicResponseCurve::freqs, fl::audio::MicResponseCurve::gains, and fl::logf().
Referenced by downsampleMicResponse().
Here is the call graph for this function:
Here is the caller graph for this function:| fl::shared_ptr< IInput > fl::audio::platform_create_audio_input | ( | const Config & | config, |
| fl::string * | error_message ) |
Definition at line 99 of file audio_input.cpp.hpp.
References fl::make_shared().
Referenced by fl::audio::IInput::create().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 145 of file mic_response_data.h.
Referenced by getMicResponseCurve().
|
static |
Definition at line 91 of file mic_response_data.h.
Referenced by getMicResponseCurve().
|
static |
Definition at line 63 of file mic_response_data.h.
Referenced by getMicResponseCurve().
|
static |
Definition at line 171 of file mic_response_data.h.
Referenced by getMicResponseCurve().
|
static |
Definition at line 119 of file mic_response_data.h.
Referenced by getMicResponseCurve().
|
static |
Definition at line 41 of file mic_response_data.h.
Referenced by getMicResponseCurve().
|
staticconstexpr |
Definition at line 36 of file mic_response_data.h.
Referenced by getMicResponseCurve().