Add Stable Audio 3 Small-SFX to sound effects tab, with model toggle and save-to-library

Runs entirely on CPU (no VRAM contention with ComfyUI), and sounds
noticeably better than MOSS-SoundEffect per listening test, so it is now
the default model. Toggle keeps MOSS-SoundEffect available as a fallback.
Saved clips land in the-service-station/sfx_library/ on disk, no db/
metadata system per explicit scope.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
steve-adminandClaude Sonnet 5 committed 2026-10-11 18:09:59 +00:00
1 parent 042c438b8d
commit b4fef19993
2 files changed
+113 -17

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
"""
Stable Audio 3 Small-SFX CLI: generate a sound effect/ambience clip from a
text description. Runs on CPU by design - this checkpoint is the
"lightweight, no GPU required" model in Stable Audio 3's lineup, so it
never contends with ComfyUI/other models for VRAM (unlike generate_sfx.py's
MOSS-SoundEffect, which needs the 3090 and ComfyUI's memory freed first).
"""
import argparse
import torchaudio
from stable_audio_3 import StableAudioModel
def main() -> None:
parser = argparse.ArgumentParser(description="Stable Audio 3 Small-SFX text-to-sound-effect")
parser.add_argument("--text", required=True, help="Description of the sound effect/ambience")
parser.add_argument("--output", required=True, help="Output wav path")
parser.add_argument("--duration", type=float, default=10.0, help="Clip duration in seconds (max 120)")
parser.add_argument("--seed", type=int, default=-1, help="Random seed, or -1 for random")
args = parser.parse_args()
model = StableAudioModel.from_pretrained("small-sfx", device="cpu")
sample_rate = model.model.sample_rate
audio = model.generate(prompt=args.text, duration=args.duration, seed=args.seed)
torchaudio.save(args.output, audio[0].cpu(), sample_rate)
print(f"[INFO] Saved {args.output}")
if __name__ == "__main__":
main()