501 {
502
504
508 return;
509 }
510
511
514
516
519 for (size_t i = 0; i < numSamples; i++) {
520 floatBuffer[i] =
sample.pcm()[i] / 32768.0f;
521 }
522 pitchEngine->processFrame(floatBuffer, numSamples);
523 }
524
525
527
528
530
531
533 for (
size_t i = 0; i <
sample.pcm().size(); i++) {
535 if (absSample > maxSample) {
536 maxSample = absSample;
537 }
538 }
539 float peak = float(maxSample) / 32768.0f;
541
542
544
545
548 }
549
550
553
554
556
557
559 for (
int i = 0; i <
NUM_LEDS; i++) {
560 leds[i].fadeLightBy(-50);
561 }
562 }
563
564
566 case 0:
568 break;
569
570 case 1:
572 break;
573
574 case 2:
576 break;
577
578 case 3:
580 break;
581
582 case 4:
584 break;
585
586 case 5:
588 break;
589
590 case 6:
592 break;
593 }
594
595
597
599
600
602 notePos =
fl::clamp(notePos, 0.0f, 1.0f);
603 int noteX = notePos * (
WIDTH - 1);
604
605
609
610
611 for (int dx = -2; dx <= 2; dx++) {
614 int ledIndex =
xyMap(
x, noteY);
615 if (ledIndex >= 0 && ledIndex <
NUM_LEDS) {
616 leds[ledIndex] = pitchColor;
617 }
618 }
619 }
620 for (int dy = -2; dy <= 2; dy++) {
623 int ledIndex =
xyMap(noteX,
y);
624 if (ledIndex >= 0 && ledIndex <
NUM_LEDS) {
625 leds[ledIndex] = pitchColor;
626 }
627 }
628 }
629 }
630 }
631
633
634
635 #ifdef __EMSCRIPTEN__
637 #endif
638}
fl::UIAudio audio("Audio Input")
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
float rms(fl::span< const int16_t > data)
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::UIDropdown visualMode("Visualization Mode", {"Spectrum Bars", "Radial Spectrum", "Waveform", "VU Meter", "Matrix Rain", "Fire Effect", "Plasma Wave"})
void drawRadialSpectrum(fl::audio::fft::Bins *fft, float)
void drawMatrixRain(float peak)
bool detectBeat(float energy)
static const int NUM_BANDS
void drawVUMeter(float rms, float peak)
void drawFireEffect(float peak)
void updateAutoGain(float level)
fl::UICheckbox beatDetect("Beat Detection", true)
fl::UICheckbox pitchDetectEnable("Pitch Detection", false)
fl::UICheckbox pitchVisualizer("Show Pitch Visualizer", false)
fl::UICheckbox enableAudio("Enable Audio", true)
fl::UICheckbox beatFlash("Beat Flash", true)
void drawSpectrumBars(fl::audio::fft::Bins *fft, float)
void drawWaveform(const fl::span< const int16_t > &pcm, float)
void drawPlasmaWave(float peak)
fl::audio::SoundLevelMeter soundMeter(0.0, 0.0)
fl::SoundToMIDIEngine * pitchEngine
void fill_rainbow(CRGB *targetArray, int numToFill, fl::u8 initialhue, fl::u8 deltahue=5) FL_NOEXCEPT
Fill a range of LEDs with a rainbow of colors.
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
void delay(u32 ms, bool run_async=true) FL_NOEXCEPT
Public delay wrapper that keeps bare Arduino delay() preferred after using fl::delay; while still all...
CRGB sample(const CRGB *grid, const XYMap &xyMap, float x, float y, SampleMode mode)
Sample a pixel from a 2D CRGB grid at floating-point coordinates.
float fabsf(float value) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type clamp(T x, T lo, T hi) FL_NOEXCEPT
CRGB & fadeToBlackBy(u8 fadefactor) FL_NOEXCEPT
fadeToBlackBy is a synonym for nscale8(), as a fade instead of a scale
Representation of an 8-bit RGB pixel (Red, Green, Blue)