NanoLux (Device) 3.0
Codebase for the open-source AudioLux device.
Loading...
Searching...
No Matches
AudioAnalysis Class Reference

Handles audio signal processing and feature extraction. More...

#include <audio_analysis.h>

Public Member Functions

 AudioAnalysis ()
 Constructor for the AudioAnalysis class. Initializes AudioPrism modules and other variables.
 
void processAudioFrame (int)
 Processes an audio frame, including sampling, FFT computation, and noise gating.
 
float * getVReal ()
 Gets the raw real part of the FFT result.
 
float * getVReal (float)
 Gets a smoothed version of the real part of the FFT result.
 
float getPeak ()
 Gets the peak frequency detected in the audio.
 
float getVolume ()
 Gets the volume level of the audio.
 
int getMaxDelta ()
 Gets the maximum delta value between FFT bins.
 
float * getDeltas ()
 Gets the delta values between FFT bins.
 
int * getSalientFreqs ()
 Gets the salient frequencies detected in the audio.
 
float getCentroid ()
 Gets the centroid frequency of the audio spectrum.
 
bool getPercussionPresence ()
 Checks for the presence of percussion in the audio.
 
float getNoisiness ()
 Gets the noisiness level of the audio.
 
float * getFiveBandSplit (int len)
 Calculates and returns a five-band split of the audio spectrum.
 
void resetCache ()
 Clears all flags that indicate updated data for getters.
 

Detailed Description

Handles audio signal processing and feature extraction.

The AudioAnalysis class is responsible for processing real-time audio input, performing Fast Fourier Transform (FFT), and extracting various audio features, such as volume, peak frequency, delta amplitudes, salient frequencies, centroid, percussion presence, and noisiness. It also provides functionality for noise gating and real-time analysis, smoothing, and updating the extracted features for visualization or other uses.

The class interacts with the AudioPrism modules for different types of audio analysis (e.g., volume, peaks, deltas) and stores the results in various buffers. It supports a highly optimized flow for feature extraction while maintaining efficiency for use in embedded systems like the ESP32.

Member Function Documentation

◆ getCentroid()

float AudioAnalysis::getCentroid ( )

Gets the centroid frequency of the audio spectrum.

Returns
Centroid frequency value.

◆ getDeltas()

float * AudioAnalysis::getDeltas ( )

Gets the delta values between FFT bins.

Returns
Pointer to the array of delta values.

◆ getFiveBandSplit()

float * AudioAnalysis::getFiveBandSplit ( int len)

Calculates and returns a five-band split of the audio spectrum.

Parameters
lenLength of the audio data.
Returns
Pointer to the array containing five-band split values.

◆ getMaxDelta()

int AudioAnalysis::getMaxDelta ( )

Gets the maximum delta value between FFT bins.

Returns
Maximum delta value.

◆ getNoisiness()

float AudioAnalysis::getNoisiness ( )

Gets the noisiness level of the audio.

Returns
Noisiness level.

◆ getPeak()

float AudioAnalysis::getPeak ( )

Gets the peak frequency detected in the audio.

Returns
Peak frequency value in Hertz.

◆ getPercussionPresence()

bool AudioAnalysis::getPercussionPresence ( )

Checks for the presence of percussion in the audio.

Returns
True if percussion is detected, false otherwise.

◆ getSalientFreqs()

int * AudioAnalysis::getSalientFreqs ( )

Gets the salient frequencies detected in the audio.

Returns
Pointer to the array of salient frequencies.

◆ getVolume()

float AudioAnalysis::getVolume ( )

Gets the volume level of the audio.

Returns
Volume level.

◆ getVReal() [1/2]

float * AudioAnalysis::getVReal ( )

Gets the raw real part of the FFT result.

Returns
Pointer to the array of real FFT values.

◆ getVReal() [2/2]

float * AudioAnalysis::getVReal ( float alpha)

Gets a smoothed version of the real part of the FFT result.

Parameters
alphaSmoothing coefficient.
Returns
Pointer to the array of smoothed real FFT values.

◆ processAudioFrame()

void AudioAnalysis::processAudioFrame ( int noiseThreshhold)

Processes an audio frame, including sampling, FFT computation, and noise gating.

Parameters
noiseThreshholdThreshold used for noise gating.

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