feat: detect and slice audio attacks atomically and qualify sample editor workflows

This commit is contained in:
Johannes Findeisen 2026-11-06 01:16:39 +01:00
commit 9e380d4dd0
20 changed files with 257 additions and 22 deletions

View file

@ -49,3 +49,25 @@ Select audible bounds finds the first and last sample strictly above the chosen
## Phase 78
Snap to zero crossings searches each selected boundary within a source-frame radius up to 65,536. It uses the mono source, chooses earlier positions on equal distance and changes both endpoints only if both searches yield a nonempty range. Source edges qualify only when their adjacent sample is zero. This can reduce boundary discontinuities but does not guarantee click-free output; musical-tick trimming/slicing can move a boundary away from the exact crossing.
## Phase 79
Detect attacks uses absolute sample amplitude, an initial armed state, rearming below one quarter of the threshold and a minimum frame gap between retained attacks. It marks up to 128 source positions in orange; hovering the statistics shows exact frame indices. This is a threshold detector, not spectral onset detection, beat detection or tempo estimation. Selection/processing changes invalidate the markers. Slice clip at attacks splits the current clip reference at those positions in one project undo step and closes the editor. Edits in the local buffer must be saved/relinked first if the slices should use processed audio. Source positions round to nearest musical ticks; out-of-trim, edge and coalesced cuts are skipped. No usable cuts rejects. Left ID, source references and outside fades remain; inner explicit fades clear. Long explicit fades and existing automatic region fades can sound different after splitting. Timeline/source rounding may differ by one sample, so this is not sample-accurate timeline slicing. The no-explicit-fade aligned regression fixture remains bit-identical across slicing. No media files are written by slicing.
## Validation and timing limits
Every phase passed focused model and GUI checks before its implementation commit.
The integrated checks add allocation failure/cleanup, oversized sources, overflow,
clip ID rollback, exact selected samples, persistence, no-fade render comparison,
plugin fixtures, software JACK, Clang analysis, ASan/UBSan and install layouts.
The actual source editor and attack markers are shown in the
[screenshot gallery](../screenshots/README.md).
Trim placement preserves alignment in musical ticks; independent source/timeline
conversion can differ by one sample. No sample-accurate timeline cuts or
click-free transitions are promised. Clip source data outside a local processing
selection remains intact; exported selections contain only their chosen frames.
Closing the editor discards unsaved local processing. Successful project Undo
keeps generated files for redo/history; only failed adoption removes its owned
new output. Rejecting sources above the editor's frame limit may temporarily
use the existing WAV reader's larger decode bound before rejecting them.

View file

@ -216,3 +216,7 @@ seeks, shortened media tails, one-frame files, source/project limits, capacity
rollback, duplication/fade inheritance, persistence/invalid metadata, undo, peak
bins after source removal and byte-identical source preservation. GUI tests
cover short-clip selection, shared previews, split/duplicate/delete and undo.
Phases 69–79 add a modal audio source editor with frame selection, reversible
processing, selection export, copy adoption and transient slicing. See
[AUDIO_EDITOR.md](AUDIO_EDITOR.md) for commands, undo behavior and mono/size limits.

View file

@ -95,3 +95,15 @@ Screenshots are refreshed, including the command palette. See WORKSPACE.md.
Phase 38 adds dependency-free Soft Keys/Sub Bass instruments and Delay/Reverb
effects with saved controls and automation. Choose instruments in track headers;
insert effects on selected graph wires from Edit. See [BUILTIN_DEVICES.md](BUILTIN_DEVICES.md).
## Phases 69–79: audio source editing
Audio clips now open a modal waveform editor with native frame selection,
zoom, source statistics, nondestructive timeline trims, selection export and
save-copy adoption. Local one-step undo supports reverse, polarity inversion,
DC removal, linear/equal-power fades and gain/normalization. Silence boundaries,
zero-crossing snapping and amplitude attack markers support transactional clip
slicing. Originals are never overwritten; exported media remains available to
project undo/redo. Source editing uses the existing mono downmix and bounded
snapshots; timeline cuts round to musical ticks. See
[AUDIO_EDITOR.md](AUDIO_EDITOR.md) for exact behavior and remaining limits.

View file

@ -1837,12 +1837,40 @@ Implemented: deterministic nearest zero-sample/sign-crossing boundary search wit
Detect threshold attacks with a refractory gap, inspect their source positions, and split the original clip at representable interior source transients in one undoable transactional operation. Qualify integrated rollback, persistence, rendering and GUI behavior.
### Tasks and acceptance criteria
- [ ] Implement bounded C99 analysis/processing and accessible FLTK controls.
- [ ] Preserve source files, atomic error handling, history and callback safety.
- [ ] Pass meaningful core and GUI checks; document exact behavior and limits.
- [x] Implement bounded C99 analysis/processing and accessible FLTK controls.
- [x] Preserve source files, atomic error handling, history and callback safety.
- [x] Pass meaningful core and GUI checks; document exact behavior and limits.
### Implementation status
Planned.
Implemented: hysteretic amplitude attack detection with refractory gaps, source-frame markers and transactional nearest-tick slicing with one project undo step. Capacity failures preserve clips/IDs; core render comparison and persistence reload, GUI slicing/undo, allocation rollback, sanitizer, static-analysis, plugin/JACK and installation checks pass. See integrated validation and AUDIO_EDITOR.md for explicit mono, timing and detector limits.
### Integrated validation for Phases 69–79
Each of the eleven phases has its own tested implementation commit. The final
warning-enabled core/offline suite and focused sample-editor GUI checks cover
native frame selection, trim rounding, local processing/undo, selection export,
failed/successful copy adoption, project undo and slicing. The native-rate GUI
case trims through the actual editor callback using the fixture's 22.05 kHz rate.
Core regressions verify exact range samples, curve endpoints, residual DC,
silence/zero-crossing ties, threshold hysteresis, attack capacity, partial-slice
capacity rollback/ID preservation, an aligned no-fade render comparison and
saved-slice reload. Oversized source, overflow and gain-cap failures are explicit.
Allocation-failure injection covers every processing operation, source loading,
WAV save cleanup and slicing preparation. Full GUI and LADSPA/CLAP/VST2/VST3
effect/instrument fixtures, software JACK lifecycle, ASan/UBSan core and focused/
full GUI, Clang analysis and both staged install layouts passed. Sanitizer GUI
runs retain only the existing system Fontconfig leak suppression. The public
sample API, docs and two real editor captures are included in the repository.
No dependency or project-format migration was added (writer 16, reads 1–16).
All sample I/O, allocation and processing run on the control thread. The editor
uses the existing mono downmix, bounded snapshots and one local undo/redo step;
project trims/slices remain musical-tick based. Long-file streaming, stereo
source editing, audition/scrubbing, time stretching, spectral processing,
physical listening/hardware and arbitrary third-party plugins remain unqualified.
See [AUDIO_EDITOR.md](AUDIO_EDITOR.md) for precise workflows and limits.
---

View file

@ -218,3 +218,9 @@ batch audio fades and static mixer A/B recall. See
[MODERN_EDITING.md](MODERN_EDITING.md) for commands, scope and limitations.
See [arrangement and composition workflows](COMPOSITION_WORKFLOWS.md) for markers, MIDI composition, normalization and portable media collection.
Select an audio clip and open View / Sample editor (or double-click it) to inspect
source samples, choose native frame ranges, trim the clip or export a new WAV.
Processing and one-level local undo remain in the editor until Save full copy and
relink. See [AUDIO_EDITOR.md](AUDIO_EDITOR.md) for all sample tools, transient
slicing, musical-tick rounding and source preservation limits.

View file

@ -239,3 +239,7 @@ batch audio fades and static mixer A/B recall. See
Phases 58–68 add arrangement markers and sections, ripple edits, complete track
duplication, MIDI splitting/consolidation and composition tools, peak normalization
and portable media collection. See [COMPOSITION_WORKFLOWS.md](COMPOSITION_WORKFLOWS.md).
Phases 69–79 add a modal audio source editor with frame selection, reversible
processing, selection export, copy adoption and transient slicing. See
[AUDIO_EDITOR.md](AUDIO_EDITOR.md) for commands, undo behavior and mono/size limits.