Repository navigation
Studio: add the Separate audio workflow with a synced stem mixer - #12610
Merged
danielhanchen merged 149 commits intoOct 4, 2026
Merged
Conversation
Map each audio.cpp family's existing task to the Audio workflow it serves (speak, music, transcribe) and report it as audio_workflows on inference status and cached-model rows. Gallery clips record their workflow, older clips infer it from audio_type, and DELETE /audio/gallery can scope a clear to one workflow. Fix the spec-task fallback stopping at a 'clon' token, so a clone+music or clone+asr spec is no longer refused as clone-only. Only offer a fallback family the installed runtime knows (its model_specs, or the pinned tag's spec list), and name unsupported task tokens in plain words. Pass the audio runtime's own error text, sanitized, to /audio/generate, /v1/audio/speech and transcription instead of a generic internal error.
The 3,600-line Audio page becomes a thin host over hooks (model slot, STT sidecar, transcription, gallery, generation, handoff) and per-workflow pages, with the moved code unchanged. A Zustand workspace store holds the current workflow; only the page commits it, the sidebar and deep links ask. - Sidebar: Images' workflow list is generalised; a pinned Audio row lists its workflows inline, and the More flyout gets an Audio submenu. Nav defaults are unchanged. - Handoffs: ?workflow= and ?task= (text-to-audio opens Music), Library clips open on their own page, the chat picker passes the workflow. - Each page lists only models for its task, keeps its own history and drafts, and tours its own controls. Clear all clears only that page. - Today's model-specific fields move into a tool-panel registry unchanged. - Generate says why it is off and offers the fix, runs from Mod+Enter, shows elapsed time, keeps a failed run's reason, and focuses the new clip. The source-shape tests that read audio-page.tsx now read the split files, with their assertions unchanged.
POST /api/inference/audio/inputs streams an upload to disk, decodes it with PyAV and keeps it per account for a day. /audio/voices stores saved voices. /audio/run clones a voice from an upload, a history clip or a saved voice: the route resolves ids to account-scoped 24 kHz mono files and hands the worker paths, never bytes or a path the client chose. Clone-only audio.cpp families (Qwen3-TTS Base, Chatterbox, CosyVoice3, IndexTTS2/2.5, FireRedTTS3, FireRedAudio, Vevo2, Confucius4, MioTTS) list on Clone instead of Speak, with the server task the spike found loads (clon for Chatterbox, Echo-TTS, Confucius4 and FireRedTTS3 Base). MioTTS downloads and loads MioCodec beside it. Maya1 needs a voice description, and VibeVoice text without a speaker label is sent as Speaker 1.
Clone joins Speak, Music and Transcribe. Its rail takes a reference by upload, recording, history clip or saved voice, drawn with a waveform as soon as it is picked, then "What's said in the clip" with a Transcribe button, the text, language and the model's tools: Timbre only (Qwen3 Base), Emotion (IndexTTS2), Expressiveness (Chatterbox), Mode (CosyVoice3) and Speed and dialect (F5). Save voice keeps a reference for later; Speak can use a saved voice on models that both speak and clone. Tool panels now validate and shape the request on Speak and Music too, a page shows its last model as not loaded, and Clone offers recommended models in one click.
HTDemucs, HTDemucs 6-stem, BS-RoFormer and Mel-Band RoFormer were refused as "not supported in Studio yet". They now load into the main slot as task sep and run on the Separate workflow: /audio/run resolves the track in the caller's account, prepares a 44.1 kHz copy (the runtime rejects any other rate), and the worker hands back stem files, never bytes. audio.cpp answers with every stem as base64 in one JSON body (about 42 MB per stem for a three-minute track), so the response streams to a staging file and each stem is decoded straight to disk. Stems are saved to history as one group (role = stem id, shared group_id), all or none. The RoFormer overlap is a load time option, so the server restarts only when it changes. Separation models stay off /v1/audio/speech and /audio/generate, which point at Separate.
Audio gets a Separate workflow: pick a track (upload, record or from history; it is converted to 44.1 kHz), see the stems the loaded model will make, and press Generate. BS-RoFormer and Mel-Band RoFormer get an Overlap switch that says when changing it reloads the model, and the footer shows an estimate and the reload before the run. The result is a stem mixer: one waveform per stem, solo, mute and volume, all stems on one WebAudio clock, per-stem download, Download all as a zip, and Send to Clone (as the reference) or Transcribe. History lists a separation as one row, and pin, archive and delete act on all of its stems. The picker on Separate lists only separation models, and a loaded separation model on another page says so and offers Separate.
Member
|
The |
…model memory WorkflowBinding, the status audio_workflows field and lastModelByWorkflow had no reader. The tool panel registry rendered one instruction field through a generic framework whose request and validation hooks were never called; the page now renders that field directly from instructionsFieldKind.
The selected clip is a card with its model and age, a waveform player and the clip menu, which gains Send to. A run in progress shows a pending card with its phase, elapsed time and Stop. History rows add the model and age.
An unlisted generated clip now stays on the page that made it instead of showing on the other TTS page and blocking its history. Switching between Speak and Music passes the same busy gate as a mode switch, so a load in flight no longer pulls the page back when it finishes.
Brings in unslothai#12600's pre-commit fixes, comment trims and the move of the instruction fields to components/instructions-fields.tsx. unslothai#12600 dropped the tool panel registry, WorkflowBinding, the status audio_workflows field and lastModelByWorkflow because nothing read them. The Clone page reads all of them, so they come back here with their first consumer. The registry renders the instruction fields from their new path, which leaves instructionsFieldKind without a caller; it goes, and the tool panel tests keep the copy assertions its test made.
Drop the unused trim support, dead response fields and helpers, merge the two PyAV decoders into one transcode, share the option matcher between the route and the backend, fold duplicated tests into tables and cut narration comments.
…irst word from a newline-free log tail
…long clip's text past the 30 s cut
…y speaks=False family, and count only kept inputs toward the byte cap
# Conflicts: # studio/frontend/src/features/audio/picker-filter.ts
# Conflicts: # studio/frontend/src/features/audio/picker-filter.ts
# Conflicts: # studio/frontend/src/features/audio/audio-page.tsx # studio/frontend/src/features/audio/components/waveform.tsx
# Conflicts: # studio/backend/core/inference/audio_cpp_backend.py # studio/backend/core/inference/audio_cpp_models.py # studio/backend/core/inference/audio_inputs.py # studio/backend/core/inference/orchestrator.py # studio/backend/models/inference.py # studio/backend/routes/inference.py # studio/backend/tests/test_audio_run_route.py # studio/frontend/src/features/audio/audio-cpp-catalog.ts # studio/frontend/src/features/audio/audio-page.tsx # studio/frontend/src/features/audio/audio-run-request.ts # studio/frontend/src/features/audio/components/waveform.tsx # studio/frontend/src/features/audio/hooks/use-clone-generation.ts # studio/frontend/src/features/audio/tools/registry.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Studio: add the Separate audio workflow with a synced stem mixer
Stacked on #12602. Only the commits after ce9807f are new in this PR.
Summary
HTDemucs, HTDemucs 6-stem, BS-RoFormer and Mel-Band RoFormer GGUFs were refused on load as "not supported in Studio yet". They now load into the main slot as task
sep, and Audio gets a Separate page: pick a track (upload, record or history), press Generate, and get one waveform per stem in a mixer with solo, mute and volume on a shared WebAudio clock. Like Speak and Music, loading a separation model replaces the model in the main slot, and the page says so before you load one.Backend (7c8b49e)
/audio/runacceptsworkflow: "separate"withinputs.source.textis now optional onAudioRunRequestand still required forcloneandspeakvia a model validator. The route resolves the track in the caller's account and prepares a 44.1 kHz copy, since the runtime rejects any other rate. Tracks over 10 minutes (after trim) get a 400 that names the length, for example "10:01".audio_cpp_outputs.pystreams the response to a staging file and decodes each stem straight to disk, so the worker hands back file paths, not bytes.group_id), all or none.num_overlap(1 to 8) is accepted only for the RoFormer families. It is a load-time option, so the audio.cpp server restarts only when the value changes. Other options on a separation model return 400./v1/models, and/v1/audio/speechand/audio/generaterefuse them with a 400 that points at Separate.Frontend (cf30b0c)
separate-page.tsx,use-separate-generation.ts,separate-policy.ts). The rail shows the stems the loaded model will produce. BS-RoFormer and Mel-Band RoFormer get an Overlap switch that says when a change reloads the model, and the footer shows a time estimate and the reload before the run.stem-mixer.tsx,use-stem-transport.ts,use-stem-sources.ts): per-stem download, Download all as a zip, and Send to Clone (as the reference) or Send to Transcribe.AudioSourceInputtakes ausesFirstSecondsprop so Separate does not show "Uses the first 30 s".Blob.fetch(blob:)was blocked by the CSPconnect-src, which left the stem waveforms flat.The truncated workflow tabs visible on this branch are fixed in #12600, which replaces the pill tabs with a title menu.
Testing
Automated, on cf30b0c:
test_audio_run_route.py,test_audio_cpp_separation.py,test_audio_cpp_outputs.py, gallery and model tests). The baseline at ce9807f was 956 passed, 3 skipped.ruffclean, repo formatter is a no-op on changed Python files.npm test10106/10106, typecheck 0 errors, i18n check 0, build ok, biome reports no new errors against the base. New tests:audio-separate.test.ts,audio-stem-mixer-state.test.ts,audio-stem-mixer-source.test.ts.Live smoke against a local install (
install.sh --local, runtime on one GPU), 21/21 checks passed:/audio/runfor the 4 separation models went from 0/4 on the base (refused at load) to 4/4 on this branch, with the expected stem ids. A 48 kHz upload came back as 44.1 kHz stereo stems. Reconstruction SNR (sum of stems vs input): HTDemucs 31.6 dB, 6-stem 25.0 dB, BS-RoFormer 92.6 dB, Mel-Band 87.1 dB. Mel-Band stems arevocalsandinstrumental./audio/generateon a separation model./v1/modelslists no separation model as a voice.UI pass with Playwright scenes and a separate reviewer. Fixed from that review:
blob:fetch above).bg-foreground, and silent rows drop to 35% opacity.Checked in the UI: Send to Clone sets the clip reference to "music_180s_44k - Vocals", Send to Transcribe without a speech-to-text model loaded shows a toast, and deleting a separation group removes all of its stems (88 to 86 history clips).
Known gaps, not addressed here:
AudioSourceInputin Studio: add the Clone page, audio inputs and saved voices #12602, and the recommended-model link copy follows the pattern from that PR.UX
AudioSourceInput(drop, pick, record, from history) shows duration and waveform as soon as a file is picked.aria-pressedbuttons. Completion and errors are announced.Before / after
BEFORE is the parent PR head (#12602 at ca6a9bd), AFTER is this PR (426392c); this is not the PR's own merge base, since the Audio workspace this page lives in comes from the parent PRs. Both are fresh
install.sh --localinstalls on one B200. On BEFORE, loading HTDemucs-GGUF returns 400 "Source separation models are not supported in Studio yet." and there is no Separate page. On AFTER, HTDemucs-GGUF loads asaudiocpp_sep, a 20 s track run through/audio/runcomes back as vocals, drums, bass and other, and the Separate page shows them in the stem mixer with the run in history.