>_EXECUTIVE SUMMARY
zpwr-algo-production is a Rust engine that turns one action into a finished, professionally-arranged track: song structure, key and tempo, per-section MIDI, and an exported Ableton Live Set (.als), with per-genre engines layered on top. It is the algorithmic-production core behind zpwr-daw's one-click production (INVENTIONS #5), ported faithfully from the Audio-Haxor src-tauri generators with the library-scanner couplings abstracted behind a host-provided sample source. Private — internal engine, version v0.1.0.
~ Scale & Position
| Metric | Value | Notes |
|---|---|---|
| Role | Algorithmic music-production engine | Generation as the workflow, not an assist bolted onto a linear DAW |
| Language | Rust (library crate) | rlib; consumed natively by Audio-Haxor and over a C ABI by zpwr-daw |
| Output | Ableton .als + MIDI | Full project: structure, per-section notes, audio clips, automation |
| External deps | serde, rand, regex, symphonia | Audio analysis (bpm, similarity) is dependency-light |
| Sample source | Host-provided trait | Runs without the Audio-Haxor library scanner |
| Tests | 280 (ported suite) | build + fmt + clippy + doc clean |
# Module Breakdown
| Module | Responsibility | Status |
|---|---|---|
bpm | Tempo estimation from audio (symphonia) | LANDED |
similarity | Audio fingerprint / similarity | LANDED |
als_project | Song structure + theory: section lengths / starts, key compatibility, section overrides | LANDED |
midi_generator | Per-section MIDI note-event generation | LANDED |
als_generator | Writes a full .als (MIDI + audio clips, automation) | LANDED |
trance_generator | Genre engine: trance-specific arrangement + MIDI | LANDED |
track_generator | Orchestrator: picks key / tempo / samples, drives generation | LANDED |
sample_source | Host-provided sample-source trait (decouples from the scanner) | LANDED |
midi, sample_analysis, sample_filters | Support: self-contained MIDI parser, sample name/manufacturer signals, filtering | LANDED |
capi, run | C ABI for zpwr-daw + run orchestration | LANDED |
~ Architecture
The orchestrator (track_generator) selects key, tempo, and samples (the latter from the host-provided sample_source), then als_project lays out the arrangement (sections, key compatibility, overrides). midi_generator fills each section with notes; genre engines such as trance_generator apply genre-specific arrangement and MIDI. Finally als_generator writes a complete Ableton Live Set — MIDI and audio clips with automation — from XML/ALS templates bundled in the crate.
The key design decision is the sample-source trait: Audio-Haxor's original generators were coupled to its library scanner; here the host supplies samples and the engine supplies the music, so the same crate runs inside Audio-Haxor (native) and zpwr-daw (over the capi C ABI) alike.
# Port Status
Faithful port complete — all seven generator modules plus the support layer build, and the ported test suite (280 tests) passes (build + fmt + clippy + doc clean). The audio-analysis modules (bpm, similarity), the generation modules, the sample_source decoupling, and the capi C ABI are all in. See the documentation hub for the overview.