Skip to content

Feature/music reactive#612

Draft
sanialmccormick wants to merge 27 commits into
e-dream-ai:masterfrom
sanialmccormick:feature/music-reactive
Draft

Feature/music reactive#612
sanialmccormick wants to merge 27 commits into
e-dream-ai:masterfrom
sanialmccormick:feature/music-reactive

Conversation

@sanialmccormick

@sanialmccormick sanialmccormick commented May 8, 2026

Copy link
Copy Markdown
Contributor

Wires up the Windows client to the system audio output and uses it to drive playback — frame rate, dream cuts, and layer mixing.


What it does

WASAPI loopback captures whatever's playing on the default output device. No mic, no config — it just works. Samples are pushed
through an aubio phase vocoder each frame to get band energy (bass/mid/high), spectral centroid, kick/snare/transient detection,
and a BPM estimate.

Three systems consume that data:

  • FPS control — scales playback rate between a min and max FPS using a weighted blend of whichever band signals you want.
    Attack/release are independently configurable so it doesn't snap around.
  • Dream cuts — five trigger types (kick, snare, transient, beat interval, volume threshold), each with its own enable, threshold,
    and transition style. Global cooldown stops them stomping on each other.
  • Layer mixing — drives the blend between two dream sequences from any audio signal. IIR-smoothed so it doesn't jump.

Settings

Everything is exposed two ways — the Audio Reactive tab in Settings for persistence, and an F3 overlay panel for tweaking in real
time while the screensaver is running. All controls have tooltips.


Dependency

Vendored aubio (aubio/src/ only — docs, tests, Python bindings stripped out). Replaces KissFFT which has been removed. No install
needed, compiles straight into the MSVC project.

BPM uses a custom onset-flux autocorrelation estimator on top of aubio's beat events — raw aubio BPM was too unstable for driving
cuts reliably.


Bug fixes in this branch

  • F3 was falling through into skip-forward (missing return true)
  • F3 panel visibility desynced after F1/F2 dismissed it (stale static, now uses AudioPanelWin32_IsVisible())
  • Duplicate ImGui IDs on the two "Enable" checkboxes in the audio panel caused state rollback
  • Audio bars removed from the F2 dreamstats overlay (they belong on F3)

@sanialmccormick sanialmccormick force-pushed the feature/music-reactive branch from 787037f to 01b1722 Compare May 9, 2026 22:35
sanialmccormick and others added 19 commits May 9, 2026 23:44
…ng, mid/side kick detection, F3 sample count display, remove double smoothing from client.h
- Vendor aubio library as plain source (no submodule)
- Migrate audio analysis to aubio (pvoc + tempo, complex domain method)
- Custom onset-flux ACF BPM estimator with sub-harmonic reinforcement
- PLL-style beat phase sync using aubio confidence gating
- Settings tab: FPS weight checkboxes, tooltips on all controls, mix smoothness slider
- Audio panel (F3): matching weight checkboxes, tooltips, fix duplicate ImGui IDs
- Fix F3 keybind fall-through into skip-forward command
- Fix F3 panel state desyncing after F1/F2 dismiss (stale static -> IsVisible query)
- Remove audio bars from F2 dreamstats overlay
- Lower default band multipliers (bass 0.7, mid 0.8, high 0.7)
- Improve snare/kick separation threshold logic

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sanialmccormick sanialmccormick force-pushed the feature/music-reactive branch from 7fdfe56 to dcce7ac Compare May 9, 2026 22:46
sanialmccormick and others added 8 commits May 9, 2026 23:48
…ual exclusion fixes

- AudioAnalyzer: move all processing to dedicated background thread (std::thread +
  std::mutex + std::atomic) so beat/BPM tracking is decoupled from render stalls
- Beat counter: monotonic uint32_t atomic incremented on phase wraps; beat visualizer
  in F3 panel and overlay now derived from AudioAnalyzer_GetBeatCount() % 4
- 4-box beat visualizer in F3 panel (gold beat 1, blue-white beats 2-4) and overlay
- Hold-to-nudge Slow/Fast buttons auto-lock BPM and apply temporary ±5% offset while held
- Beat cut trigger: bar-aligned targetBarBeat pattern (always multiple of 4, fires on
  beat 1 only); N slider renamed Bars with updated tooltips
- Adaptive normalisation: gamma=2 power curve suppresses quiet-passage overshoot
- Audio settings loaded on startup (not deferred to first F3 open)
- Mutual exclusion: F3 closes settings dialog; settings closes audio panel — prevents
  dual-ImGui-context crash when both share the same HWND

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…cking

- Add BeatDetektor (two instances: 60-119 and 120-239 BPM) as primary BPM
  source; aubio onsets continue to correct beat phase
- BPM stability: proximity-weighted alpha (zero at >15% deviation) and
  octave-fold correction prevent bad frames yanking the estimate
- Kick/snare detection requires prior level to be low (attack from silence),
  suppressing false triggers from sustained bass/mid content
- Beat cuts: volume gate, bar-aligned trigger every N bars, catch-up snap
  so quiet sections do not cascade cuts when audio returns
- Bar counter in F3 overlay cycles 1/N..N/N and resets on Reset button
- Reset button zeros beat count so bar count restarts from 1
- Audio mix blend clip ticked each frame so second dream plays animated
  rather than freezing on its first frame

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ntext crash

Settings dialog and audio panel share the same HWND ImGui context.
F3 already dismissed settings before showing the audio panel, but the
reverse path (opening settings via tray/toggle while audio panel was
open) had no matching guard, causing an IM_ASSERT __debugbreak crash.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
These two files are referenced in electricsheep.vcxproj but were never
committed, causing build failures on clean checkouts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant