Repository navigation
Studio: add the Edit speech page - #12606
Merged
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.
Edit speech on DotTTS Edit (markup, one pass), Vevo2 (s2s editing) and FireRedAudio (one semantic or acoustic instruction per pass, chained). /audio/run takes the recording by id, refuses sources over 30 s, keeps the original as a source clip for A/B, and never returns server paths.
Recording, auto-transcribed transcript, word diff editor, Words | Delivery modes, per-model request preview, and an Original | Edited compare player.
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.
# Conflicts: # studio/frontend/src/features/audio/route-search.ts
# Conflicts: # studio/frontend/src/features/audio/route-search.ts
…irst word from a newline-free log tail
…long clip's text past the 30 s cut
# Conflicts: # studio/frontend/src/features/audio/audio-run-request.ts # studio/frontend/tests/audio-run-api.test.ts
# Conflicts: # studio/frontend/src/features/audio/audio-run-request.ts # studio/frontend/tests/audio-run-api.test.ts
…y speaks=False family, and count only kept inputs toward the byte cap
# Conflicts: # studio/backend/core/inference/audio_cpp_models.py
# Conflicts: # studio/backend/core/inference/audio_cpp_backend.py # studio/backend/core/inference/audio_cpp_models.py # studio/backend/core/inference/audio_cpp_server.py # studio/backend/core/inference/orchestrator.py # studio/backend/core/inference/worker.py # studio/backend/models/inference.py # studio/backend/routes/inference.py # studio/backend/tests/test_pr7699_worker_audio_mirror.py # studio/frontend/src/features/audio/audio-page.tsx # studio/frontend/src/features/audio/audio-run-request.ts # studio/frontend/src/features/audio/hooks/use-clone-generation.ts # studio/frontend/src/features/audio/pages/tts-workspace.tsx # studio/frontend/src/features/audio/tools/registry.tsx
# Conflicts: # studio/backend/core/inference/audio_cpp_models.py # studio/backend/core/inference/audio_gallery.py # studio/backend/core/inference/audio_workflows.py # studio/backend/models/inference.py # studio/backend/routes/inference.py # studio/backend/tests/test_audio_gallery.py # studio/backend/tests/test_audio_workflows.py # studio/frontend/src/features/audio/api.ts # 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/catalog.ts # studio/frontend/src/features/audio/hooks/use-audio-gallery.tsx # studio/frontend/src/features/audio/hooks/use-clone-generation.ts # studio/frontend/src/features/audio/workflows.ts # studio/frontend/tests/audio-workflows.test.ts # studio/frontend/tests/audio-workspace-split.test.ts
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.
Stacked on #12602. Only the commits after ce9807f are new in this PR.
#12602 has since gained one pre-commit.ci autofix commit (ca6a9bd); it merges into this branch without conflicts and will come in with the next sync.
Summary
Adds an Edit page between Clone and Music. You give it a recording of up to 30 s, Studio transcribes it, you fix the transcript so it matches the audio, then change words in a second copy. The edited clip keeps the speaker's voice and the parts you did not change. It works with DotTTS Edit, Vevo2 and FireRedAudio, the three families spike S2 found can edit. FireRedAudio can also change speed and raise pitch.
Changes
Backend (
studio/backend):POST /api/inference/audio/runtakesworkflow: "edit"withinputs.source(an input id or a history clip) and aneditobject (mode,markuporinstructions,speed,pitch_steps). The validator only acceptsedittogether withworkflow: "edit", and an edit refusesreferenceandemotioninputs. There is no new route.core/inference/audio_edit.pychecks that the DotTTS markup or FireRedAudio instructions turn the original transcript into the edited one, and refuses anything else ("The changes do not match the transcript. Check ① and ② again.").EditSpeconAudioCppFamilydescribes how each family edits:<sub>/<del>/<ins>markup withtemplate_name: "edit"in one/v1/tasks/runcall. DotTTS-MF and SOAR still only speak.s2ssession on theeditingroute withtarget_textand the optional originalreference_text. When Vevo2 was last loaded for Clone, the server restarts ins2sfirst, and the next Clone run switches it back.semantic_editinstruction per change (Replace 'x' with 'y'.,Delete 'x'.,Insert 'x' before 'y'.), at most 5, chained so each call edits the previous output. S2 found combined instructions unreliable. Delivery usesacoustic_editwith one call for speed and one for pitch. It runs in the samettssession Clone loads, so there is no reload.workflow: "edit", agroup_idand the edit recipe (mode, change count, original text, options). An uploaded recording is also saved to history as arole: "source"clip for the A/B compare. Responses and history records contain clip URLs only, never server paths.audio_edit(style, delivery support, max changes), andaudio_workflowsincludesedit. Clearing history withworkflow=editonly clears Edit clips.Frontend (
studio/frontend/src/features/audio):pages/edit-page.tsx. The rail has the Recording card, "① Check the transcript" (auto-transcribed when a recording is picked), and "② Make your changes" inTranscriptDiffEditor. The editor marks inserted words with an underline and removed words with strikethrough, and shows a change-count badge and a Reset to transcript button.edit-adapters.tsturns the diff into each model's request. The tool panel shows "How edits apply" for the loaded model.ABCompareplays the selected edit as Original | Edited in one player. Playback keeps its position when you switch sides. Its bars are drawn from the gallery file URL because the page CSP blocksfetch(blob:).unsloth_audio_edit_v1.UX
Mapping to the audio pages UX checklist (items 1 to 10):
unsloth_audio_edit_v1. A new recording starts its changes over from its own transcript and does not touch other pages.AudioSourceInput: drag and drop on the card, file picker, recording, and From history, with a waveform and duration right after the pick.aria-liveannounces "New clip ready." and errors. In ABCompare, Original | Edited is a Tab-reachable pill toggle. On the focused bars, Space plays or pauses, the arrows seek 5 s and Home goes to the start.template_name,instruction,source_text,target_text). Labels are plain ("Raise pitch", "How edits apply").motion-reducefallbacks.An independent UX reviewer went through the screenshots and listed 16 findings (3 major, 9 minor, 4 nit). Fixed here: the per-row "Edited" badge is gone, the change-count badge uses neutral colors, there is one hint under the diff, and Reset moved to the ② header. Also fixed: the "Change one word" chip selects a word, Words | Delivery tabs sit after ① with Delivery titled "② Change the delivery", the speed caveat is inline instead of in a tooltip, and the Vevo2 note is in the rail. The rest are shared PR 1 and PR 2 components and are under Known gaps.
Testing
Frontend, from
studio/frontend:The request adapters are covered by a golden fixture (
tests/fixtures/audio-edit-requests.json, 7 cases) that the frontend and backend tests both read.Backend, from
studio/backend(the audio test list from PR 2 plustest_gguf_load_cache_reuse.pyandtest_account_media_isolation.py, including the newtest_audio_edit_requests.pyandtest_audio_edit_route.py):GPU smoke ran on a separate Studio install from this branch (
install.sh --local) on one GPU. The source is a 4.7 s, 24 kHz recording of "Okay, I'm Cemo and what you just heard wasn't a human voice." Every output was transcribed with ASR and compared to the edited text. ASR hears "Cemo" as "Simo" or "Semo" in the source too.s2s)Regression and refusal checks:
pathkey ininputs.sourceKnown gaps
AudioSourceInput(the expired card says "This reference expired." on Edit).Maintainer changes
/v1/tasks/runbodies; the shared fixture still pins frontend run body against backend calls), edit specs live on the family entries, clone and edit share one run-response builder, and comments are cut to the load-bearing ones. The PR's own diff went from +5875 to about +5000 lines.audiocpp_serverstop now waits up to 120 s after SIGKILL. On a busy GPU, switching Vevo2 between Clone and Edit failed the request with "Could not reach an upstream service" because the old server outlived the 10 s wait; after the fix Clone, Edit and Clone again all return 200.outputclip is shown as a run's result; with none the inline audio plays.GPU check on one B200 (q8_0 GGUFs, shared card), each output transcribed with Whisper large-v3-turbo:
pathin sourceUI before and after
Audio workspace opened on
?workflow=edit, no model loaded. BEFORE is #12602's head (5e1ead8) instead of this PR's merge base, since the Clone stack is not on main yet; AFTER is this PR at 360caae.