49#define NUM_LEDS ((WIDTH) * (HEIGHT))
50#define IS_SERPINTINE false
51#define TIME_ANIMATION 1000
100 const int N = data.
size();
101 for (
int i = 0; i < N; ++i) {
102 int32_t x32 = int32_t(data[i]);
105 float rms = sqrt(
float(sumSq) / N);
110 Serial.begin(115200);
115 auto screenmap =
ledsXY.toScreenMap();
116 screenmap.setDiameter(.2);
131 .setScreenMap(screenmap);
138 for (
int i = 0; i <
NUM_LEDS; ++i) {
147 memcpy(row1, row2,
WIDTH *
sizeof(
CRGB));
187 for (
size_t i = 0; i < sample.pcm().size(); ++i) {
188 int32_t
x =
ABS(sample.pcm()[i]);
194 fl::map_range<float, float>(max, 0.0f, 32768.0f, 0.0f, 1.0f);
197 x = fl::map_range<float, float>(anim, 0.0f, 1.0f, 0.0f,
WIDTH - 1);
207 auto max_x =
fftOut.bins_raw.size() - 1;
209 for (
size_t i = 0; i <
fftOut.bins_raw.size(); ++i) {
211 auto v =
fftOut.bins_db[i];
213 v = fl::map_range<float, float>(v, 45, 70, 0, 1.f);
216 fl::map_range<float, uint8_t>(v, 0, 1, 0, 255);
222 c.fadeToBlackBy(255 - heatIndex);
233 float rms = sample.rms();
235 rms = fl::map_range<float, float>(
rms, 0.0f, 32768.0f, 0.0f, 1.0f);
240 uint16_t fade_width = fade * (
WIDTH - 1);
244 auto c =
CRGB(255, 255, 0);
UIGroup visualizationControls("Visualization", enableVolumeVis, enableRMS, enableFFT)
UISlider decayTimeSeconds("Fade time Seconds",.1, 0, 4,.02)
UITitle title("Simple control of an xy path")
UICheckbox enableRMS("Enable RMS visualization", false)
UISlider outputTimeSec("outputTimeSec",.17, 0, 2,.01)
float rms(Slice< const int16_t > data)
UIButton advanceFrame("Advance frame")
UICheckbox freeze("Freeze frame", false)
UICheckbox enableFFT("Enable FFT visualization", true)
UISlider fadeToBlack("Fade to black by", 5, 0, 20, 1)
CRGB framebuffer[NUM_LEDS]
XYMap ledsXY(WIDTH/2, HEIGHT/2, IS_SERPINTINE)
SoundLevelMeter soundLevelMeter(.0, 0.0)
UISlider attackTimeSeconds("Attack time Seconds",.1, 0, 4,.02)
UIGroup generalControls("General Controls", freeze, advanceFrame, fadeToBlack)
MaxFadeTracker audioFadeTracker(attackTimeSeconds.value(), decayTimeSeconds.value(), outputTimeSec.value(), 44100)
UIDescription description("This is more of a test for new features.")
UICheckbox enableVolumeVis("Enable volume visualization", false)
UIGroup audioProcessingControls("Audio Processing", decayTimeSeconds, attackTimeSeconds, outputTimeSec)
XYMap frameBufferXY(WIDTH, HEIGHT, IS_SERPINTINE)
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
UIAudio audio("Audio Input")
Tracks a smoothed peak with attack, decay, and output-inertia time-constants.
LED controller for WS2812 LEDs with GRB color order.
const TProgmemRGBPalette16 HeatColors_p
Approximate "black body radiation" palette, akin to the FastLED HeatColor() function.
void downscale(const CRGB *src, const XYMap &srcXY, CRGB *dst, const XYMap &dstXY)
CRGB ColorFromPalette(const CRGBPalette16 &pal, fl::u8 index, fl::u8 brightness, TBlendType blendType)
void * memfill(void *ptr, int value, fl::size num)
FASTLED_FORCE_INLINE T clamp(T value, T min, T max)
Representation of an RGB pixel (Red, Green, Blue)
#define FASTLED_UNUSED(x)