164 {
167 }
168
169
171
173
175 if (!do_frame) {
176 continue;
177 }
180
182
185
186 int32_t max = 0;
187 for (size_t i = 0; i < sample.pcm().size(); ++i) {
188 int32_t
x =
ABS(sample.pcm()[i]);
191 }
192 }
193 float anim =
194 fl::map_range<float, float>(max, 0.0f, 32768.0f, 0.0f, 1.0f);
196
197 x = fl::map_range<float, float>(anim, 0.0f, 1.0f, 0.0f,
WIDTH - 1);
198
199
200
202
203
204
205
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];
212
213 v = fl::map_range<float, float>(v, 45, 70, 0, 1.f);
215 uint8_t heatIndex =
216 fl::map_range<float, uint8_t>(v, 0, 1, 0, 255);
217
218
219
220
222 c.fadeToBlackBy(255 - heatIndex);
224
225 }
226 }
227
230 }
231
233 float rms = sample.rms();
235 rms = fl::map_range<float, float>(
rms, 0.0f, 32768.0f, 0.0f, 1.0f);
238 }
239 if (true) {
240 uint16_t fade_width = fade * (
WIDTH - 1);
242
244 auto c =
CRGB(255, 255, 0);
246 }
247 }
248
249
251
253}
UICheckbox enableRMS("Enable RMS visualization", false)
float rms(Slice< const int16_t > data)
UICheckbox enableFFT("Enable FFT visualization", true)
CRGB framebuffer[NUM_LEDS]
XYMap ledsXY(WIDTH/2, HEIGHT/2, IS_SERPINTINE)
SoundLevelMeter soundLevelMeter(.0, 0.0)
MaxFadeTracker audioFadeTracker(attackTimeSeconds.value(), decayTimeSeconds.value(), outputTimeSec.value(), 44100)
UICheckbox enableVolumeVis("Enable volume visualization", false)
XYMap frameBufferXY(WIDTH, HEIGHT, IS_SERPINTINE)
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
UIAudio audio("Audio Input")
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)
FASTLED_FORCE_INLINE T clamp(T value, T min, T max)
Representation of an RGB pixel (Red, Green, Blue)
#define FASTLED_UNUSED(x)