Real creative transformation: key matching, sections, sidechain, style
The old engine picked stems and slapped a static reverb+compressor on top for the full duration - "change pitch and speed and call it a day," per the ask. This is a genuine rewrite of the DSP core: - Real key detection (Krumhansl-Kessler chroma-profile correlation) replaces AI-guessed pitch shifts. Semitone shifts are now computed from actual detected keys, so combined stems from different songs are harmonically correct instead of an arbitrary number the model picked with no data behind it. - Section-based arrangement: the plan now describes real structure (intro/build/drop/etc.) with different stems active per section instead of one static combination playing for the whole duration. Every stem is stretched/pitch-matched once and cached in memory; sections slice and sum from that shared pool with short crossfades at boundaries. - Sidechain ducking: one song's drums can rhythmically duck everything else (the "pump" that makes a mix actually groove), via a vectorized lowpass-filtered envelope follower - not a per-sample Python loop, which would be far too slow on this CPU's unaccelerated math. - Style presets (lofi/trap/house) apply genre-appropriate processing chains instead of one generic effects chain for every request. Two-step AI pipeline, split by what each model actually can/can't do: Gemini listens to a real audio preview of each song and writes a text description (mood, energy, instrumentation) - Claude's API has no audio input at all, so this is the only way it gets that context. Claude then takes those descriptions plus real BPM/key data and the user's prompt and directs the actual arrangement: sections, target key, sidechain routing, style. Perception on Gemini, instruction- following and structured reasoning on Claude - not asking one model to do both. Needs ANTHROPIC_API_KEY to actually run plan_remix - not yet set in this environment, so the full pipeline is implemented and unit-tested but not yet verified end-to-end. All DSP pieces (key detection, semitone math, sidechain envelope, tiling) have deterministic unit tests against a committed fixture (tests/fixtures/tone.wav, plain numpy+soundfile, no ffmpeg dependency). Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
Showing
| ... | ... | @@ -7,6 +7,7 @@ syncedlyrics==1.0.1 |
| pyacoustid==1.3.0 | ||
| musicbrainzngs==0.7.1 | ||
| google-generativeai==0.8.3 | ||
| anthropic>=0.40.0 | ||
| pedalboard==0.9.8 | ||
| fastapi>=0.110.0 | ||
| uvicorn>=0.28.0 | ||
| ... | ... |
tests/fixtures/tone.wav
0 → 100644
File added
tests/test_remix_engine.py
0 → 100644
Please
register
or
sign in
to comment