ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
FFTFilter.h
Go to the documentation of this file.
1/**
2 * @file FFTFilter.h
3 * @brief Provides the `FFTFilter` class for processing and normalizing FFT data.
4 *
5 * The `FFTFilter` applies a smoothing filter to FFT data and normalizes the output
6 * to constrain the values within a specified range.
7 *
8 * @date 22/12/2024
9 * @version 1.0
10 * @author Coela Can't
11 */
12
13#pragma once
14
15#include "RunningAverageFilter.h" // Includes the running average filter utility.
16#include "../Math/Mathematics.h" // Includes mathematical utilities for constraints and operations.
17
18/**
19 * @class FFTFilter
20 * @brief Processes and normalizes FFT data.
21 *
22 * The `FFTFilter` applies a running average filter to FFT input values, removes
23 * a baseline minimum value, and normalizes the output for stability and usability
24 * in other FFT-based functionalities.
25 */
26class FFTFilter {
27private:
28 RunningAverageFilter<20> minKF = RunningAverageFilter<20>(0.05f); ///< Running average filter for baseline normalization.
29 float outputValue = 0.0f; ///< Stores the most recent filtered output value.
30
31public:
32 /**
33 * @brief Constructs an `FFTFilter` instance with default configurations.
34 */
35 FFTFilter();
36
37 /**
38 * @brief Retrieves the current filtered and normalized output value.
39 *
40 * @return The most recent filtered output value.
41 */
42 float GetOutput();
43
44 /**
45 * @brief Filters and normalizes the input value for FFT data processing.
46 *
47 * @param value The current FFT input value.
48 * @return The filtered and normalized FFT value.
49 */
50 float Filter(float value);
51};
Implements a running average filter for smoothing data.
Processes and normalizes FFT data.
Definition FFTFilter.h:26
RunningAverageFilter< 20 > minKF
Running average filter for baseline normalization.
Definition FFTFilter.h:28
float GetOutput()
Retrieves the current filtered and normalized output value.
Definition FFTFilter.cpp:5
float outputValue
Stores the most recent filtered output value.
Definition FFTFilter.h:29
FFTFilter()
Constructs an FFTFilter instance with default configurations.
Definition FFTFilter.cpp:3
float Filter(float value)
Filters and normalizes the input value for FFT data processing.
Definition FFTFilter.cpp:9
Smooths data values using a weighted running average.