AbstractMusic
Text-to-music and text-to-audio behind one Python API. The base install is light and calls a remote API (ACE Music by default, or ElevenLabs Music); local models such as ACE-Step XL Turbo and Stable Audio 3 come with explicit extras. Installed next to AbstractCore, it becomes llm.music.
# Remote generation (ACE Music)
pip install abstractmusic
export ACEMUSIC_API_KEY=...
abstractmusic t2m "ambient lo-fi study music" \
--out out.wav --duration 30
# Local ACE-Step
pip install "abstractmusic[acestep]"
A prompt in, audio out
A thin MusicManager sits over a backend object. You keep the same calls when you move from a hosted API to a model running on your machine.
Light, remote-capable base
pip install abstractmusic installs no Torch, Diffusers, Transformers or NumPy. It includes stdlib-only clients for ACE Music and ElevenLabs Music. Output is WAV by default; ACE Music can also return MP3 or FLAC.
Local models, when you ask
Each local runtime is an extra, with [apple] / [gpu] profiles. Weights come from the Hugging Face cache. On Apple Silicon, ACE-Step tries MPS bfloat16, then MPS float32, and uses CPU float32 only as a last resort.
Text planning
A dependency-free planner can enrich a short prompt, add BPM or key hints and write template lyrics (--enhance-prompt, --auto-lyrics). A host can plug in its own planner, for example an LLM through AbstractCore.
apple and gpu profiles. The abstractmusic command is on your PATH (~/.local/bin). To upgrade, re-run the same install line (on a Mac without Terminal, double-click Install AbstractFramework.command again), see Upgrade; on an installer install, the console’s update runs the installer.Generated with AbstractMusic
15-second clips from a text prompt, generated locally through the AbstractMusic API: four with ACE-Step and two with Stable Audio 3.
Ambient
ACE-Step
Epic cinematic
ACE-Step
Jazz
ACE-Step
Pop
ACE-Step
Lo-fi hip hop
Stable Audio 3
Electronic
Stable Audio 3
Remote and local backends
AbstractMusic itself is MIT. Each backend has its own terms: check the provider or model license before commercial use.
| Backend | Runs | Install | Model and terms |
|---|---|---|---|
acemusic (default) | Remote | base | ACE Music hosted API; needs ACEMUSIC_API_KEY. Text-to-music with optional lyrics; WAV, MP3 or FLAC. Output rights follow the provider's terms. |
elevenlabs | Remote | base | ElevenLabs Music only (voice belongs in AbstractVoice); needs ELEVENLABS_API_KEY and may need a paid Music-enabled plan. Accepts composition plans. |
acestep | Local | [acestep] | ACE-Step/acestep-v15-xl-turbo-diffusers, MIT, 8 steps: the validated default. The XL SFT and XL base checkpoints run at about 50 steps. |
stable-audio-3 | Local | [stable-audio-3] | stabilityai/stable-audio-3-small-music, up to 120 s, 44.1 kHz stereo. Gated; Stability AI Community License. Passed 30 s and 120 s validation runs; not recommended until broader and GPU validation. Also Small SFX and the GPU-oriented Medium (up to 380 s). |
stable-audio | Local | [stable-audio] | stabilityai/stable-audio-open-small, clips up to 11 s, suited to short sounds. Gated; Stability AI Community License. |
musicgen | Local | [musicgen] | facebook/musicgen-small. Weights are CC BY-NC 4.0: non-commercial validation only. |
Lyrics and style tags
Pass lyrics (or lyrics="auto"), [Instrumental], and provider-neutral positive_styles / negative_styles for instruments, vocals and mix.
Long pieces
From 45 seconds on, a compact intro/build/bridge/climax/outro section map is added to the prompt by default; --no-structure-prompt turns it off.
Provider discovery
The AbstractCore plugin lists only providers that can run now, without loading weights; provider_details() says why the others cannot (missing key, extra or download).
Your first track
Requires Python 3.10 or later. With the AbstractFramework installer, the abstractmusic command is already on your PATH; otherwise pip install abstractmusic (plus the extra of each local backend).
Command line
# ElevenLabs Music
abstractmusic --backend elevenlabs t2m "cinematic instrumental synth cue" \
--format mp3 --out out.mp3 --duration 30
# Local ACE-Step, with prompt enhancement and template lyrics
abstractmusic --backend acestep t2m "heroic fantasy epic music" \
--enhance-prompt --auto-lyrics --print-plan --out out.wav --duration 30
# Local Stable Audio 3 (accept the model terms on Hugging Face first)
abstractmusic --backend stable-audio-3 t2m "rhythmic space shooter game music" \
--out out.wav --duration 30 --steps 16
# Interactive REPL: /engines, /models, /engine, /duration, /run ...
abstractmusic repl
Remote generation uses MusicManager with AceMusicBackend and its AceMusicBackendConfig (your ACE Music API key); t2m(prompt, duration_s=...) returns the audio as bytes.
Local generation installs abstractmusic[acestep] and gives MusicManager an AceStepBackend with its AceStepBackendConfig; the same backend, called through AbstractCore, is the verified example in the next tab.
from abstractcore import create_llm
llm = create_llm("mlx", model="mlx-community/Qwen3.5-4B-4bit")
music = llm.generate("Calm ambient piano with soft strings, instrumental",
output={"modality": "music", "provider": "acestep", "model": "ACE-Step/acestep-v15-xl-turbo-diffusers"})
open("ambient.wav", "wb").write(music.outputs["music"][0].data)With abstractcore and abstractmusic installed, the plugin is discovered automatically. The text model does not make the audio: any provider works in its place, for example create_llm("ollama", model="qwen3:4b"); the MLX line runs on Apple Silicon.