48#define NUM_LEDS ((WIDTH) * (HEIGHT))
49#define IS_SERPINTINE false
50#define TIME_ANIMATION 1000
106 const int N = data.
size();
107 for (
int i = 0; i < N; ++i) {
108 int32_t x32 = int32_t(data[i]);
126 FL_WARN(
"Fade time seconds: " << value);
130 FL_WARN(
"Attack time seconds: " << value);
134 FL_WARN(
"Output time seconds: " << value);
140 pitchEngine->onNoteOn = [](uint8_t note, uint8_t velocity) {
143 Serial.print(
"Note ON: ");
150 Serial.print(
"Note OFF: ");
162 for (
int i = 0; i <
NUM_LEDS; ++i) {
206 static float floatBuffer[512];
207 size_t numSamples =
fl::min(sample.pcm().size(), (
size_t)512);
208 for (
size_t i = 0; i < numSamples; i++) {
209 floatBuffer[i] = sample.pcm()[i] / 32768.0f;
211 pitchEngine->processFrame(floatBuffer, numSamples);
223 for (
size_t i = 0; i < sample.pcm().size(); ++i) {
224 int32_t
x = ABS(sample.pcm()[i]);
240 auto max_x =
fftOut.raw().size() - 1;
242 for (
size_t i = 0; i <
fftOut.raw().size(); ++i) {
255 c.fadeToBlackBy(255 - heatIndex);
266 float rms = sample.rms();
277 notePos =
fl::clamp(notePos, 0.0f, 1.0f);
278 uint16_t note_x = notePos * (
WIDTH - 1);
285 uint16_t fade_width = fade * (
WIDTH - 1);
fl::UIAudio audio("Audio Input")
fl::UIDescription description("Demo of the Animatrix effects. @author of fx is StefanPetrick")
fl::UITitle title("Animartrix")
fl::CRGB framebuffer[NUM_LEDS]
fl::UIGroup audioProcessingControls("Audio Processing", decayTimeSeconds, attackTimeSeconds, outputTimeSec)
fl::MaxFadeTracker audioFadeTracker(attackTimeSeconds.value(), decayTimeSeconds.value(), outputTimeSec.value(), 44100)
fl::UIButton advanceFrame("Advance frame")
fl::audio::SoundLevelMeter soundLevelMeter(.0, 0.0)
fl::UISlider decayTimeSeconds("Fade time Seconds",.1, 0, 4,.02)
fl::UISlider outputTimeSec("outputTimeSec",.17, 0, 2,.01)
fl::audio::fft::Bins fftOut(WIDTH)
float rms(fl::span< const int16_t > data)
fl::UICheckbox freeze("Freeze frame", false)
fl::UIGroup generalControls("General Controls", freeze, advanceFrame, fadeToBlack)
fl::UISlider fadeToBlack("Fade to black by", 5, 0, 20, 1)
fl::XYMap frameBufferXY(WIDTH, HEIGHT, IS_SERPINTINE)
fl::UICheckbox enableRMS("Enable RMS visualization", false)
fl::UICheckbox enableFFT("Enable FFT visualization", true)
fl::UISlider attackTimeSeconds("Attack time Seconds",.1, 0, 4,.02)
fl::UICheckbox enablePitchDetect("Enable pitch detection", false)
fl::XYMap ledsXY(WIDTH/2, HEIGHT/2, IS_SERPINTINE)
fl::UICheckbox enableVolumeVis("Enable volume visualization", false)
fl::UIGroup visualizationControls("Visualization", enableVolumeVis, enableRMS, enableFFT, enablePitchDetect)
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT
fl::SoundToMIDI pitchConfig
fl::SoundToMIDIEngine * pitchEngine
constexpr fl::size size() const FL_NOEXCEPT
CRGB ColorFromPalette(const CRGBPalette16 &pal, fl::u8 index, fl::u8 brightness, TBlendType blendType)
const TProgmemRGBPalette16 HeatColors_p
Approximate "black body radiation" palette, akin to the FastLED HeatColor() function.
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NOEXCEPT
FASTLED_FORCE_INLINE U map_range(T value, T in_min, T in_max, U out_min, U out_max) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type sqrt(T x) FL_NOEXCEPT
void * memcopy(void *dest, const void *src, size_t n) FL_NOEXCEPT
void * memset(void *s, int c, size_t n) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type clamp(T x, T lo, T hi) FL_NOEXCEPT
#define FASTLED_UNUSED(x)
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Aggregator header for the fl/ui/ family of per-element UI types.