Repository navigation
Description
AnimartrixRing: replace time-warp-only audio response with a 3-state sound orchestrator
Summary
examples/AnimartrixRing/AnimartrixRing.ino is audio-reactive today, but only in the narrow sense that bass changes FxEngine speed.
That is visible, but it is not compelling on a ring.
The current interaction is effectively:
audio -> vibe.bass -> time warp
instead of:
audio -> classify sound environment -> choose visual behavior -> apply beat/energy/spectrum mapping
Relevant code:
examples/AnimartrixRing/AnimartrixRing.ino:139-159examples/AnimartrixRing/AnimartrixRing.ino:197-199src/fl/fx/fx_engine.cpp.hpp:96-145src/fl/audio/audio_processor.h:69-178
Problem
Time warp is a good accent, but it is weak as the entire audio model.
Current shortcomings:
- the same visual just runs faster or slower
- silence has no intentional visual state
- chaotic noise can still look "reactive" without feeling musical
- beat confidence is not separated from general energy
- bass dominates while mids, treble, spectrum, and rhythm structure are ignored
On a ring, this reads as "motion intensity" rather than "musical understanding."
Expected behavior
The top-level orchestrator should classify the sound environment into three states:
silencedisorganized_soundbpm_locked_sound
And each state should use a different visual strategy.
flowchart LR
A[Audio Input] --> B{Silent?}
B -- yes --> S[Silence]
B -- no --> C{Tempo stable and beat confidence high?}
C -- no --> D[Disorganized Sound]
C -- yes --> R[BPM Locked Sound]
S --> S1[Calm ambient visuals]
D --> D1[Energy and spectrum visuals]
R --> R1[Beat-synced ring visuals]
Audio expectations
On beat
- clear kick or validated beat should produce visible pulse events
- downbeats should feel larger than ordinary beats
- beat-locked visuals should not activate without rhythm confidence
On energy
- loudness should affect density, contrast, and brightness
- rising energy should feel different from falling energy
- non-rhythmic sound should still produce interesting visuals without pretending to be on-beat
Why FastLED already supports this
The detector surface is already there:
Silencecan define the idle stateEnergyAnalyzercan drive density and contrastEqualizerDetectorcan drive spectrum-texture behaviorVibecan provide self-normalizing band accentsTempoAnalyzerandMusicalBeatcan decide when BPM lock is trustworthyPercussioncan separate kick, snare, and hat accents
References:
src/fl/audio/detector/silence.hsrc/fl/audio/detector/equalizer.hsrc/fl/audio/detector/vibe.hsrc/fl/audio/detector/musical_beat_detector.h
Proposed redesign
State 1: silence
Use ambient visuals:
SLOW_FADEWATERPARAMETRIC_WATERFLUFFY_BLOBS
Behavior:
- low speed
- restrained brightness
- no hard flashes
- slow palette drift
State 2: disorganized_sound
Use energy and spectrum visuals:
RGB_BLOBS5WAVESPOLAR_WAVESCOMPLEX_KALEIDO
Behavior:
- bass changes size or radial pressure
- mids steer hue or rotation
- treble adds sparkle or edge activity
- equalizer bins shape sectors or texture
- time warp is allowed, but secondary
State 3: bpm_locked_sound
Use beat geometry:
RINGSCHASING_SPIRALSSPIRALUSCENTER_FIELD
Behavior:
- kick or validated beat emits ring pulses
- downbeat changes palette or phase
- snare adds contrasting flash
- hi-hat adds fine shimmer
- BPM sets pulse cadence, not just raw engine speed
Concrete ask
Please redesign AnimartrixRing so that:
- it classifies audio into
silence,disorganized_sound, andbpm_locked_sound - each class selects different Animartrix visual families
- beat, energy, and spectrum map to different visual dimensions
- time warp remains available, but stops being the primary behavior
- transitions use hysteresis and minimum dwell times so the state machine does not chatter
Example mapping bank
| Signal | State | Visual result |
|---|---|---|
isSilent() |
silence |
breathing ambient drift |
energy |
disorganized_sound |
density and contrast increase |
eq.bass |
disorganized_sound |
stronger radial expansion |
eq.mid |
disorganized_sound |
hue travel and rotation bias |
eq.treble |
disorganized_sound |
sparkle or edge glitter |
vibe.bassSpike |
bpm_locked_sound |
pulse ring emission |
kick |
bpm_locked_sound |
thick bright impact |
snare |
bpm_locked_sound |
secondary color hit |
downbeat |
bpm_locked_sound |
palette reset or major phase change |
measurePhase |
bpm_locked_sound |
smooth motion between beats |
Acceptance criteria
- silence looks intentional, not dead
- random noise does not fake beat sync
- stable BPM visibly locks the ring into a pulse grammar
- mids and treble matter, not just bass
- different songs produce different visual behavior, not just different speed
Context
Related: #2193 is the broader audio reactive enhancement thread.
This issue is narrower: AnimartrixRing specifically needs a stronger top-level orchestration model because "bass -> time warp" is not compelling enough as the core interaction.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
zackees commentedon Apr 15, 2026
Field report after reviewing the issue against MilkDrop, Winamp, Shadertoy, and the
fragcoord.xyzecosystem (I could not verifyfragcord.xyzlas a real host, so I am assuming that reference meantfragcoord.xyz).Executive take
The issue direction is correct, but the strongest precedent from mature audio-reactive systems is even more specific:
time-warp-onlyis almost never the core abstraction.The durable pattern is:
audio transport -> analysis bus -> preset/mapping layer -> visual compositionThe key gap in
AnimartrixRingis not missing audio input. It is missing the middle layer that turns audio into multiple visual controls.1. What MilkDrop actually does
MilkDrop is the clearest precedent for the current FastLED
Vibeapproach.Important patterns from the original preset authoring model:
bass,mid,treband alsobass_att,mid_att,treb_att.q1-q32.zoom,rot,warp,dx,dy,decay,gamma, and waveform parameters instead of reducing music to a single scalar.Why this matters here:
*_attvariables are especially important because they let the preset distinguish instantaneous energy from smoothed trend. That is how you get punch without noise chatter.FastLED already mirrors this idea in
Vibe: self-normalizedbass/mid/trebplus spike logic based on rising energy. The missed opportunity is thatAnimartrixRingonly uses that rich signal to callfxEngine.setSpeed(...).2. What Winamp got right at the platform level
The older Winamp visualization interface is simpler than MilkDrop, but it made one architectural decision that still matters:
The
vis.hinterface exposes bothspectrumData[2][576]andwaveformData[2][576]for stereo channels. That means the platform did not force plugins into one interpretation of audio. Scope, spectrum analyzer, AVS, and MilkDrop could all coexist because the host handed over broad audio state, not a single beat flag.Why this matters here:
AnimartrixRingshould behave more like a visualization module on top of an analysis bus.Processor,Equalizer,Vibe, tempo, percussion, silence, etc.3. What ShaderToy contributes
ShaderToy?s contribution is not "better beat detection." It is a better mental model for media-driven shaders:
iChannel0..3) with time and resolution metadatamainSound()returning stereovec2The official ShaderToy input/output docs show that sound sits in the same general interface as textures and buffers:
iChannelResolution,iChannelTime,iSampleRate,sampler2D iChannel{i}, and sound shaders output stereo viamainSound().The best community technical writeup on ShaderToy audio textures adds the practical detail:
Why this matters here:
disorganized_soundshould likely behave more like ShaderToy audio-texture usage: sample spectrum continuously and map it into sectors, edges, radial pressure, hue, and shimmerbpm_locked_soundcan then layer discrete beat grammar on top of that continuous field4. What
fragcoord.xyz/ Fragcolor addAssuming the intended reference was
fragcoord.xyz, the interesting lesson is not one specific audio algorithm but the authoring environment:fragcoord.xyzas adding infinite buffers, external textures, custom uniforms with GUI, includes, and stronger debug toolingDSP.FFT, which explicitly turns time-domain audio into frequency-domain dataWhy this matters here:
AnimartrixRingis not only more detectors; it is a better authorable mapping layer between detectors and visuals5. Common design patterns across all four systems
These systems keep converging on the same ideas:
Audio is multi-dimensional.
Continuous and discrete reactions are separated.
Visual identity is preserved across songs.
Feedback/decay layers are central.
There is always an authoring/mapping layer.
That is the main precedent backing this issue.
6. Implications for
AnimartrixRingThis suggests a more precise redesign target than the current issue text alone:
A. Keep the 3-state orchestrator
Still the right top level:
silencedisorganized_soundbpm_locked_soundB. Add a visual control bus
Instead of one scalar (
speed), derive a small stable set of control signals, for example:transport_speedradial_pressurerotation_biaspalette_driftsparkle_densitydecay_amountpulse_strengthsector_emphasis_lowsector_emphasis_midsector_emphasis_highThen let the orchestrator map detectors into that bus per state.
C. Use MilkDrop-style relative vs attenuated logic
Concrete recommendation:
vibe.bass - vibe.bass_attstyle deltas for beat punchvibe.mid/vibe.trebfor continuous texture changesD. Separate continuous fields from event triggers
Suggested split:
E. Do not force stock Animartrix to do all the work through time scaling
At the moment the sketch uses stock Animartrix and samples it onto the ring, but the Animartrix draw path itself is not consuming the richer
DrawContext::audiopath. That suggests two realistic implementation directions:Direction 2 is closer to how MilkDrop actually feels compelling.
7. Practical recommendations to add to this issue
I think the issue should implicitly aim for the following deliverables:
SoundClassstate machine with hysteresis and dwell timedisorganized_soundbpm_locked_soundIf this lands, the result should stop feeling like "the same preset at a different speed" and start feeling like an actual visualizer.
Sources
Primary / near-primary:
vis.h): https://getwacup.com/sdk/Winamp/vis.hUseful community technical references:
fragcoord.xyzmention): https://shadertoyunofficial.wordpress.com/2017/07/25/extending-shadertoy/Relevant repo context:
src/fl/audio/detector/vibe.hsrc/fl/audio/README.mdexamples/AnimartrixRing/AnimartrixRing.inozackees commentedon Apr 15, 2026
Concrete implementation plan for
AnimartrixRing.ino, based on the field report.Scope
Target: improve
examples/AnimartrixRing/AnimartrixRing.inowithout requiring a full FastLED audio architecture rewrite.The plan is staged so the first pass lands quickly and the later passes deepen the visual language.
Phase 1: add a sound-class state machine
Add a small orchestrator layer in the sketch or a helper pair such as:
examples/AnimartrixRing/audio_orchestrator.hexamples/AnimartrixRing/audio_orchestrator.cppCore types:
Classifier inputs should come from existing
ProcessorAPIs:isSilent()/getSilenceDuration()getTempoBPM()/getTempoConfidence()getBeatConfidence()isVibeBassSpike()and spike density over a short windowisKick()/isSnare()/isHiHat()getEqBass()/getEqMid()/getEqTreble()getEnergy()/getPeakLevel()State logic:
Silenceafter sustained silence with hysteresisBpmLockedSoundonly when tempo confidence and beat confidence stay high for a dwell windowDisorganizedSoundPhase 2: replace
bass -> speed onlywith a control busRight now the sketch effectively does:
vibe.bass -> fxEngine.setSpeed()That should become:
audio features -> VisualControlBusSoundClass + VisualControlBus -> visual policyRecommended bus derivation:
transportSpeed: base speed plus restrained contribution fromvibe.bass - vibe.bass_attradialPressure: mostly bass / low EQrotationBias: mid energy and maybe measure phase if availablepaletteDrift: mid + treble + temposparkleDensity: treble + hi-hat / treble-spike activitydecayAmount: inverse of energy in ambient mode, shorter on beat-locked modepulseStrength: kick / validated beat / downbeat layerThis is the most important change. It introduces the missing mapping layer that MilkDrop-style systems rely on.
Phase 3: assign visual families per state
Recommended stock Animartrix mapping for the first implementation:
SilencePrimary candidates:
SLOW_FADEWATERPARAMETRIC_WATERFLUFFY_BLOBSPolicy:
DisorganizedSoundPrimary candidates:
RGB_BLOBS5WAVESPOLAR_WAVESCOMPLEX_KALEIDOPolicy:
BpmLockedSoundPrimary candidates:
RINGSCHASING_SPIRALSSPIRALUSCENTER_FIELDPolicy:
Phase 4: add a ring-side overlay compositor
Before writing custom Animartrix viz, add a lightweight post-process overlay on the 1D ring output.
This can be done entirely in the sketch after
fxEngine.draw(...)and beforeFastLED.show().Suggested overlays:
Why this phase is valuable:
Phase 5: add custom audio-aware Animartrix hooks if needed
If stock animation selection + overlay still feels shallow, then use:
Animartrix::setVizFactory(...)Animartrix::setCustomViz(...)to build a small number of audio-aware ring-friendly variants.
Best first candidates:
RINGSCHASING_SPIRALSRGB_BLOBS5Those should consume the control bus directly rather than inferring everything from
ctx.now.Concrete file-level change list
First pass implementation should likely touch:
examples/AnimartrixRing/AnimartrixRing.inoexamples/AnimartrixRing/audio_reactive.{h,cpp}or replace it with a more explicit orchestrator helperexamples/AnimartrixRing/audio_orchestrator.{h,cpp}examples/AnimartrixRing/ring_overlay.{h,cpp}I would avoid touching core
src/fl/audio/*or coreAnimartrixin the first pass unless we prove a missing API.Suggested UI controls
Add a few explicit controls so the behavior is tunable:
Enable Audio OrchestratorSilence Hold MsBeat Lock ThresholdBeat Lock Hold MsPulse StrengthSparkle AmountOverlay BlendAuto Select Visuals Per StateThat will make the feature much easier to tune in the browser preview.
Acceptance targets for implementation
The first implementation should be considered successful if:
DisorganizedSoundBpmLockedSoundRecommended order of work
SoundClass+ hysteresis + dwell timingVisualControlBusRGB asset
Assuming "rgb data" meant the current Animartrix
RGB_BLOBS*source bundle, I zipped that set here:animartrix_rgb_blobs_bundle.zip: https://github.com/zackees/fastled-issue-assets/releases/download/issue-2256/animartrix_rgb_blobs_bundle.zipRelease page:
That zip currently contains:
src/fl/fx/2d/animartrix_detail/viz/rgb_blobs.hsrc/fl/fx/2d/animartrix_detail/viz/rgb_blobs.cpp.hppsrc/fl/fx/2d/animartrix_detail/viz/rgb_blobs2.hsrc/fl/fx/2d/animartrix_detail/viz/rgb_blobs2.cpp.hppsrc/fl/fx/2d/animartrix_detail/viz/rgb_blobs3.hsrc/fl/fx/2d/animartrix_detail/viz/rgb_blobs3.cpp.hppsrc/fl/fx/2d/animartrix_detail/viz/rgb_blobs4.hsrc/fl/fx/2d/animartrix_detail/viz/rgb_blobs4.cpp.hppsrc/fl/fx/2d/animartrix_detail/viz/rgb_blobs5.hsrc/fl/fx/2d/animartrix_detail/viz/rgb_blobs5.cpp.hppIf a different RGB asset was intended, say which one and I can swap the bundle.
zackees commentedon Apr 18, 2026
Expanded design: state machine, control bus, and overlay compositor
Follow-up to the earlier field report and phased plan. This comment fills in the parts that were still hand-wavy: exact transition rules, the bus derivation formulas, the overlay compositor, the available visual set verified against the actual
AnimartrixAnimenum, and a landable PR split.All APIs referenced are confirmed against the current tree (
src/fl/audio/audio_processor.h,src/fl/audio/detector/vibe.h,src/fl/fx/2d/animartrix.hpp,src/fl/fx/fx_engine.h,examples/AnimartrixRing/AnimartrixRing.ino).1. Verified animation set
AnimartrixAnimonly exposes one RGB-blob variant (RGB_BLOBS5) despite the asset zip containingrgb_blobs..rgb_blobs5. The reachable set is:Gotcha to flag in the PR that lands Phase 3: if we want
RGB_BLOBS / _2 / _3 / _4in rotation we have to extend the enum + registry table. Otherwise the disorganized-sound family is{RGB_BLOBS5, WAVES, POLAR_WAVES, COMPLEX_KALEIDO*}.2. State machine — precise definition
Transition diagram (guards evaluated per frame):
Rules:
minDwellMsapplies to every state, including re-entry. Guards the common pattern where tempo confidence oscillates around threshold.Driver signals (all already on
Processor):isSilent(),getSilenceDuration()getTempoConfidence(),getTempoBPM()getBeatConfidence(),getDownbeatConfidence()getMeasurePhase(),getCurrentBeatNumber()3. Visual control bus — derivation
The bus is the stable authoring surface. State changes which inputs feed which outputs; the consumers (Animartrix family + overlay) only read the bus, never the raw detectors. This is the MilkDrop "q1..q32" analogue — one intermediate layer so visuals don't churn every time the audio pipeline changes.
Derivation formulas (30 Hz target; all inputs from
Processorgetters):softKneeandenvFolloware ~10 lines each; no new dep.4. Per-state policy
transportSpeed0.8*bassPunch0.4*bassPunchradialPressurelowBandweightedpaletteDriftsparkleDensitydecayAmountpulseStrengthCross-fade: when
Animartrix::fxSet(...)switches (either on family change or on family rotation), blend over 800 ms in ambient / disorganized, snap on downbeat in BpmLocked.5. Overlay compositor
Runs after
fxEngine.draw(millis(), leds)and beforeFastLED.show(). No core changes; purely post-process on the 1D ring.Four lightweight passes:
trail[i] = scale8(trail[i], 255*(1-decayAmount)) + leds[i]>>2; blend back ontoleds. Gives the feedback echo that makes beats feel musical.pulseStrength > 0, paint an expanding Gaussian band that starts at the "12 o'clock" index (configurable origin) and widensk*elapsedpixels. Downbeats use a wider band + palette flip.{lowBand, midBand, highBand}*k. Disorganized-only; off in the other two states. Makes the three frequency bands audibly localized on the physical ring.sparkleDensity * dt. Ring-side only; doesn't touch Animartrix internals.Each pass is opt-in via UI (see §7) so the user can disable any layer without recompiling.
6. File-level diff plan
No changes to
src/fl/audio/*orsrc/fl/fx/2d/animartrix*in Phase 1–4. Custom audio-aware vizzes (Phase 5) get their own follow-up issue.7. UI schema
All controls use existing
fl::UICheckbox/fl::UISlider/fl::UIDropdown— no new UI primitives.8. Landable PR split
Each PR is independently mergeable and demonstrably better than master.
SoundClass+ classifier + "Manual Sound Class" override. Doesn't yet affect visuals; just prints transitions to Serial. Demo: silence → clap → noise → music — transitions log out.bass→speedwithbus.transportSpeedderivation. Behavior equivalent to legacy, but routed through the bus. Demo: flip Enable Orchestrator off/on — visuals identical.9. Test / validation harness
The sketch is hard to test end-to-end, but we can verify the classifier and bus in the existing C++ test framework without hardware.
Manual acceptance (matches §8 of the issue body):
Silencewithin ~1.2 s; output is dim and breathing, not frozen.Disorganized— never false-locks.10. Risks / non-goals
Animartrixinternals. All audio-awareness lives in the sketch layer; Animartrix stays a time-driven viz.Processoris mono today and that's fine for a ring.TempoAnalyzerneeds multiple beats to warm up.lockEnterMs=2500respects this; don't shorten it below ~2 s.NUM_LEDS*3bytes. Document in comments.Enable Vibe Reactiveon shouldn't regress. Orchestrator is opt-in until PR-E lands; then it becomes the default with a "Legacy Mode" escape hatch.zackees commentedon Apr 18, 2026
Progressive WASM + Playwright test plan
Follow-up to the expanded design. The goal here is concrete: a per-PR test gate so compile and runtime errors surface one at a time as the orchestrator is built up, and each PR is blocked from landing until its gate is green.
Why this works
Two existing pieces do almost everything we need:
fastledCLI —fastled examples/AnimartrixRingcompiles the sketch to WASM, serves it over HTTP, and prints the port a browser can attach to. Flags we actually use:--just-compile(no browser; Gate C),--serve-dir fastled_js(serve an already-built tree; all later gates),--no-interactive(CI-safe),--debug(instrumentation build).ci/wasm_audio_drag_drop_test.py— the existing Playwright harness:--autoplay-policy=no-user-gesture-requiredScriptProcessor(Playwright doesn't driveAudioWorklet)Vibe:,AnimartrixRing:,BASS SPIKE, etc.globalThis.fastLEDFrameCountfor livenessThe new work is a thin progressive driver that calls
fastledfor the compile+serve side and re-uses the Playwright harness for the browser side. No bespoke HTTP server, no custom compile wrapper — the existing tools already cover it.1. Gate pyramid — compile errors surface first, then runtime, then behavior
Each PR graduates through a pyramid of gates. The test harness short-circuits at the first failing gate so the fix loop is tight.
Each gate is a ~30-150 line Python function. They stack: running a higher gate implicitly runs every gate below it.
Gate C — Compile
extract_first_errorparsesclang++output and returns the first error only, with the file path clipped to repo-relative, and all subsequent errors dropped. This is the part that makes "fix compile errors one at a time" actually pleasant: the output is one error, one file, one line — not 2000 lines of cascade.The gate caches by source hash: if
examples/AnimartrixRing/hasn't changed since the last green build, skipfastledand reusefastled_js/. Cuts the inner loop from ~60s to ~2s when iterating Python-side.Gate R — Runtime
Serve the already-built tree with
fastled --serve-dirin a background process, parse the printed port, point Playwright at it:Then:
fastLEDFrameCount > 0within 10spage.on("pageerror")— zero errors requiredwindow._workerErrors— zero requiredsetup completelog firedOutput: per-error stack traces with
scripts/wasm_symbolicate.pydecode so crashes point at real C++ files, not WASM offsets.One
fastled --serve-dirprocess is spun up once per test run and re-used across gates — Playwright just opens fresh pages against the same server. That amortizes the ~2s serve-bootstrap cost.Gate U — UI controls rendered
Reads the DOM and asserts the orchestrator's UI elements exist:
This catches silently-removed
fl::UISliderdeclarations, typos in control names, and wiring regressions.Gate S — State machine
Requires the sketch to emit one-line JSON log events in a debug build:
Playwright collects them:
Then the gate runs one canned audio fixture at a time and asserts the timeline. Example:
Gate B — Control bus
Same JSON channel, different key:
Gate assertions are boring but effective:
Gate V — Visual
Expose a peek helper in the WASM frontend JS (already the pattern for
fastLEDFrameCount):Gate compares the buffer across states:
No golden-image comparison — just "visuals actually differ." Goldens rot; difference-over-threshold doesn't.
Gate E — Event-driven pulse
Needs temporal correlation. Metronome at 120 BPM → a kick every 500ms → pulse should land within ±50ms.
2. Per-PR gate matrix
Each PR lands with a test target that calls exactly the gates it should satisfy. Higher PRs subsume lower-PR gates so regressions are caught immediately.
Command surface:
Wire the highest-PR gate as
bash test animartrix_ring_e2ein CI. Local dev runs--stage pr-Xfor whatever they're building.3. Deterministic audio fixtures
No user-supplied MP3. Generate WAVs at test time from Python so the tests are reproducible on any machine:
generate_fixtures.pyis tiny (~60 lines of numpy). These ship with the test; no binary assets in the repo until they're a problem. Output lives underci/animartrix_ring/fixtures/cache/and is gitignored; generator runs on first invocation.The existing harness's
page.route("**/SoundHelix*", handle_soundhelix)pattern intercepts the fetch and serves the generated bytes — same mechanism, different source.For fixtures that need precise timing (metronome), the generator puts a synchronized marker channel in the log (
FL_TEST: {"k":"fixture","click_at_ms":[500,1000,1500,...]}) that Gate E uses as ground truth.4. Instrumentation contract
The sketch is
#if FL_TEST_INSTRUMENT-guarded. The macro is defined only in a debug build produced byfastled examples/AnimartrixRing --just-compile --debugwithFL_TEST_INSTRUMENT=1in the sketch's build defines. Prod / quick builds pay zero cost.Stable JSON shape so parsers don't drift:
One-line JSON is chosen over binary for two reasons: (a) the existing harness already tails console logs, (b) when a test fails the log excerpt is human-readable in the PR comment.
5. The fix loop
What this buys when implementing PR-B (the visual control bus):
Fix, re-run:
Fix, re-run:
That's the entire dev loop. Each run surfaces one actionable failure with a file pointer. You don't need to read 2000 lines of clang output or a wall of async-stack traces — the gate printed the single sentence that matters.
6. File layout
harness.pyre-uses ~70% of the existing Playwright code — browser launch,add_init_scriptaudio-worklet disable, console-log routing, and worker-error monitoring. The HTTP server layer is replaced by afastled --serve-dirsubprocess with port auto-discovery. New code is focused on orchestration and JSON parsing, not plumbing.7. CI integration
One job per stage, running in parallel:
Until a PR lands, stages beyond its scope are allowed to fail — the matrix job is marked
continue-on-error: truefor stages above the current HEAD's implemented level. As PRs merge, the gate they satisfy flips to required.This creates a forcing function: PR-D's gate includes Gate V, so PR-D cannot merge if its visuals regress per-state behavior. PR-E's gate adds Gate E, so pulse timing is enforced the moment the feature lands, not "someday."
8. Non-goals
tests/test_sound_classifier.cpp/tests/test_visual_control_bus.cpp. Those run in host builds, are millisecond-fast, and catch pure-logic regressions. This Playwright suite is the end-to-end contract; the C++ tests are the classifier/bus contract.bash profile.zackees commentedon Apr 18, 2026
Product framing: The "Mood Ring" — a lighting toy that senses the room
Reframing this thread.
AnimartrixRingisn't the goal; it's one of two visual engines inside a lighting toy that senses the room it's in and paints a light response to the room's mood. The WASM demo is where patches get composed, and the best ones get promoted to firmware presets on a shippable device.The input isn't "music." The input is the room — whatever it sounds like. Music, yes. But also: conversation, silence, laughter, a vacuum cleaner running, a thunderstorm outside, a dog barking, someone cooking. The toy's identity is that it notices what the room is doing and lights back accordingly, not that it drops beats.
This comment pins down: product scope, engine abstraction, mood→visual mapping, the playground UX, the patch/preset/product promotion flow, and the test additions needed to keep the whole thing honest.
1. Product vision — one sentence
A 244-LED ring that listens to the room and lights the room back.
Input: ambient mic, passively listening. Output: a ring of light whose motion, color, density, and pulse reflect the sound environment the ring is in — not a light show you drive, but a companion that reads the room's mood.
Concrete rooms it should feel good in:
No buttons, no app required, no WiFi required. Optional BLE for patch uploading from a phone.
The room is the instrument. The toy is the listener.
2. Input hierarchy — four layers, three already built
Already shipped: the bottom two layers.
MoodAnalyzergives usvalence ∈ [-1,1]andarousal ∈ [0,1]with a 4-quadrant category (calm_positive,calm_negative,energetic_positive,energetic_negative+ neutral). That's the product's emotional axis.New work: the orchestrator and the engine abstraction. Everything in the prior designs still applies — it just gets a second consumer (NoiseRing) and a new input (Mood).
3. Two engines behind one bus
The
VisualControlBusfrom the prior design maps naturally to both the Animartrix FxEngine andfill_2dnoise16parameters (fromexamples/NoisePlayground/). That means a single patch format can drive either engine:transportSpeedFxEngine::setSpeedtime_speedradialPressurexscale/yscaleinverserotationBiasx_speed/y_speeddeltapaletteDrifthue_timespeedsparkleDensitydecayAmountlowBand/mid/highpulseStrengthThe overlay compositor is engine-agnostic — it runs on the 1D ring buffer after the engine writes it. So trails, pulse, sector, sparkle cost one implementation, not two.
Engine switch policy. The orchestrator picks the engine based on mood quadrant (§4), or honors a manual override in the playground. Cross-fade on switch (~800 ms), not hard cut.
4. Mood quadrant → visual identity
The 4-quadrant map turns
MoodAnalyzerinto a design surface. Each quadrant gets a visual identity — engine choice, palette family, motion character — that's unmistakably different from its neighbors.Mood is smoothed with hysteresis already (
setMinDuration(ms)onMoodAnalyzer), so this won't flip-flop. A mood transition triggers the same 800 ms cross-fade as an engine switch.Important product constraint. Mood bias is a preference, not a hard switch. The
SoundClassstate machine from the prior design still decides silence vs disorganized vs bpm-locked. Mood only biases which visuals are used for each class. Silence still means silence.5. WASM playground — compose, compare, share
The playground is a web page that:
VisualControlBusas sliders, all 10 signalsThis sits on top of infrastructure that already exists:
src/platforms/wasm/compiler/modules/audio/audio_manager.tsalready has a mic button wired throughgetUserMedia+createMediaStreamSource, feeding the sameProcessorthe drag-drop path uses. No new JS. The sketch side just usesaudio.audioInput()exactly likeAnimartrixRing.inodoes today.fl::UISlider,fl::UICheckbox,fl::UIDropdown,fl::UIAudioalready render to the browser DOM.globalThis.fastLEDFrameCountand the LED buffer exposure are already in place from the audio-test harness.What's new on the playground side is a small set of UI affordances, not a new framework:
6. Patch / preset / product — three tiers of permanence
Patch schema
One JSON object, encoded base64 into
?patch=...on the playground URL:{ "v": 1, "engine": "animartrix", "anim_manual": null, "classifier": { "silenceEnterMs": 1200, "lockEnterMs": 2500, "tempoConfEnter": 0.65, "minDwellMs": 1500 }, "bus_gains": { "speedGain": 1.5, "paletteDriftGain": 1.0, "radialGain": 1.0, "sparkleGain": 0.8 }, "overlay": { "trails": true, "pulse": true, "sector": true, "sparkle": true, "pulseOriginOffset": 0 }, "mood_bias": { "calm_positive": {"engine": "noise", "palette": "warm_pastel"}, "calm_negative": {"engine": "animartrix", "palette": "cool_muted", "anim_hints": ["WATER","SLOW_FADE"]}, "energetic_positive":{"engine": "animartrix", "palette": "warm_vivid", "anim_hints": ["RINGS","SPIRALUS"]}, "energetic_negative":{"engine": "noise", "palette": "cold_sat"} } }Preset — promotion
"Promote to preset" button serializes the patch as a
constexprC++ header:Then it's code-reviewed and merged like any other C++ change. Presets are hand-curated; the playground is where they're discovered.
Product — shipping
Hardware envelope for the "great little product" end of the road:
NUM_LEDS)PatchJSON, device stores in NVS, survives rebootFirmware ships with 4-8 curated presets + an
autopreset that uses the mood quadrant to pick from the curated set. The playground is the R&D lab that produces those presets.7. Demo showstoppers — what makes the WASM playground memorable
Ordered by "wow" per line of code:
Animartrix ⇄ Noise— smooth 800 ms blend, not a pop. This sells the "one bus, two engines" abstraction on one click.?patch=...&compare=...→ two rings side-by-side, same mic, different patches. Instant demo of patch authoring.Each of these is a distinct acceptance criterion, and they tie back to specific progressive-test gates (see §8).
8. Additions to the progressive test plan
The earlier testing plan (Gates C/R/U/S/B/V/E) covers the orchestrator. The product framing adds three gates:
Gate M — Mood
This is the gate that validates
MoodAnalyzeris actually distinguishing quadrants in our sketch — not just in its unit tests.Gate P — Patch round-trip
No runtime behavior check — just that the URL-encoded patch deserializes into the live state identically. Catches schema drift at merge time.
Gate L — Live mic path
Chromium supports
--use-file-for-fake-audio-capture=<path>. Playwright sets it at browser launch; Chromium'sgetUserMediathen returns a stream that plays the WAV we generated. This exercises the entire mic pipeline end-to-end without needing a physical mic:This is the gate that certifies the product's primary input path works in WASM — and by extension, the mic-driven firmware path will too (same
Processor, same bus).Updated per-PR gate matrix
Each PR lands one capability, passes its row, and the next PR builds on green.
9. File layout — what ends up in the tree
MoodRingis the product sketch;AnimartrixRingstays as the narrow-scope example. That way anyone wanting to understand "just Animartrix on a ring" has the simple version, and the product work happens in its own dir without entangling the example.No
src/fl/*changes for PR-A through PR-G. PR-H (patch schema) adds a smallsrc/fl/mood_ring/patch.honly if the schema ends up being generally useful beyond this sketch.10. Roadmap — playground to product
Three milestones, tied to the PR plan:
M2 is the deliverable that makes this issue compelling to other people, not just to us. If a user lands on a URL, grants mic, and within 5 seconds sees a ring visibly responding to the room they're in — that's the shareable artifact. The product follows naturally from the patches that playground produces.
11. What this doesn't promise
MoodAnalyzeris feature-based (spectral centroid + rolloff + flux + energy), not a neural model. That's a feature: runs in real-time on ESP32 with bounded memory, no cloud inference.[-]AnimartrixRing: replace time-warp-only audio response with a 3-state sound orchestrator[/-][+]MoodRing: room-sensing lighting toy — AnimartrixRing + NoiseRing engines, mood-aware orchestrator[/+]zackees commentedon Aug 17, 2026
Three corrections to this design, now that #3884 and #3886 have landed work against it. Flagging rather than editing in place so the history stays readable.
1. §9 / §6 target the wrong directory. Both file plans put the orchestrator, control bus and overlay in
examples/AnimartrixRing/. As of #3884 that work lives inexamples/MoodRing/; AnimartrixRing was reduced to a pure Animartrix-sampling demo with no audio at all.This also supersedes §9's "
examples/AnimartrixRing/stays as-is; legacy, unchanged". Per maintainer direction the audio left AnimartrixRing entirely rather than being duplicated across both sketches — the technique demo stays minimal, the product sketch grows.2. §6's "
audio_reactive.h / .cpp(KEEP: legacy path, gated by UI toggle)" is obsolete. Those files are deleted. #2809 superseded that path with the orchestrator and #3884 removed the dead code. §7's "Enable Sound Orchestrator — default off, preserves legacy path" follows: there is no legacy path, and MoodRing defaults the orchestrator on. A room-sensing toy that boots deaf is not the product.3. §1's enum gotcha is stale. It warns that only
RGB_BLOBS5is reachable and that rotatingRGB_BLOBS/_2/_3/_4requires extending the enum plus the registry table.AnimartrixAnimnow carries all five (src/fl/fx/2d/animartrix.hpp:33-37), so that work is already done. Worth striking so nobody repeats it.Progress against the PR split:
#3885 carries the detailed design for the #3886 increment, including the derivation formulas and why
max(0, vibeBass - vibeBassAtt)is the signal that keeps loudness from faking a beat.refactor(examples): split MoodRing out of AnimartrixRing
zackees commentedon Aug 20, 2026
Marking this umbrella roadmap deferred after a current-master audit. Merged PRs #2809, #3884, and #3886 delivered the classifier, MoodRing split, VisualControlBus, trails, and pulse rings, but the issue still spans multiple independent product phases: sector/sparkle consumers, mood-quadrant routing, a second NoiseRing engine with cross-fade, serialization/presets, and playground work. This is not one bounded burn-down change; the existing implementation remains usable while those roadmap phases await separate scope.