NanoLux (Device) 3.0
Codebase for the open-source AudioLux device.
|
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. | |
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.
float AudioAnalysis::getCentroid | ( | ) |
Gets the centroid frequency of the audio spectrum.
float * AudioAnalysis::getDeltas | ( | ) |
Gets the delta values between FFT bins.
float * AudioAnalysis::getFiveBandSplit | ( | int | len | ) |
Calculates and returns a five-band split of the audio spectrum.
len | Length of the audio data. |
int AudioAnalysis::getMaxDelta | ( | ) |
Gets the maximum delta value between FFT bins.
float AudioAnalysis::getNoisiness | ( | ) |
Gets the noisiness level of the audio.
float AudioAnalysis::getPeak | ( | ) |
Gets the peak frequency detected in the audio.
bool AudioAnalysis::getPercussionPresence | ( | ) |
Checks for the presence of percussion in the audio.
int * AudioAnalysis::getSalientFreqs | ( | ) |
Gets the salient frequencies detected in the audio.
float AudioAnalysis::getVolume | ( | ) |
Gets the volume level of the audio.
float * AudioAnalysis::getVReal | ( | ) |
Gets the raw real part of the FFT result.
float * AudioAnalysis::getVReal | ( | float | alpha | ) |
Gets a smoothed version of the real part of the FFT result.
alpha | Smoothing coefficient. |
void AudioAnalysis::processAudioFrame | ( | int | noiseThreshhold | ) |
Processes an audio frame, including sampling, FFT computation, and noise gating.
noiseThreshhold | Threshold used for noise gating. |