14#include "../../../../Utils/Filter/RunningAverageFilter.h"
15#include "../../../../Utils/Filter/PeakDetection.h"
16#include "../../../../Renderer/Utils/IndexGroup.h"
17#include "../../../../Renderer/Utils/Triangle2D.h"
18#include "../../../../Utils/Math/Vector2D.h"
52template <
size_t peakCount>
140 void Update(
float* peaks,
float maxFrequency);
Detects visemes based on FFT voice analysis.
RunningAverageFilter< 10 > peakSmoothing
Smoothing filter for peak data.
Vector2D visEE
Coordinates for "EE".
Vector2D visAR
Coordinates for "AR".
float visRatioOO
Probability for "OO".
PeakDetection< peakCount > peakDetection
Peak detection instance.
void CalculateFormants(float *peaks, uint8_t bandwidth)
Calculates formant frequencies (F1 and F2) from FFT peaks.
float f1
Formant frequency F1.
float threshold
Threshold for formant calculations.
float visRatioAR
Probability for "AR".
float peakDensity[peakCount]
Array of peak densities.
Vector2D visAH
Coordinates for "AH".
Vector2D visUH
Coordinates for "UH".
float f2
Formant frequency F2.
float visRatioUH
Probability for "UH".
FFTVoiceDetection()
Constructs a new FFTVoiceDetection instance.
void CalculateVisemeGroup()
Calculates the viseme group probabilities based on formants.
void PrintVisemes()
Prints the probabilities of all visemes to the serial console.
float visRatioAH
Probability for "AH".
Vector2D * coordinates[visemeCount]
Array of viseme coordinates.
float visRatioAE
Probability for "AE".
Vector2D visER
Coordinates for "ER".
float GetViseme(MouthShape viseme)
Retrieves the probability of a specific viseme.
void ResetVisemes()
Resets all viseme probabilities to zero.
static const uint8_t visemeCount
Number of supported visemes.
float * visRatios[visemeCount]
Array of viseme probabilities.
void SetThreshold(float threshold)
Sets the threshold for formant calculations.
Vector2D visOO
Coordinates for "OO".
Vector2D visAE
Coordinates for "AE".
bool peaksBinary[peakCount]
Binary array indicating peak presence.
float visRatioER
Probability for "ER".
void Update(float *peaks, float maxFrequency)
Updates the viseme probabilities based on new FFT data.
float visRatioEE
Probability for "EE".
Detects peaks in time-series data using statistical methods.
Smooths data values using a weighted running average.
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Defines the available mouth shapes (visemes).
MouthShape
Enumerates the possible mouth shapes for viseme detection.
@ ER
Mouth shape corresponding to the "ER" sound.
@ AE
Mouth shape corresponding to the "AE" sound.
@ OO
Mouth shape corresponding to the "OO" sound.
@ AH
Mouth shape corresponding to the "AH" sound.
@ UH
Mouth shape corresponding to the "UH" sound.
@ AR
Mouth shape corresponding to the "AR" sound.
@ SS
Mouth shape corresponding to the "SS" sound (optional).
@ EE
Mouth shape corresponding to the "EE" sound.