

Deterministic Stable Audio CLI studio (legends-sa3) for coding agents: preview-first text-to-audio, audio-to-audio, and inpainting generation, duration/seed/steps/cfg-scale parameter and credit guardrails, VRAM-calibrated local GPU batches, SHA-256 WAV/MP3 stem banking, and active-cue loudness mastering.

Install or update legends-stable-audio-3 via cto-legends (https://github.com/avalonreset/cto-legends): run `cto-legends install legends-stable-audio-3 --apply`, then `cto-legends handoff legends-stable-audio-3` and follow the returned JSON recipe to verify `legends-sa3`.

just use freaking stable-audio-3 for all of your music beds from now on
Why legends-stable-audio-3 exists
Most ad-hoc generative audio scripts break down as soon as a coding agent moves past a single toy clip:
- Unbounded durations, unseeded prompts, and GPU OOM crashes: Asking an agent to “make a 2-hour background track” without hardware-calibrated segment math or explicit
duration, seed, steps, and cfg_scale bounds either crashes local VRAM mid-render or produces unrepeatable clips with garbled vocal artifacts.
- Blind paid API calls and lost generation credits: Firing raw HTTP POST requests at hosted Stable Audio endpoints without an offline plan check or an immediate on-disk recovery receipt means any transient network drop during polling forces your agent to re-submit and double-bill your account.
- Dead-air intros and RAM-crashing FFmpeg filter graphs: Generative audio models frequently pad track heads and tails with near-silent dead air. Feeding thirty raw tracks into a single monolithic FFmpeg filter graph exhausts workstation memory and leaves awkward silent gaps at every crossfade before you can score a video for
legends-youtube, legends-captions, or legends-obs.
legends-stable-audio-3 gives coding agents a deterministic audio studio via the legends-sa3 CLI. It keeps local Medium GPU inference, guarded hosted Large API jobs (text-to-audio, audio-to-audio, and inpaint), pinned Underfit LoRA adapter training, and active-cue floating-point stem mastering distinct and verifiable.
Ask in plain english
Once cto-legends is installed, you ask your coding agent in plain english. It previews prompts and parameter bounds offline first, enforces credit and VRAM guardrails, banks every WAV or MP3 stem with SHA-256 provenance, and trims dead air before mastering:

Architecture: preview-first guardrails and active-cue stem mastering

1. Preview-first generation, parameter bounds, and two-step credit guardrails (plan and large)
Before touching GPU weights or spending a single hosted API credit, legends-sa3 validates every parameter offline:
- Zero-cost hosted request planning (
legends-sa3 large plan): Validates operation (text-to-audio, audio-to-audio, or inpaint), duration (1..380 seconds, defaulting to 380s for full songs), seed, steps (4..8), cfg-scale (1..25), strength, and mask-start/mask-end, and preflights local reference audio with ffprobe (<= 100 MiB, symlink-refused).
- Two-step paid confirmation and crash recovery (
legends-sa3 large generate and large result): Live hosted jobs require both --confirmed-live-credits <n> and --confirm-paid. Immediately upon submission, legends-sa3 writes a secret-free pending receipt containing the remote generation_id before polling begins. Paid POST requests are never automatically retried; interrupted downloads resume cleanly via legends-sa3 large result --generation-id <id> and verify the downloaded WAV/MP3 bytes and SHA-256 digest before writing.
- VRAM-calibrated local Medium planning (
legends-sa3 plan and prompt): Calculates recommended per-track durations (90s..120s on 8 GB VRAM up to 360s..380s on 24 GB VRAM), crossfade overlap deductions, and exact segment counts on CPU, while formatting structured instrumental metadata (TrackType, VocalType: Instrumental, BPM, and vocal-blocking negative guidance).
2. Complete legends-sa3 CLI surface
| Surface |
legends-sa3 Subcommands |
What It Does |
| Readiness & Model Access |
doctor, download-model, skill |
Offline hardware/FFmpeg/PyTorch/VRAM inspection (doctor --offline), revision-pinned Hugging Face download across six allowlisted Stability AI model repositories (stable-audio-3-medium, stable-audio-3-medium-base, stable-audio-3-small-music, stable-audio-3-small-sfx, stable-audio-3-optimized, stable-audio-open-small) with --list-models license/size inspection (download-model), and portable recipe bundle validation (skill validate, skill install). |
| Prompt & Runtime Planning |
prompt, plan, production-plan |
Expand free-form style notes or built-in recipes (lofi-study, trip-hop-trance) into structured prompts (prompt), compute VRAM-aware local batch geometry (plan), or plan full-song hosted production sets with conservative and live-published credit estimates (production-plan). |
| Guarded Hosted Large API |
large plan, large generate, large result |
Preview hosted text-to-audio, audio-to-audio, and inpaint payloads offline with explicit credit-discrepancy warnings (large plan), execute credit-confirmed jobs with atomic pending receipts and billed-credit header reporting (large generate), and recover interrupted downloads without double-billing (large result). |
| Local GPU Batches & LoRA Studio |
generate, lora-studio |
Run resumable local Medium GPU batches with sequential seeds and .safetensors-verified LoRA/DoRA checkpoints (generate), or manage a commit-pinned (3cb098f6...) Underfit LoRA training checkout and checksum-verified adapter registry (lora-studio status, install, import, list-adapters). |
| Active-Cue Analysis & Mastering |
analyze, mix, arrange |
Scan generated stems in 100 ms decibel windows to detect near-silent heads/tails and active cues (analyze), stream sequential 32-bit float crossfades into a continuous 320 kbps MP3 master (mix), or render a per-pair cue sheet into unclipped 32-bit float WAV (arrange). |
3. SHA-256 stem banking and active-cue loudness mastering (analyze, mix, and arrange)
- Loudness-scanned dead-air trimming (
--mix-policy active-cue): Generative tracks often begin or end with quiet padding that wastes a uniform crossfade window. legends-sa3 analyze and mix decode each stem into 32-bit floating-point PCM (512 MiB bounded), scan peak and RMS decibel thresholds (--cue-threshold-db -50.0, --silence-threshold-db -80.0), trim silent heads and tails, lock incoming transitions onto active musical cues, and protect the first and final tracks from artificial fades.
- Sequential streaming and SHA-256 manifests: Instead of building one massive FFmpeg filter graph that exhausts RAM across multi-hour mixes,
legends-sa3 streams transitions pair by pair and writes a verified JSON manifest recording source SHA-256 hashes, per-track trims, cue warnings, and ffprobe-verified master duration.
Ad-hoc audio prompts vs legends-stable-audio-3

Quick start
# 1. Verify local runtime, FFmpeg, and GPU/VRAM readiness offline
legends-sa3 doctor --offline
legends-sa3 skill validate
# 2. Preview expanded instrumental prompts and calculate a multi-hour mix plan on CPU
legends-sa3 prompt --style "trance hip hop jazz, smoky saxophone, broken beat drums, 104 BPM" --count 3
legends-sa3 plan --hours 4 --vram-gb 24 --crossfade 12
# 3. Preview a hosted Large text-to-audio or audio-to-audio request offline (0 credits spent)
legends-sa3 large plan \
--operation text-to-audio \
--prompt "TrackType: Music, VocalType: Instrumental, deep dub techno, 118 BPM" \
--duration 380 --seed 42 --steps 8 --cfg-scale 1 --output-format wav
# 4. Run a credit-confirmed hosted job (verify live price first) or recover an existing ID
legends-sa3 large generate \
--operation text-to-audio \
--prompt "TrackType: Music, VocalType: Instrumental, deep dub techno, 118 BPM" \
--duration 380 --seed 42 --steps 8 --cfg-scale 1 --output-format wav \
--output ./output/dub-techno.wav \
--confirmed-live-credits 8 --confirm-paid
legends-sa3 large result --generation-id <id> --output ./output/dub-techno.wav
# 5. Analyze stems for quiet intros/tails and render an active-cue MP3 or float WAV master
legends-sa3 analyze --input-dir ./output/tracks_mp3 --json-output ./output/track-analysis.json
legends-sa3 mix --input-dir ./output/tracks_mp3 --output ./output/master-mix.mp3 --crossfade 12 --mix-policy active-cue
legends-sa3 production-plan --minutes 20
legends-sa3 arrange --plan arrangement.json --output ./output/arrangement-float.wav
Reference
Local Medium GPU generation, gated weights, and Underfit LoRA Studio
Before running legends-sa3 download-model, accept Stability AI’s terms for the gated model and bundled T5Gemma conditioner on Hugging Face, then authenticate with hf auth login. legends-stable-audio-3 never bundles, mirrors, or redistributes model weights.
# Inspect all allowlisted Stability AI models, pinned 40-char SHAs, license notes, and sizes
legends-sa3 download-model --list-models
# Download gated Medium weights after accepting Hugging Face terms (excludes pickle formats)
legends-sa3 download-model --model stable-audio-3-medium --output ./models/stable-audio-3-medium
# Generate a resumable local GPU batch with optional .safetensors LoRA adapter
legends-sa3 generate \
--model-dir ./models/stable-audio-3-medium \
--stable-audio-repo ../stable-audio-3 \
--style "lo-fi study hip hop, warm Rhodes, soft boom bap drums, no vocals" \
--minutes 20 \
--vram-gb 24 \
--output ./output/lofi-study
# Inspect or import a trained .safetensors checkpoint from pinned Underfit LoRA Studio
legends-sa3 lora-studio status
legends-sa3 lora-studio import ./state/runs/my-style/5000.safetensors --name my-style --source-run my-style
legends-sa3 lora-studio list-adapters
See first-run guide, model access, VRAM guide, prompting guide, LoRA adapters, and LoRA Studio with Underfit.
Agent setup (via cto-legends) and standalone installation
Agent setup (via cto-legends)
Part of cto-legends. The central router skill is vendored at skills/cto-legends/SKILL.md; this module is not a separate registered skill and does not require an ambient MCP daemon.
Run cto-legends handoff legends-stable-audio-3 and read the returned installed recipe and task-readiness checks. If the module is missing, preview setup with cto-legends install legends-stable-audio-3, perform the authorized setup, then repeat the handoff. Use cto-legends check-updates to compare your installed version with the catalog and published release. See docs/AGENT-RECIPE.md for the standalone recipe.
python -m venv .venv
python -m pip install -e ".[download]"
legends-sa3 doctor --offline
legends-sa3 skill validate
Set STABILITY_API_KEY in your environment only when submitting or polling hosted Large API jobs. Secrets are redacted from all receipts and logs.
Documentation index, verification, and scope boundaries
python -m pytest tests -v
python scripts/release_checks.py
python scripts/check_release.py
Contributing, security, and license
See CONTRIBUTING.md, SUPPORT.md, and SECURITY.md.
Project-owned source, documentation, tests, and banner assets are licensed under Apache License 2.0. See NOTICE, THIRD_PARTY_NOTICES.md, and assets/PROVENANCE.md. legends-stable-audio-3 is an independent compatibility project and is not affiliated with, sponsored by, or endorsed by Stability AI. Copyright © 2026 Avalon Reset.
Start here
Paste the agent handoff block at the top of this page into your coding agent, let it wire the cto-legends router skill, and speak your task in plain English.
Running a company and not a terminal? Founders and operators who want this way of working applied directly to their own business stack have one route: message Avalon Reset at cto-legends.com/dm or start with a 48-hour diagnostic at cto-legends.com/home#home-offer. The desk is async, so the conversation starts the moment you write and nobody forces you onto a sales call.


Specification & benchmarks on cto-legends.com:
评论