The Patchbay_

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

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

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.

← AI music generation hub