Skip to content

Add Audio Stems panel with alt-audio-tracks integration and HTDemucs persistence#6255

Open
o0charlie0o wants to merge 1 commit into
xLightsSequencer:masterfrom
o0charlie0o:feature/audio-stems-panel
Open

Add Audio Stems panel with alt-audio-tracks integration and HTDemucs persistence#6255
o0charlie0o wants to merge 1 commit into
xLightsSequencer:masterfrom
o0charlie0o:feature/audio-stems-panel

Conversation

@o0charlie0o

@o0charlie0o o0charlie0o commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a collapsible Audio Stems panel below the main waveform with per-stem mini-waveforms, a DAW-style S (solo) button per row, drag-reorder/rename/recolor, and a Create Timing Track from Transients... action backed by aubio's spectral-flux peak picker.

The panel is a 1:1 view over SequenceFile::alt_tracks — so it works alongside the existing alt-audio-tracks feature, not as a replacement. Stems added through the Sequence Settings → Alt Audio Tracks tab show up in this panel automatically, and stems imported through the panel become alt tracks visible to VU Meter / Value Curve bindings just like ones added the existing way.

The panel works with stems from two sources:

  • Imported stems — any audio prepared outside xLights (DAW exports, online stem splitters, hand-rendered tracks). Pulled in via the panel's Import action or the existing Sequence Settings alt-tracks tab.
  • AI-generated stems (macOS) — produced in-app by HTDemucs via the right-click waveform "Stem — Drums/Bass/Vocals/Other" submenu. The result is written to <showdir>/audio-stems/<sequence-name>/ and registered as alt tracks, so re-running on the same sequence is an instant cache hit instead of another inference pass.

The transient-detection dialog renders transient markers directly on the stem's waveform, so as you adjust threshold / silence / minimum-interval the marker positions update live and you can see what each setting change is doing. xLights already has a similar "Audio Onsets" path for the main waveform; this implementation is more parameterized and gives the visual marker feedback while you're tuning. Both are kept — the new flow is offered specifically from the per-stem context.

A demo video showing the full flow (panel toggle, import, S-solo, transient detection with live markers, save/reopen) is below.

Companion submodule PR

The aubio sources need to be added to the macOS Xcode project. That's in xLightsSequencer/xLights-macOS#8. Please merge that one first so the gitlink in this PR lands on a published main commit.

Tested on

  • macOS only (M1 Max, Xcode 26.4, Debug + Release).
  • Windows and Linux build files (Xlights.vcxproj, Xlights.vcxproj.filters, xLights.cbp) have been updated with the new sources and aubio's include path, but those builds have not been exercised on this branch — happy to iterate if anything's missing there.

Happy to discuss anything in this PR — implementation choices, scope, naming, alternatives, etc.

Test plan

  • View → Windows → Audio Stems toggles the panel.
  • Right-click in panel → Import Stem Files: stem appears as a row and as an alt track (visible in right-click waveform → Audio Track submenu).
  • Stems added via Sequence Settings → Alt Audio Tracks show up in the panel.
  • Right-click stem row → Rename / Change Color: persists across save/reopen.
  • Drag-reorder rows: persists.
  • Right-click stem row → Create Timing Track from Transients...: dialog shows transient markers on the stem waveform that update as parameters change; OK creates a timing track.
  • Right-click main waveform → Stem — Drums (macOS): HTDemucs runs once, four rows appear in panel, S button toggles playback.
  • Save, close, reopen: stems return; right-click → Stem — Drums is instant (cached alt track).
  • Right-click waveform → Raw waveform while a stem is active: returns to Main song, not just raw of the stem file.
  • Live playback: hit play, click an S button — audio jumps to that stem at the same position, no stop/replay.
  • Drop a VU Meter effect: alt-track selector lists Drums/Bass/Vocals/Other (proves alt_tracks integration is wired).
  • Closing the sequence clears the panel.

Demo Video

Stems.mp4

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an Audio Stems UI panel to the sequencer that mirrors SequenceFile::alt_tracks, including per-stem mini-waveforms, solo switching, import/rename/recolor/reorder, and a stem-based transient/onset → timing track workflow using aubio; also adds persistence helpers for HTDemucs-generated stems.

Changes:

  • Introduces StemsPanel, StemWaveform, and StemOnsetDialog UI components and wires them into the main sequencer layout + View menu toggle.
  • Extends alternate-audio-track support with SequenceFile::MoveAltTrack and stem panel synchronization on load/close.
  • Vendors a minimal aubio source subset and adds a WavWriter utility for writing cached stem WAVs.

Reviewed changes

Copilot reviewed 68 out of 68 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
xLights/xLights.cbp Adds aubio include path + new stems/onset/wav-writer sources to Code::Blocks project.
xLights/Xlights.vcxproj Adds new stems/onset/wav-writer + aubio C sources to the Windows build.
xLights/Xlights.vcxproj.filters Adds VS filters and assigns new sources (including aubio) to filter groups.
src-ui-wx/xLightsMain.h Declares new View-menu handler/IDs for the stems panel toggle.
src-ui-wx/xLightsMain.cpp Adds “Audio Stems” checkable menu item + wiring and updates play-marker propagation.
src-ui-wx/wxsmith/xLightsframe.wxs Adds wxSmith menu item definition + handler for “Audio Stems”.
src-ui-wx/sequencer/tabSequencer.cpp Initializes stems panel timeline wiring and refreshes stems from alt-tracks on sequence load; updates play loop marker updates; implements toggle handler.
src-ui-wx/sequencer/Waveform.h Exposes SetActiveAudioTrack publicly for solo switching; adds deferred-init state fields.
src-ui-wx/sequencer/MainSequencer.h Adds StemsPanel member + accessor; stores main sizer pointer.
src-ui-wx/sequencer/MainSequencer.cpp Integrates stems panel into sequencer layout and propagates timeline zoom/scroll changes to stems.
src-ui-wx/sequencer/RowHeading.cpp Propagates row-heading width changes to stems header width.
src-ui-wx/import_export/SeqFileUtilities.cpp Clears stems UI rows on sequence close to avoid stale rows across sequences.
src-ui-wx/sequencer/StemsPanel.h Declares stems panel API (rows, import, solo, reorder, persistence hooks, scrolling/visibility).
src-ui-wx/sequencer/StemsPanel.cpp Implements stems panel UI, alt-track synchronization, solo switching, drag-reorder, import, and context actions.
src-ui-wx/sequencer/StemWaveform.h Declares per-stem waveform renderer with onset marker overlay support.
src-ui-wx/sequencer/StemWaveform.cpp Implements per-stem waveform rendering, interaction, and preview marker drawing.
src-ui-wx/StemOnsetDialog.h Declares onset/transient detection dialog + parameter UI and detection pipeline.
src-ui-wx/StemOnsetDialog.cpp Implements aubio-backed onset detection + live marker preview + timing-track creation flow.
src-core/utils/WavWriter.h Declares float-stereo WAV writer used for persistent stem caching.
src-core/utils/WavWriter.cpp Implements WAV writing for cached stem output.
src-core/render/SequenceFile.h Adds MoveAltTrack declaration to support reordering.
src-core/render/SequenceFile.cpp Implements MoveAltTrack and updates ValueCurve alt-audio mapping after reorder.
dependencies/aubio/src/config.h Adds aubio build configuration header used by vendored aubio sources.
dependencies/aubio/src/aubio_priv.h Adds aubio private header (adapted to always include local config).
dependencies/aubio/src/aubio.h Adds aubio umbrella header (not currently included by xLights code).
dependencies/aubio/src/types.h Adds aubio core typedefs.
dependencies/aubio/src/fvec.h Adds aubio real-vector API header.
dependencies/aubio/src/fvec.c Adds aubio real-vector implementation.
dependencies/aubio/src/cvec.h Adds aubio complex-vector API header.
dependencies/aubio/src/cvec.c Adds aubio complex-vector implementation.
dependencies/aubio/src/lvec.h Adds aubio double-precision vector API header.
dependencies/aubio/src/lvec.c Adds aubio double-precision vector implementation.
dependencies/aubio/src/fmat.h Adds aubio matrix API header.
dependencies/aubio/src/fmat.c Adds aubio matrix implementation.
dependencies/aubio/src/musicutils.h Adds aubio music utility API header.
dependencies/aubio/src/musicutils.c Adds aubio music utility implementation.
dependencies/aubio/src/vecutils.h Adds aubio vector utility API header.
dependencies/aubio/src/vecutils.c Adds aubio vector utility implementation.
dependencies/aubio/src/mathutils.h Adds aubio math utility API header.
dependencies/aubio/src/mathutils.c Adds aubio math utility implementation.
dependencies/aubio/src/onset/peakpicker.h Adds aubio peak picker API.
dependencies/aubio/src/onset/peakpicker.c Adds aubio peak picker implementation.
dependencies/aubio/src/onset/onset.h Adds aubio onset detection API.
dependencies/aubio/src/onset/onset.c Adds aubio onset detection implementation.
dependencies/aubio/src/spectral/awhitening.h Adds aubio spectral whitening API.
dependencies/aubio/src/spectral/awhitening.c Adds aubio spectral whitening implementation.
dependencies/aubio/src/spectral/fft.h Adds aubio FFT API header.
dependencies/aubio/src/spectral/fft.c Adds aubio FFT implementation (compiled via project files).
dependencies/aubio/src/spectral/ooura_fft8g.c Adds aubio Ooura FFT backend (compiled via project files).
dependencies/aubio/src/spectral/phasevoc.h Adds aubio phase vocoder API header.
dependencies/aubio/src/spectral/phasevoc.c Adds aubio phase vocoder implementation.
dependencies/aubio/src/spectral/specdesc.h Adds aubio spectral descriptor API header.
dependencies/aubio/src/spectral/specdesc.c Adds aubio spectral descriptor implementation (compiled via project files).
dependencies/aubio/src/spectral/statistics.c Adds aubio spectral statistics implementation.
dependencies/aubio/src/temporal/filter.h Adds aubio IIR filter API header.
dependencies/aubio/src/temporal/filter.c Adds aubio IIR filter implementation.
dependencies/aubio/src/temporal/biquad.h Adds aubio biquad API header.
dependencies/aubio/src/temporal/biquad.c Adds aubio biquad implementation.
dependencies/aubio/src/utils/log.h Adds aubio logging API header.
dependencies/aubio/src/utils/log.c Adds aubio logging implementation.
dependencies/aubio/src/utils/hist.h Adds aubio histogram API header.
dependencies/aubio/src/utils/hist.c Adds aubio histogram implementation.
dependencies/aubio/src/utils/scale.h Adds aubio scaling API header.
dependencies/aubio/src/utils/scale.c Adds aubio scaling implementation.
README.txt Adds release note entry describing the Audio Stems panel feature set.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src-core/render/SequenceFile.cpp
Comment thread src-core/utils/WavWriter.cpp
Comment thread src-core/render/SequenceFile.cpp
@o0charlie0o o0charlie0o force-pushed the feature/audio-stems-panel branch from d990371 to ccb684d Compare April 28, 2026 22:22
@o0charlie0o o0charlie0o marked this pull request as ready for review April 28, 2026 22:23
Copilot AI review requested due to automatic review settings April 28, 2026 22:23
@o0charlie0o o0charlie0o force-pushed the feature/audio-stems-panel branch from ccb684d to fe616b3 Compare April 28, 2026 22:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 68 out of 68 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@o0charlie0o o0charlie0o force-pushed the feature/audio-stems-panel branch from fe616b3 to d13affc Compare April 28, 2026 22:30
Copilot AI review requested due to automatic review settings April 28, 2026 22:40
@o0charlie0o o0charlie0o force-pushed the feature/audio-stems-panel branch from d13affc to 81f9ad8 Compare April 28, 2026 22:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 68 out of 68 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@o0charlie0o o0charlie0o force-pushed the feature/audio-stems-panel branch 2 times, most recently from b43491c to ad3163b Compare April 28, 2026 22:53
Copilot AI review requested due to automatic review settings April 28, 2026 22:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 68 out of 68 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src-ui-wx/StemOnsetDialog.cpp Outdated
Comment thread src-ui-wx/sequencer/StemsPanel.cpp
Comment thread dependencies/aubio/src/config.h
Comment thread src-ui-wx/sequencer/Waveform.cpp
Comment thread src-ui-wx/sequencer/StemsPanel.cpp Outdated
Comment thread src-ui-wx/sequencer/StemsPanel.cpp
Comment thread src-ui-wx/sequencer/StemsPanel.cpp
Comment thread src-ui-wx/sequencer/StemWaveform.cpp Outdated
Comment thread src-ui-wx/sequencer/StemWaveform.cpp
@o0charlie0o o0charlie0o force-pushed the feature/audio-stems-panel branch from ad3163b to 677a1a9 Compare April 28, 2026 23:03
Copilot AI review requested due to automatic review settings April 28, 2026 23:03
@o0charlie0o o0charlie0o force-pushed the feature/audio-stems-panel branch from 677a1a9 to 79486ae Compare April 28, 2026 23:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 68 out of 68 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src-ui-wx/sequencer/Waveform.h
Comment thread src-core/utils/WavWriter.cpp
…persistence

Adds a collapsible stems panel below the main waveform with per-stem
mini-waveforms that mirror SequenceFile::alt_tracks 1:1. The panel works
with stems from two sources:

  - Imported stems: any audio files prepared outside xLights (e.g. from
    a DAW, an online stem splitter, or hand-rendered tracks). Pulled in
    via the panel's Import action or the Sequence Settings alt-tracks tab.
  - AI-generated stems: produced in-app by HTDemucs via the right-click
    waveform "Stem — Drums/Bass/Vocals/Other" submenu. The result is
    written to <showdir>/audio-stems/<sequence-name>/ and registered as
    alt tracks, so re-running on the same sequence is an instant cache
    hit instead of another inference pass.

Each row supports rename, recolor, drag-reorder, and a DAW-style "S"
(solo) button that switches main playback to that stem at the current
play position. Right-click on a row offers "Create Timing Track from
Transients..." which generates a timing track from stem onsets via
aubio's spectral-flux peak picker.

Stems imported via the panel and alt tracks added through Sequence
Settings stay in sync — both show in the panel and are visible to VU
Meter and Value Curve bindings.
@o0charlie0o o0charlie0o force-pushed the feature/audio-stems-panel branch from 79486ae to 48f7fd6 Compare April 28, 2026 23:12
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.

2 participants