Run Stable Audio Open Locally
How to generate audio locally with Stable Audio Open using the diffusers StableAudioPipeline — install, accept the gated model, and generate a loop from a text prompt in Python.
What you'll need
- Python 3.9+ and a CUDA GPU (fp16 keeps memory reasonable)
- A Hugging Face account — the model is gated, so accept its terms on the model page once
Install
pip install diffusers transformers torch soundfile
Stable Audio Open is easiest to drive through the diffusers pipeline. (For training and advanced control, use Stability's own stable-audio-tools repo.)
Generate a clip
import torch, soundfile as sf
from diffusers import StableAudioPipeline
pipe = StableAudioPipeline.from_pretrained(
'stabilityai/stable-audio-open-1.0', torch_dtype=torch.float16
).to('cuda')
audio = pipe(
'128 BPM tech house drum loop, punchy kick, crisp hats',
negative_prompt='low quality',
num_inference_steps=200,
audio_end_in_s=10.0,
).audios[0]
sf.write('loop.wav', audio.T.float().cpu().numpy(), pipe.vae.sampling_rate)
This writes a ten-second stereo WAV. The model is tuned for short audio — loops, one-shots, textures and sound effects — rather than full arrangements, and it's instrumental only.
Getting good results
- State the BPM explicitly for rhythmic material — the model responds to it.
- Describe timbre and production ("analog", "lo-fi", "wide reverb"), not just genre.
- Raise num_inference_steps for cleaner output; lower it for quick drafts.
Licence check. Stable Audio Open is released under Stability's community licence — free for research and small-scale use, with separate terms for larger commercial use. Review the current licence before shipping.
Compare it with MusicGen, or browse all open models.