6#include "../Objects/Background.h"
7#include "../Objects/LEDStripBackground.h"
8#include "../Morph/GammaFace.h"
9#include "../Render/Scene.h"
10#include "../Signals/FunctionGenerator.h"
11#include "../Menu/SingleButtonMenu.h"
12#include "../Sensors/APDS9960.h"
14#include "../Materials/Animated/RainbowNoise.h"
15#include "../Materials/Animated/RainbowSpiral.h"
16#include "../Materials/Animated/SpectrumAnalyzer.h"
17#include "../Materials/Animated/AudioReactiveGradient.h"
18#include "../Materials/Animated/Oscilloscope.h"
20#include "../Materials/MaterialAnimator.h"
24#include "../Signals/FFTVoiceDetection.h"
26#include "../Sensors/MicrophoneFourier_MAX9814.h"
28#include "../Render/ObjectAlign.h"
30#include "../Sensors/SHARPGP2Y.h"
31#include "../Sensors/SerialSync.h"
32#include "../Filter/KalmanFilter.h"
35#include "../Sensors/SSD1306.h"
57 RGBColor gradientSpectrum[6] = {
RGBColor(255, 0, 0),
RGBColor(255, 255, 0),
RGBColor(0, 255, 0),
RGBColor(0, 255, 255),
RGBColor(0, 0, 255),
RGBColor(255, 0, 255)};
101 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::BlushEye), GammaFace::BlushEye, 40, 0.0f, 1.0f);
102 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::HideBlush), GammaFace::HideBlush, 10, 1.0f, 0.0f);
103 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::HideEyeBrow), GammaFace::HideEyeBrow, 10, 0.0f, 1.0f);
104 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::HideSecondEye), GammaFace::HideSecondEye, 10, 0.0f, 1.0f);
105 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::OwOMouth), GammaFace::OwOMouth, 60, 0.0f, 1.0f);
107 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::SadEye), GammaFace::SadEye, 70, 0.0f, 1.0f);
108 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::SadEyeBrow), GammaFace::SadEyeBrow, 80, 0.0f, 1.0f);
109 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::SadMouth), GammaFace::SadMouth, 90, 0.0f, 1.0f);
111 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::FlatMouth), GammaFace::FlatMouth, 50, 0.0f, 1.0f);
112 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::DeadEye), GammaFace::DeadEye, 1, 0.0f, 1.0f);
114 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::HeartEye), GammaFace::HeartEye, 30, 0.0f, 1.0f);
116 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::OwO), GammaFace::OwO, 90, 0.0f, 1.0f);
118 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::AlphaGenCircle), GammaFace::AlphaGenCircle, 90, 0.0f, 1.0f);
119 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::HideAll), GammaFace::HideAll, 90, 0.0f, 1.0f);
121 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::AngryEyeMouth), GammaFace::AngryEyeMouth, 90, 0.0f, 1.0f);
122 eEA.
AddParameter(
pM.GetMorphWeightReference(GammaFace::Gamma), GammaFace::Gamma, 20, 0.0f, 1.0f);
234 pM.SetMorphWeight(GammaFace::HideSecondEye, 0.0f);
239 pM.SetMorphWeight(GammaFace::HideSecondEye, 1.0f);
245 pM.SetMorphWeight(GammaFace::HideSecondEye, 0.0f);
275 if(MicrophoneFourierIT::GetCurrentMagnitude() > 0.05f){
276 voiceDetection.
Update(MicrophoneFourierIT::GetFourierFiltered(), MicrophoneFourierIT::GetSampleRate());
306 scene.AddObject(
pM.GetObject());
323 oledDisplay.Initialize();
327 MicrophoneFourierIT::Initialize(22, 8000, 50.0f, 120.0f);
331 #elif defined(BACKFACE)
336 oledDisplay.Display();
344 return pM.GetObject();
356 MicrophoneFourierIT::Update();
362 aRG.
SetSize(
Vector2D((xOffset + 2.0f) * 10.0f + 50.0f, (xOffset + 2.0f) * 10.0f + 50.0f));
380 float currentOffset = 0.0f;
385 ratio = fmod(ratio - currentOffset, 1.0f);
406 float mouthMove = MicrophoneFourierIT::GetCurrentMagnitude() / 2.0f;
449 else if (mode == 1)
Sad();
450 else if (mode == 2)
Heart();
451 else if (mode == 3)
OwO2();
454 else if (mode == 6) {
455 aRG.
Update(MicrophoneFourierIT::GetFourierFiltered());
459 oSC.
Update(MicrophoneFourierIT::GetSamples());
463 sA.
Update(MicrophoneFourierIT::GetFourierFiltered());
480 pM.GetObject()->GetTransform()->SetPosition(
Vector3D(-170.0f + xOffset * 2.0f, 30.0f + yOffset * 2.0f -
offsetFace * 100.0f - menuRatio * 400.0f, 0.0f));
481 pM.GetObject()->GetTransform()->SetRotation(
Vector3D(0.0f, 0.0f, 0.0f));
484 pM.GetObject()->UpdateTransform();
Declares the BlinkTrack template class for animating eye blinking.
Declares the EasyEaseAnimator template class for advanced animation easing.
Declares the KeyFrameTrack template class for managing keyframe-based animations.
A class for managing the Adafruit APDS9960 sensor.
static bool Initialize(uint8_t threshold)
Initializes the APDS9960 sensor.
static uint8_t GetValue()
Retrieves the current proximity value.
void AddParameter(float *parameter)
Adds a parameter to the animation track.
void Play()
Starts or resumes playback of the animation track.
void Pause()
Pauses playback of the animation track.
float Update()
Updates the animation track and returns the current parameter value.
A material class for creating an audio-reactive gradient effect.
void SetRadius(float radius)
Sets the radius for circular gradient patterns.
void SetPosition(Vector2D offset)
Sets the position of the gradient.
void Update(float *readData)
Updates the gradient based on new audio data.
void SetSize(Vector2D size)
Sets the size of the gradient.
void SetRotation(float angle)
Sets the rotation angle of the gradient.
void SetHueAngle(float hueAngle)
Sets the hue angle for color adjustments.
A template class for animating eye blinking using keyframes.
A template class for implementing advanced animation easing.
void AddParameterFrame(uint16_t dictionaryValue, float value) override
Adds a single frame value for a parameter.
void Update() override
Updates the animator, advancing all animations.
void SetInterpolationMethod(uint16_t dictionaryValue, InterpolationMethod interpMethod) override
Sets the interpolation method for a specific parameter.
void AddParameter(float *parameter, uint16_t dictionaryValue, uint16_t frames, float basis, float goal) override
Adds a parameter to the animator.
Detects visemes based on FFT voice analysis.
void SetThreshold(float threshold)
Sets the threshold for formant calculations.
void Update(float *peaks, float maxFrequency)
Updates the viseme probabilities based on new FFT data.
A class to generate various waveform functions with customizable parameters.
@ Triangle
Triangle waveform.
float Update()
Updates and calculates the next value of the waveform.
FunctionGenerator fGenMatHue
SimpleMaterial greenMaterial
FunctionGenerator fGenMatYMove
void Initialize() override
SimpleMaterial redMaterial
void UpdateKeyFrameTracks()
RainbowSpiral rainbowSpiral
SimpleMaterial blueMaterial
FunctionGenerator fGenMatRMenu
void AudioReactiveGradientFace()
SimpleMaterial yellowMaterial
void ChangeInterpolationMethods()
KalmanFilter< 25 > ratioCompensation
void SpectrumAnalyzerFace()
FunctionGenerator fGenMatPos
FunctionGenerator fGenScale
FunctionGenerator fGenRotation
EasyEaseAnimator< 30 > eEA
RGBColor gradientSpectrum[6]
SimpleMaterial orangeMaterial
FunctionGenerator fGenMatXMenu
void FadeIn(float stepRatio) override
void FadeOut(float stepRatio) override
RainbowNoise rainbowNoise
FunctionGenerator fGenMatYMenu
FunctionGenerator fGenMatXMove
MaterialAnimator< 10 > materialAnimator
SimpleMaterial purpleMaterial
void Update(float ratio) override
FFTVoiceDetection< 128 > voiceDetection
MaterialAnimator< 4 > backgroundMaterial
SimpleMaterial whiteMaterial
GradientMaterial< 6 > gradientMat
AudioReactiveGradient aRG
Creates a customizable gradient material for rendering.
Implements a generic Kalman Filter for 1D data.
T Filter(T value)
Filters the given input value using the Kalman Filter algorithm.
Animates transitions and blends between multiple materials.
void AddMaterial(Material::Method method, Material *material, uint16_t frames, float minOpacity, float maxOpacity)
Adds a material to the animation with specified properties.
void SetBaseMaterial(Material::Method method, Material *material)
Sets the base material for the animation.
void AddMaterialFrame(Material &material, float opacity)
Adds a specific frame for a material in the animation.
void Update()
Updates the animator, advancing the transitions.
@ Lighten
Chooses the lighter color.
@ Add
Adds colors together.
@ Replace
Replaces the base color.
static uint8_t GetCurrentMenu()
Retrieves the index of the currently active menu.
Represents a 3D object with geometry, material, and transformation data.
A dynamic oscilloscope material for visualizing audio signals.
void SetPosition(Vector2D offset)
Sets the position of the oscilloscope visualization.
void SetSize(Vector2D size)
Sets the size of the oscilloscope visualization.
void Update(float *data)
Updates the oscilloscope visualization based on new audio data.
void SetRotation(float angle)
Sets the rotation angle of the visualization.
void SetHueAngle(float hueAngle)
Sets the hue angle for color adjustments.
Represents an RGB color and provides methods for manipulation.
A dynamic material that creates a rainbow effect using simplex noise.
void Update(float ratio)
Updates the material animation based on the time ratio.
A dynamic material creating a colorful rainbow spiral animation.
void Update(float ratio)
Updates the material animation based on the time ratio.
A class for managing the SHARP GP2Y distance sensor.
float Update()
Updates the distance measurement by reading the sensor.
static void SetMirrorSpectrumAnalyzer(uint8_t spectrumMirror)
static void SetUseMicrophone(uint8_t microphone)
static void SetMouthMove(float ratio)
static void SetMode(uint8_t mode)
static uint8_t GetFaceState()
static uint8_t GetFaceColor()
static uint8_t GetMicLevel()
static void SetUseBoopSensor(uint8_t boopSensor)
static void SetRatio(float ratio)
static void SetDead(bool dead)
static void SetFaceColor(uint8_t color)
static void SetFaceState(uint8_t faceState)
static void SetAccentBrightness(uint8_t accentBright)
static void SetBoop(bool boop)
static uint8_t MirrorSpectrumAnalyzer()
static uint8_t GetFaceSize()
static void SetCurrentMenu(uint8_t currentMenu)
static uint8_t GetCurrentMenu()
static uint8_t UseMicrophone()
static float GetMouthMove()
static void SetMicLevel(uint8_t micLevel)
static uint8_t UseBoopSensor()
static void SetFaceSize(uint8_t faceSize)
static uint8_t GetBrightness()
static uint8_t GetAccentBrightness()
static void SetBrightness(uint8_t bright)
A material that applies a single, solid RGB color to surfaces.
A material that visualizes audio data as a spectrum.
void SetMirrorYState(bool state)
Sets the mirroring state for the visualization.
void Update(float *readData)
Updates the spectrum visualization with new audio data.
void SetFlipYState(bool state)
Sets the flipping state for the visualization.
void SetHueAngle(float hueAngle)
Sets the hue adjustment angle for the spectrum colors.
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.