Skip to content

FastLED Audio Reactive Enhancement thread #2193

Closed

Description

@zackees

@4wheeljive @ewowi

Let's continue the conversation here.

https://www.youtube.com/watch?v=G8DKbjUFkTs

Great example of audio reactive stuff. Still a long away to go.

First agenda when I start this is pink noise table removals.

Activity

  1. zackees commented on Mar 3, 2026

    @zackees
    MemberAuthor

    VibeDetector: MilkDrop-Inspired Self-Normalizing Audio Analysis

    @4wheeljive I made this tonight for your animartrix animations. It works good in silico. I still don't have a good test setup with fastled-wasm. I'm transitioning the js to typescript so it's a bit down at the moment.

  2. ewowi commented on Mar 3, 2026

    @ewowi

    error logs deleted by zackees

  3. reopened this on Mar 4, 2026
  4. zackees commented on Mar 4, 2026

    @zackees
    MemberAuthor

    nah we'll just fix it as it comes. Not sure why sometimes these compiler issues slip through the cracks.

  5. zackees commented on Mar 4, 2026

    @zackees
    MemberAuthor

    Esp32s3 should work now

  6. 4wheeljive commented on Mar 4, 2026

    @4wheeljive
    Contributor

    @zackees The vibe detector seems like a very nice add. I suspect that having this deployment-ready tool will be of great use to a lot of people in many projects. I'll have to give some thought to how this "self-contained signal-to-visual pipeline" could be used with animatrix. (It's a paradigm shift from my current setup where I've separated my audio detection/analysis from my visual response logic.)

  7. zackees commented on Mar 4, 2026

    @zackees
    MemberAuthor

    I got the fastled wasm builder back up and running. My current task is to test out the vibe detector through mp3's. Right now i'm playing elder brooks inner light and seeing how I can use the signals as inputs to warp animartrix2

    pip install fastled
    fastled examples/AnimartrixRing
  8. zackees commented on Mar 4, 2026

    @zackees
    MemberAuthor

    the eternal question for what makes a good time could lie in the answer of "what happens when you press the vibe button"??

    Image
  9. 4wheeljive commented on Mar 4, 2026

    @4wheeljive
    Contributor

    Hey Zach. That picture and caption above are very enticing. However, I loaded up my FLAudioTest sketch (https://github.com/4wheeljive/FLAudioTest) (100% FastLED audio) and asked Claude for a simple animation to show off the Vibe Detector level detectors and do something additional when beats were detected; and unfortunately the result was disappointing: https://youtu.be/9hZrl4nB4pc

    Claude's report:


    VibeDetector Display Testing — Issue Report

    Setup: ESP32-S3 (Seeed XIAO), I2S mic, 32x48 WS2812B matrix, latest FastLED master.

    Test: Three horizontal bar zones driven by getVibeBass(), getVibeMid(), getVibeTreb(), filling proportionally from center. Spike callbacks (onVibeBassSpike, onVibeMidSpike) triggering ripple effects.

    Observed behavior:

    • Mid and Treble bands show nearly constant width. The self-normalizing values hover so tightly around 1.0 that any linear mapping (e.g. v * 0.5) produces bars stuck at roughly 25%-75% fill with very little visible variation. The normalization is doing its job of centering around 1.0, but the dynamic range of the variation around 1.0 is too narrow to drive a proportional visual without applying sqrt compression or similar on the consumer side.
    • Bass band is effectively binary — fully lit or fully dark. Bass energy is impulsive, so the immediate relative value swings between near-zero and well above 2.0. With a linear mapping this clips to either 0% or 100% fill with almost nothing in between.

    Possible suggestions for the API:

    • The smoothed values (getBassAtt() etc.) might be better suited for proportional visualizations, but the same normalization-around-1.0 issue would apply, just less extreme.
    • Consider exposing a display-friendly 0.0–1.0 output (perhaps optional) that applies some compression internally, so consumers don't all have to independently solve the same mapping problem.
    • Alternatively, document the expected value ranges and recommended mapping curves for common use cases (bar fill, brightness modulation, etc.).

  10. zackees commented on Mar 4, 2026

    @zackees
    MemberAuthor

    yeah i know, im focusing on it tonight

  11. ewowi commented on Mar 4, 2026

    @ewowi

    Esp32s3 should work now

    Confirmed, now only these warnings remain on esp32-s3:

    (I will delete earlier comments on warnings and errors in this issue to keep the comments clean)

    In file included from .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/esp/32/drivers/uart/_build.cpp.hpp:9,
    from .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/esp/32/drivers/_build.cpp.hpp:23,
    from .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/esp/32/_build.cpp.hpp:20,
    from .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/esp/_build.cpp.hpp:8,
    from .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/_build.cpp.hpp:19,
    from .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/_build.cpp:6:
    .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/esp/32/drivers/uart/wave8_encoder_uart.cpp.hpp:175:45: warning: ignoring attribute 'section (".iram1.text.88")' because it conflicts with previous 'section (".iram1.text.64")' [-Wattributes]
    175 | const Wave10Lut& lut) {
    | ^
    In file included from .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/esp/32/drivers/uart/channel_driver_uart.h:40,
    from .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/esp/32/drivers/channel_manager_esp32.cpp.hpp:53,
    from .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/esp/32/drivers/_build.cpp.hpp:8:
    .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/esp/32/drivers/uart/wave8_encoder_uart.h:162:8: note: previous declaration here
    162 | size_t encodeLedsToUart(const u8* input,
    | ^~~~~~~~~~~~~~~~
    .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/esp/32/drivers/uart/wave8_encoder_uart.cpp.hpp:193:47: warning: ignoring attribute 'section (".iram1.text.89")' because it conflicts with previous 'section (".iram1.text.65")' [-Wattributes]
    193 | size_t output_capacity) {
    | ^
    .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/esp/32/drivers/uart/wave8_encoder_uart.h:170:8: note: previous declaration here
    170 | size_t encodeLedsToUart(const u8* input,
    | ^~~~~~~~~~~~~~~~
    In file included from .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/shared/spi_bitbang/_build.cpp.hpp:9,
    from .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/shared/_build.cpp.hpp:23,
    from .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/_build.cpp.hpp:21:
    .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/shared/spi_bitbang/spi_isr_engine.cpp.hpp:139:38: warning: ignoring attribute 'section (".iram1.text.91")' because it conflicts with previous 'section (".iram1.text.90")' [-Wattributes]
    139 | FL_IRAM void fl_parallel_spi_isr(void) {
    | ^
    In file included from .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/shared/spi_bitbang/spi_isr_engine.cpp.hpp:47:
    .pio/libdeps/esp32-s3-n16r8v/FastLED/src/platforms/shared/spi_bitbang/spi_isr_engine.h:114:14: note: previous declaration here
    114 | FL_IRAM void fl_parallel_spi_isr(void);
    | ^~~~~~~~~~~~~~~~~~~

  12. ewowi commented on Mar 4, 2026

    @ewowi

    esp32-p4 has now an error on ETS_GPIO_INTR_SOURCE:

    In file included from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/gpio_isr_rx/_build.cpp.hpp:8,
    from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/_build.cpp.hpp:16,
    from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/_build.cpp.hpp:20,
    from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/_build.cpp.hpp:8,
    from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/_build.cpp.hpp:19,
    from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/_build.cpp:6:
    .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/gpio_isr_rx/gpio_isr_rx_mcpwm.cpp.hpp: In function 'bool {anonymous}::install_direct_gpio_isr(int, void*, intr_handle_data_t**)':
    .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/gpio_isr_rx/gpio_isr_rx_mcpwm.cpp.hpp:85:23: error: 'ETS_GPIO_INTR_SOURCE' was not declared in this scope; did you mean 'ETS_GPIO_INTR3_SOURCE'?
    85 | int intr_source = ETS_GPIO_INTR_SOURCE;
    | ^~~~~~~~~~~~~~~~~~~~
    | ETS_GPIO_INTR3_SOURCE
    In file included from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/parlio/_build.cpp.hpp:8,
    from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/_build.cpp.hpp:19:
    .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/parlio/parlio_engine.cpp.hpp: At global scope:
    .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/parlio/parlio_engine.cpp.hpp:1699:31: warning: ignoring attribute 'section (".iram1.text.87")' because it conflicts with previous 'section (".iram1.text.60")' [-Wattributes]
    1699 | size_t& outputBytesWritten) {
    | ^
    In file included from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/parlio/channel_driver_parlio.h:194,
    from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/channel_manager_esp32.cpp.hpp:43,
    from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/_build.cpp.hpp:8:
    .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/parlio/parlio_engine.h:258:39: note: previous declaration here
    258 | FL_OPTIMIZE_FUNCTION bool FL_IRAM populateDmaBufferSpi(
    | ^~~~~~~~~~~~~~~~~~~~
    In file included from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/uart/_build.cpp.hpp:9,
    from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/_build.cpp.hpp:23:
    .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/uart/wave8_encoder_uart.cpp.hpp:175:45: warning: ignoring attribute 'section (".iram1.text.98")' because it conflicts with previous 'section (".iram1.text.67")' [-Wattributes]
    175 | const Wave10Lut& lut) {
    | ^
    In file included from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/uart/channel_driver_uart.h:40,
    from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/channel_manager_esp32.cpp.hpp:53:
    .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/uart/wave8_encoder_uart.h:162:8: note: previous declaration here
    162 | size_t encodeLedsToUart(const u8* input,
    | ^~~~~~~~~~~~~~~~
    .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/uart/wave8_encoder_uart.cpp.hpp:193:47: warning: ignoring attribute 'section (".iram1.text.99")' because it conflicts with previous 'section (".iram1.text.68")' [-Wattributes]
    193 | size_t output_capacity) {
    | ^
    .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/esp/32/drivers/uart/wave8_encoder_uart.h:170:8: note: previous declaration here
    170 | size_t encodeLedsToUart(const u8* input,
    | ^~~~~~~~~~~~~~~~
    In file included from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/shared/spi_bitbang/_build.cpp.hpp:9,
    from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/shared/_build.cpp.hpp:23,
    from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/_build.cpp.hpp:21:
    .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/shared/spi_bitbang/spi_isr_engine.cpp.hpp:139:38: warning: ignoring attribute 'section (".iram1.text.101")' because it conflicts with previous 'section (".iram1.text.100")' [-Wattributes]
    139 | FL_IRAM void fl_parallel_spi_isr(void) {
    | ^
    In file included from .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/shared/spi_bitbang/spi_isr_engine.cpp.hpp:47:
    .pio/libdeps/esp32-p4-nano/FastLED/src/platforms/shared/spi_bitbang/spi_isr_engine.h:114:14: note: previous declaration here
    114 | FL_IRAM void fl_parallel_spi_isr(void);

  13. 140 remaining items

  14. zackees commented on Apr 6, 2026

    @zackees
    MemberAuthor

    Hey folks, Clud here — Zach's dev assistant. Here's a rundown of what just landed in the "final fix" commits (77e15e1, 55315bf).

    Volume system overhaul — now 0.0–1.0 normalized

    The old code had volume, volumeRaw, and peak on a rough 0–255 scale with ad-hoc scaling (rms / 128.0f, peak * 255). That made downstream code brittle and the numbers hard to reason about. All three fields are now clean 0.0–1.0 floats:

    • volumeRaw = rms / 23170 (that's the max RMS of a full-scale 16-bit sine, i.e. 32767/√2), clamped to 1.0
    • volume = sourced from the EnergyAnalyzer — this is an adaptively normalized value that tracks ambient level, so it naturally floats around a useful range without manual tuning
    • peak = maxSample / 32768, clamped to 1.0

    Beat detection now uses raw volume, not adaptive

    The adaptive volume converges toward a steady state by design — great for VU-meter-style display, terrible for detecting transient spikes. Beat detection was switched to use volumeRaw instead, with the threshold dropped from 10.0 to 0.04 (matching the new 0–1 scale). This should give much snappier beat response.

    Spectral flux state-ordering bug fixed

    There was a subtle bug where updateSpectralFlux() and detectEnhancedBeats() were both calling into SpectralFluxDetector::calculateSpectralFlux(), which updates internal state each time. So by the time detectOnset() ran, the detector had already seen the current frame as "previous" and computed zero flux. Fixed by giving Reactive its own mPreviousMagnitudes for the spectral flux calculation, and having the detector manage its own internal state separately via detectOnset().

    Smoothed data now carries enhanced beat fields

    smoothResults() wasn't copying bassBeatDetected, midBeatDetected, trebleBeatDetected, spectralFlux, or the band energy fields into the smoothed output. So anything reading getData() after smoothing would see stale zeros for those. Fixed — they're now copied through.

    Loudness compensation level adjusted

    The reference level for applyLoudnessCompensation() was dropped from 50.0 to 0.28 to match the new 0–1 volume scale.

    API tightened up

    SpectralFluxDetector::detectOnset() and calculateSpectralFlux() now take span<const float, 16> instead of raw pointers — prevents accidentally passing the wrong buffer size. Same for BeatDetectors::detectBeats().

    These changes build on top of the A-weighting pipeline reorder and pink noise gain cap from commit 794f546 (which fixed the bin 15 overactivity @ewowi reported). Together they should give a much more responsive and well-balanced audio reactive experience.

    Wiki has been updated to reflect the new API.

  15. zackees commented on Apr 6, 2026

    @zackees
    MemberAuthor

    Closing this bug now. When you find issues, please ping me and we'll re-open it.

  16. ewowi commented on Apr 11, 2026

    @ewowi

    @zackees ,regarding

    volumeRaw, volume and peak

    Where to find them?

    I see only these values:

    Image

    Update the following can be ignored as I found:

    sharedData.majorPeak = audioProcessor.getEqDominantFreqHz();
    sharedData.magnitude = audioProcessor.getEqDominantMagnitude() * 4096.0; // 4096 is WLED max
    

    Only thing is the value range of audioProcessor.getEqDominantMagnitude, is that 0..1 or 0... 4096 or ...?

    Ignore:

    Trying to get WLED effects running, volumeSmth and bands work, looking especially for fft major peak and magnitude, is there a way to get these for the audio engine?

    ┌───────────────┬─────────────────────┬────────────────────────────────────────────┬──────────────┐
    │ Variable │ Range │ Use Case │ Priority │
    ├───────────────┼─────────────────────┼────────────────────────────────────────────┼──────────────┤
    │ volumeSmth │ 0.0–255.0 │ Overall volume/intensity responsiveness │ 🔴 Essential │
    ├───────────────┼─────────────────────┼────────────────────────────────────────────┼──────────────┤
    │ sampleAvg │ 0.0–255.0 │ Smoothed volume (simpler, no AGC) │ 🟡 Secondary │
    ├───────────────┼─────────────────────┼────────────────────────────────────────────┼──────────────┤
    │ sampleAgc │ 0.0–255.0 │ AGC-adjusted volume (responds to gain) │ 🟡 Secondary │
    ├───────────────┼─────────────────────┼────────────────────────────────────────────┼──────────────┤
    │ FFT_MajorPeak │ 1.0–11025.0 Hz │ Dominant frequency (bass/treble detection) │ 🟡 Secondary │
    ├───────────────┼─────────────────────┼────────────────────────────────────────────┼──────────────┤
    │ FFT_Magnitude │ 0.0–4096.0 │ Strength of peak frequency │ 🟡 Secondary │
    ├───────────────┼─────────────────────┼────────────────────────────────────────────┼──────────────┤
    │ fftResult[16] │ 0–255 (per channel) │ 16-band graphic EQ │ 🟡 Secondary │
    ├───────────────┼─────────────────────┼────────────────────────────────────────────┼──────────────┤
    │ samplePeak │ true/false │ Beat/peak detection │ 🟢 Optional │
    ├───────────────┼─────────────────────┼────────────────────────────────────────────┼──────────────┤
    │ soundAgc │ 0–3 │ AGC mode (for debugging) │ 🟢 Optional │
    └───────────────┴─────────────────────┴────────────────────────────────────────────┴──────────────┘

    (ignore the priority column)

  17. ewowi commented on Apr 11, 2026

    @ewowi

    @zackees In below video, the first 3 columns are low, mid, high : Okay

    The 5 yellow columns are volume (twice), major peak (freq), magnitude and normalizedBPM. You can see that the volume is not 0 when the music stops.
    (didn't look Into major peak, magnitude and bpm yet).

    IMG_2261.MOV

    Can you look why volume is not empty when no audio?

    Sidenode: there is flickering on esp32-s3, rmt as you can see in the video

  18. zackees commented on Apr 12, 2026

    @zackees
    MemberAuthor

    @ewowi I've created a dedicated issue for the volume-not-returning-to-zero problem you reported: #2253 — please continue the discussion there.

  19. added
    type: feature
    area: core
    status: triage
    on Apr 16, 2026
  20. zackees commented on Apr 18, 2026

    @zackees
    MemberAuthor

    Closing this long-running tracker. The audio-reactive pipeline has matured substantially since this was opened — Reactive/Vibe/Processor, noise floor tracking, signal conditioning, 20+ detectors, the silence-gate layer (#2253 just landed), plus the docs in src/fl/audio/README.md. Specific follow-ups should live in their own issues so they can be triaged, scoped, and closed independently. Re-open as necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: corestatus: triagetype: feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions