A modern, reproducible, and portable workspace for Stable Audio 3 (small-music, small-sfx, and medium) powered by Pixi.
Designed to run locally with NVIDIA GPU acceleration (via PyTorch + CUDA) or CPU fallback, with zero global environment pollution.
- Model Family: Stability AI's Stable Audio 3
small-music: Stereo composition and music generation (up to 120s)small-sfx: Sound effects and ambient audio generation (up to 120s)medium: Unified flagship quality model for cinematic music and sound design (up to 380s)
- 100% Declarative & Portable: Fully managed by Pixi. A single
pixi.lockfile guarantees identical builds on any computer. - Hardware Accelerated: Automatically utilizes NVIDIA GPUs (Tensor Cores / FP16) when available, while seamlessly supporting CPU fallback.
- Strict KISS & YAGNI Design: Lean, flat, and professional-grade codebase with zero unnecessary boilerplate or wrappers.
- Flexible Interfaces:
- CLI: Fast scriptable generation (
pixi run generate) - Web UI: Interactive Gradio studio with waveforms and presets (
pixi run ui) - Diagnostics: Built-in environment & GPU verification (
pixi run check-env) - Download Manager: Cache inspection and pre-download manager (
pixi run download-models)
- CLI: Fast scriptable generation (
- Pixi: If not installed, install it in seconds:
- Windows (PowerShell):
iwr -useb https://pixi.sh/install.ps1 | iex - Linux/macOS:
curl -fsSL https://pixi.sh/install.sh | bash
- Windows (PowerShell):
- Hugging Face Model Access:
Stable Audio 3 weights are community-licensed and gated on Hugging Face:
- Log in to Hugging Face.
- Accept the model license terms:
- Create an Access Token at huggingface.co/settings/tokens.
- Copy
.env.exampleto.envand paste your token:cp .env.example .env
Check that PyTorch detects your GPU and verifies Hugging Face authentication:
pixi run check-envVerify that all core modules, prompt sanitization, model registries, and storage validators are operational:
pixi run testGenerate high-fidelity stereo audio in seconds:
# Music generation (small-music)
pixi run generate --prompt "Upbeat funky bassline with warm rhodes piano and crisp drums" --duration 15
# Sound effect generation (small-sfx)
pixi run generate --model small-sfx --prompt "Campfire crackling in a dense forest with gentle wind" --duration 10
# High-fidelity music and sound design (medium)
pixi run generate --model medium --prompt "An epic cinematic orchestral trailer theme with soaring strings" --duration 15All generated .wav files are automatically timestamped, slugified, and saved to the outputs/ directory in standard 16-bit PCM CD-quality format. The exact seed used is displayed in the terminal so you can reproduce any track.
Start the local Gradio studio in your web browser:
pixi run uiOpen http://127.0.0.1:7860 in your browser.
| Flag | Short | Default | Description |
|---|---|---|---|
--prompt |
-p |
required | Text description of the audio |
--negative-prompt |
-n |
None |
Qualities or sounds to avoid |
--model |
-m |
small-music |
Model variant: small-music, small-sfx, or medium |
--duration |
-d |
15.0 |
Output duration in seconds (Small: up to 120s, Medium: up to 380s) |
--steps |
-s |
8 |
Diffusion sampling steps (8 is optimal for post-trained models) |
--cfg-scale |
1.0 |
Classifier-free guidance scale | |
--seed |
-1 |
Seed for reproducibility (-1 for random; seed is logged) |
|
--output |
-o |
None |
Custom path to save the output .wav file |
If you prefer to inspect or pre-download model weights from the terminal:
# Check cache status of all models
pixi run download-models --status
# Pre-download all models
pixi run download-models
# Pre-download a specific model
pixi run download-models --model mediumWithin the Gradio Web Studio (pixi run ui), the interface displays a live Model Status badge and a one-click download button.
stable-audio-lab/
├── core/ # Clean, modular engine & utilities
│ ├── compat.py # Platform & environment setup (UTF-8 stdout, warning filters, Triton fallback)
│ ├── registry.py # Model specifications, durations, and curated presets
│ ├── storage.py # Hugging Face Hub caching and download helpers
│ └── engine.py # VRAM cache hygiene, reproducible inference & 16-bit PCM WAV export
├── tests/ # Automated unit tests (slugify, registry, compat, storage, validation)
├── app.py # Gradio Web Studio with unified model selector & native progress
├── generate.py # Lean CLI generation tool with tqdm progress & seed capture
├── download_models.py # Terminal model cache inspector & pre-download tool
├── check_env.py # Hardware & authentication diagnostic script
├── pixi.toml # Declarative environment & tasks definition
├── pixi.lock # Cross-platform dependency lockfile
├── LICENSE # MIT License
├── .env.example # Template for Hugging Face access token
└── outputs/ # Destination folder for generated audio files
To run this project on another computer:
git clone https://github.com/MertCanYeg/stable-audio-lab.git
cd stable-audio-lab
cp .env.example .env # add your HF_TOKEN
pixi run ui # automatically installs environment & launches studioTo pull the latest updates anytime:
pixi run update # pulls latest changes from repositoryPixi automatically handles Python installation, CUDA runtimes, PyTorch, and all dependencies without affecting the host system.
This project is licensed under the MIT License. Model weights are provided by Stability AI under the Stability AI Community License.