-
Aryan Noshirvani authored
New POST /remix + GET /remix/{job_id}: takes 1-5 uploaded songs plus a natural-language prompt, runs it as a background job (RemixJob table tracks status/stage as it progresses), and returns a download URL when done. Pipeline: 1. Detect each song's BPM (librosa) and grab quick metadata via the existing Shazam/AcoustID identify_audio. 2. Ask Gemini to produce a structured remix plan - it hears a real ~25s preview of each song (not just title/artist text) plus the detected BPMs, and returns which stems to pull from which song, at what gain/pitch, a shared target BPM, and a master effects chain. This replaces the old ai_remix.py's approach of faking "stem separation" with a sox highpass filter while literally telling the AI it was using Demucs. 3. Actually run Demucs (real 4-stem separation: vocals/drums/bass/ other), cached on disk by file content hash so re-remixing the same song never reprocesses it. 4. Time-stretch selected stems to the shared target BPM (librosa phase vocoder), mix with per-song gain/pitch-shift, master with a pedalboard compressor + reverb chain, tag and export via the existing tag_and_convert_audio. Removes the old /music/remix/batch and /music/remix/status mock stubs in music.py (hardcoded fake job ids/progress) now that the real thing exists at /remix. This VPS's virtualized CPU exposes no SSE3/SSE4/AVX at all, which makes PyTorch's default oneDNN backend fail ("could not create a primitive") on Demucs's real-sized convolutions - a tiny toy conv works fine, which is what makes this easy to miss in isolation. torch.backends.mkldnn.enabled = False works around it. Also: Gemini calls need this box's HTTP(S)_PROXY set to reach the network at all (confirmed the already-running main branch's stax_backend.service has the same gap and is likely silently failing on Gemini calls in production right now - flagging separately, out of scope here). numpy is pinned <2 / scipy pinned to 1.13.1: numpy>=2's default wheels require the x86-64-v2 baseline and RuntimeError on import on this CPU. Tested end-to-end against two synthetic multi-tone MP3s: single-song "drop the vocals, slowed + reverb" and two-song "blend vocals of one over the drums of the other" both produced correct, tagged, playable MP3s (~75s for the two-song case, ~3s when stems were already cached). Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
5e8ddd13