ACE-Step 1.5 is an open, MIT-licensed model that generates music from a text description and optional lyrics. It runs locally on consumer graphics cards, which makes quick experiments with menu or level music possible in a game prototype. This article covers the architecture, the Python API, the parameters, keeping a provenance record and bringing the generated audio into a game.
Architecture: a DiT and a 5Hz language model
The model has two parts. A diffusion transformer (DiT) generates the audio, and a Qwen3-based 5Hz language model turns the request into a plan: it expands the description, fills in details such as BPM, key and structure, and guides the DiT. The language model comes in 0.6B, 1.7B and 4B sizes; the small one needs less memory.
The turbo DiT model produces a result in 8 steps without classifier-free guidance; the base and sft models run with around 50 steps and CFG. The project supports running with under 4 GB of graphics memory and generating tracks between 10 and 600 seconds long. The code is MIT-licensed and the project states that generated music can be used commercially; listening to tracks before release is still good practice.
A first generation with the Python API
The DiT and the language model are initialized with separate handlers, AceStepHandler and LLMHandler. The handlers take the model folder, the configuration name and the device as parameters. The language model can use a PyTorch, vLLM or, on Apple devices, MLX back end. Initialize once, then run several generations with the same handlers.
GenerationParams holds the content of the music and GenerationConfig holds the generation settings. generate_music returns a result object: success reports the outcome, error carries the error message, and the audios list carries each track's file path and the parameters used, including the seed. For an instrumental track, put [Instrumental] in the lyrics field.
from acestep.handler import AceStepHandler
from acestep.llm_inference import LLMHandler
from acestep.inference import GenerationParams, GenerationConfig, generate_music
dit = AceStepHandler()
dit.initialize_service(project_root="D:/tools/ACE-Step-1.5",
config_path="acestep-v15-turbo", device="cuda")
llm = LLMHandler()
llm.initialize(checkpoint_dir="D:/tools/ACE-Step-1.5/checkpoints",
lm_model_path="acestep-5Hz-lm-0.6B",
backend="pt", # "vllm", "pt" or "mlx"
device="cuda")
params = GenerationParams(
caption="calm ambient synth for a space station menu, soft pads, slow arpeggio",
lyrics="[Instrumental]",
bpm=84, keyscale="Am", timesignature="4", duration=90,
)
config = GenerationConfig(batch_size=2, use_random_seed=False, seeds=[11, 22],
audio_format="wav")
result = generate_music(dit, llm, params, config, save_dir="out/music")
if not result.success:
raise SystemExit(result.error)
for audio in result.audios:
print(audio["path"], audio["params"]["seed"])ACE-Step 1.5 — Inference guide
Parameters and limits
caption is limited to 512 characters and lyrics to 4096. bpm takes 30–300 and duration 10–600 seconds. keyscale takes a key such as "C Major" or "Am", and timesignature takes the numerator of the time signature, such as "3" or "4". The language model fills in fields left empty with its own plan; game music usually sets tempo and duration explicitly.
inference_steps ranges from 1 to 20 on the turbo model, with 8 recommended; the turbo shift value is 3.0. guidance_scale only matters for non-turbo models. batch_size from 1 to 8 produces several candidates from one prompt, and a seeds list with use_random_seed=False makes results repeatable in the same environment. audio_format selects the output format.
Text-only generation versus cover and repaint
In text-to-music mode, a track is generated only from the description and lyrics. Cover mode keeps the structure of a track passed in src_audio and produces a new timbre; audio_cover_strength sets how closely it follows the source. Repaint regenerates a specific time range of a track, and reference_audio provides a reference sound for style. These modes skip the language model's planning step.
Modes that take source audio make it easy to feed in someone else's recording, which brings copyright and license questions into the generation itself. Text-only generation does not depend on a recording of unclear origin, so record keeping and license statements stay simple. Cover and repaint remain useful for reworking your own compositions or earlier generations.
A provenance record
Write a record file next to every track: the model and language model names, the description, lyrics, BPM, key, duration, seed, step count and the SHA-256 hash of the output file. AI content disclosures on stores and license audits are answered from this file.
The record also lists post-processing: conversion to MP3, level adjustment and the loop point. Because the file name and the hash are stored together, you can always verify which generation an audio file in the game came from. If the record shares the audio file's base name, the pairing survives when files are moved.
import hashlib, json, pathlib
def write_provenance(audio_path, params, seed, model="acestep-v15-turbo",
lm="acestep-5Hz-lm-0.6B", steps=8, postprocess=None):
path = pathlib.Path(audio_path)
record = {
"file": path.name,
"sha256": hashlib.sha256(path.read_bytes()).hexdigest(),
"generator": "ACE-Step 1.5", "model": model, "lm": lm,
"caption": params.caption, "lyrics": params.lyrics,
"bpm": params.bpm, "keyscale": params.keyscale,
"duration": params.duration, "seed": seed, "steps": steps,
"postprocess": postprocess or [],
}
out = path.with_suffix(".provenance.json") # menu.wav -> menu.provenance.json
out.write_text(json.dumps(record, indent=2, ensure_ascii=False), encoding="utf-8")
return outFrom WAV to MP3 and into the game
Generate WAV and convert to the final format in a separate step, so the lossless original stays in the archive. lameenc is a small package that brings the LAME encoder to Python; samples read with soundfile are converted to 16-bit integers and passed to the encoder. The script can run with uv run --with lameenc --with soundfile --with numpy, without setting up a permanent virtual environment.
In Godot, the loop option in the MP3 import settings makes music loop, and loop_offset sets where the loop restarts. Keep the perceived loudness of tracks close to each other; otherwise music jumps in volume when moving from the menu into the game. Play music on its own audio bus and tie it to the player's volume setting.
# uv run --with lameenc --with soundfile --with numpy to_mp3.py
import lameenc
import numpy as np
import soundfile as sf
def to_mp3(wav_path, mp3_path, bitrate=192):
data, rate = sf.read(wav_path, dtype="float32", always_2d=True) # frames x channels
pcm = (np.clip(data, -1.0, 1.0) * 32767).astype("<i2")
enc = lameenc.Encoder()
enc.set_bit_rate(bitrate)
enc.set_in_sample_rate(rate)
enc.set_channels(data.shape[1])
enc.set_quality(2) # 2 = highest quality, 7 = fastest
mp3 = enc.encode(pcm.tobytes()) + enc.flush()
with open(mp3_path, "wb") as f:
f.write(mp3)
to_mp3("out/music/menu.wav", "out/music/menu.mp3")Godot — Importing audio samples
Related technical articles
- Local image generation with FLUX.1 schnell and stable-diffusion.cpp
- Procedural audio: PCM samples, WAV files and Godot audio buses
- Godot 4 and C#: node lifecycle, signals and the main thread
- Godot InputMap and gamepads: actions, axes and device switching
- Deterministic simulation: xoshiro256**, stable hashing and lockstep