3#include "../Animation.h"
4#include "../KeyFrameTrack.h"
5#include "../EasyEaseAnimator.h"
6#include "../../Objects/Background.h"
7#include "../../Objects/LEDStripBackground.h"
8#include "../../Morph/Commissions/InfraredFace.h"
9#include "../../Render/Scene.h"
10#include "../../Signals/FunctionGenerator.h"
11#include "../../Sensors/APDS9960.h"
13#include "../../Menu/SingleButtonMenu.h"
14#include "../../Materials/Animated/SpectrumAnalyzer.h"
15#include "../../Materials/Animated/AudioReactiveGradient.h"
16#include "../../Materials/Animated/Oscilloscope.h"
17#include "../../Materials/Animated/RainbowNoise.h"
18#include "../../Materials/Animated/RainbowSpiral.h"
20#include "../../Materials/MaterialAnimator.h"
22#include "../AnimationTracks/BlinkTrack.h"
24#include "../../Signals/FFTVoiceDetection.h"
26#include "../../Sensors/MicrophoneFourier_MAX9814.h"
73 eEA.
AddParameter(
pM.GetMorphWeightReference(InfraredFace::Angry), InfraredFace::Angry, 15, 0.0f, 1.0f);
74 eEA.
AddParameter(
pM.GetMorphWeightReference(InfraredFace::Sad), InfraredFace::Sad, 50, 0.0f, 1.0f);
75 eEA.
AddParameter(
pM.GetMorphWeightReference(InfraredFace::Calm), InfraredFace::Calm, 60, 0.0f, 1.0f);
76 eEA.
AddParameter(
pM.GetMorphWeightReference(InfraredFace::Determination), InfraredFace::Determination, 20, 0.0f, 1.0f);
77 eEA.
AddParameter(
pM.GetMorphWeightReference(InfraredFace::Happy), InfraredFace::Happy, 30, 0.0f, 1.0f);
78 eEA.
AddParameter(
pM.GetMorphWeightReference(InfraredFace::Mad), InfraredFace::Mad, 15, 0.0f, 1.0f);
79 eEA.
AddParameter(
pM.GetMorphWeightReference(InfraredFace::Flatten), InfraredFace::Flatten, 30, 0.0f, 1.0f);
81 eEA.
AddParameter(
pM.GetMorphWeightReference(InfraredFace::TalkA), InfraredFace::TalkA, 3, 0.0f, 1.0f);
82 eEA.
AddParameter(
pM.GetMorphWeightReference(InfraredFace::TalkB), InfraredFace::TalkB, 3, 0.0f, 1.0f);
83 eEA.
AddParameter(
pM.GetMorphWeightReference(InfraredFace::TalkC), InfraredFace::TalkC, 3, 0.0f, 1.0f);
85 eEA.
AddParameter(
pM.GetMorphWeightReference(InfraredFace::Blush), InfraredFace::Blush, 30, 0.0f, 1.0f);
116 scene.AddObject(
pM.GetObject());
134 MicrophoneFourierIT::Initialize(15, 8000, 50.0f, 120.0f);
146 pM.SetMorphWeight(InfraredFace::EyeBrowThicker, 1.0f);
147 pM.SetMorphWeight(InfraredFace::EyeBigger, 1.0f);
155 pM.SetMorphWeight(InfraredFace::EyeBrowThicker, 1.0f);
156 pM.SetMorphWeight(InfraredFace::EyeBigger, 1.0f);
165 pM.SetMorphWeight(InfraredFace::EyeBrowThicker, 1.0f);
166 pM.SetMorphWeight(InfraredFace::EyeBigger, 1.0f);
175 pM.SetMorphWeight(InfraredFace::EyeBrowThicker, 1.0f);
176 pM.SetMorphWeight(InfraredFace::EyeBigger, 1.0f);
184 pM.SetMorphWeight(InfraredFace::EyeBrowThicker, 1.0f);
185 pM.SetMorphWeight(InfraredFace::EyeBigger, 1.0f);
193 pM.SetMorphWeight(InfraredFace::EyeBrowThicker, 1.0f);
194 pM.SetMorphWeight(InfraredFace::EyeBigger, 1.0f);
202 pM.SetMorphWeight(InfraredFace::EyeBrowThicker, 1.0f);
203 pM.SetMorphWeight(InfraredFace::EyeBigger, 1.0f);
211 pM.SetMorphWeight(InfraredFace::EyeBrowThicker, 1.0f);
212 pM.SetMorphWeight(InfraredFace::EyeBigger, 1.0f);
223 pM.SetMorphWeight(InfraredFace::EyeBrowThicker, 0.0f);
224 pM.SetMorphWeight(InfraredFace::EyeBigger, 0.0f);
235 pM.SetMorphWeight(InfraredFace::EyeBrowThicker, 0.0f);
236 pM.SetMorphWeight(InfraredFace::EyeBigger, 0.0f);
247 pM.SetMorphWeight(InfraredFace::EyeBrowThicker, 0.0f);
248 pM.SetMorphWeight(InfraredFace::EyeBigger, 0.0f);
263 return pM.GetObject();
270 if(MicrophoneFourierIT::GetCurrentMagnitude() > 0.05f){
271 voiceDetection.
Update(MicrophoneFourierIT::GetFourierFiltered(), MicrophoneFourierIT::GetSampleRate());
294 MicrophoneFourierIT::Update();
296 sA.
Update(MicrophoneFourierIT::GetFourierFiltered());
302 aRG.
SetSize(
Vector2D((xOffset + 2.0f) * 10.0f + 50.0f, (xOffset + 2.0f) * 10.0f + 50.0f));
315 if (isBooped && mode != 6){
320 else if (mode == 1)
Angry();
321 else if (mode == 2)
Mad();
323 else if (mode == 4)
Happy();
324 else if (mode == 5)
Calm();
325 else if (mode == 6)
Sad();
326 else if (mode == 7) {
327 aRG.
Update(MicrophoneFourierIT::GetFourierFiltered());
331 oSC.
Update(MicrophoneFourierIT::GetSamples());
335 sA.
Update(MicrophoneFourierIT::GetFourierFiltered());
358 float scale = menuRatio * 0.6f + 0.4f;
359 float xShift = (1.0f - menuRatio) * 80.0f;
361 float adjustFacePos = float(faceSize) * 6.0f;
362 float adjustFaceX = float(faceSize) * 0.05f;
364 pM.GetObject()->GetTransform()->SetRotation(
Vector3D(0.0f, 0.0f, -7.5f));
365 pM.GetObject()->GetTransform()->SetPosition(
Vector3D(135.0f - xShift + xOffset - adjustFacePos, 67.5f - yShift + yOffset, 600.0f));
366 pM.GetObject()->GetTransform()->SetScale(
Vector3D(-0.625f + adjustFaceX, 0.825f, 1.0f).Multiply(scale));
368 pM.GetObject()->UpdateTransform();
A class for managing the Adafruit APDS9960 sensor.
static bool Initialize(uint8_t threshold)
Initializes the APDS9960 sensor.
static bool isBooped()
Checks if the sensor is "booped" (close proximity detected).
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.
float GetViseme(MouthShape viseme)
Retrieves the probability of a specific viseme.
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.
Creates a customizable gradient material for rendering.
void HueShift(float hueDeg)
Shifts the hue of the gradient by a specified degree.
FunctionGenerator fGenMatHue
FunctionGenerator fGenMatYMove
SimpleMaterial redMaterial
void UpdateKeyFrameTracks()
RainbowSpiral rainbowSpiral
SimpleMaterial blueMaterial
void AudioReactiveGradientFace()
LEDStripBackground ledStripBackground
void ChangeInterpolationMethods()
GradientMaterial< 2 > gradientMat
void SpectrumAnalyzerFace()
FunctionGenerator fGenMatPos
MaterialAnimator< 5 > materialAnimator
FunctionGenerator fGenScale
FunctionGenerator fGenRotation
void FadeIn(float stepRatio) override
void FadeOut(float stepRatio) override
RainbowNoise rainbowNoise
FunctionGenerator fGenMatXMove
void Update(float ratio) override
FFTVoiceDetection< 128 > voiceDetection
RGBColor gradientSpectrum[2]
MaterialAnimator< 4 > backgroundMaterial
uint8_t GetAccentBrightness()
EasyEaseAnimator< 21 > eEA
AudioReactiveGradient aRG
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.
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 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 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.
@ OO
Mouth shape corresponding to the "OO" sound.
@ EE
Mouth shape corresponding to the "EE" sound.