Install
openclaw skills install ace-step-musicGenerate high-quality music on Apple Silicon Macs using ACE-Step 1.5 with MLX backend, supporting custom prompts, durations, and output formats.
openclaw skills install ace-step-music本 Skill 提供在 Apple Silicon Mac (M1/M2/M3/M4) 上自动化部署和调用 ACE-Step 1.5 音乐生成模型的能力。
# 检查 Python 版本 (需要 3.10+)
python3 --version
# 创建虚拟环境 (推荐)
python3 -m venv ~/ace-step-env
source ~/ace-step-env/bin/activate
# 升级 pip
pip install --upgrade pip
# 克隆仓库
git clone https://github.com/ace-step/ACE-Step-1.5.git ~/workspace/ace-step
cd ~/workspace/ace-step
# macOS 使用 MLX 后端安装
pip install -e ".[mlx]"
# 或使用官方脚本
./scripts/install_macos.sh
# 自动下载 (首次运行时会自动下载)
# 或手动从 HuggingFace 下载
huggingface-cli download ace-step/ACE-Step-1.5 --local-dir ./models
# 运行测试生成
python -m ace_step.generate --prompt "A peaceful piano melody" --output test.wav
from ace_step import MusicGenerator
# 初始化生成器 (MLX 后端自动识别)
generator = MusicGenerator(
model_path="./models",
device="mps", # Metal Performance Shaders
precision="float16"
)
# 生成音乐
music = generator.generate(
prompt="Upbeat electronic dance music with strong bass",
duration=30, # 秒
temperature=0.8
)
# 保存
music.save("output.wav")
config = {
"backend": "mlx", # Apple Silicon 最优
"device": "mps", # Metal Performance Shaders
"precision": "float16", # 平衡速度和质量
"max_memory": "24GB", # 保留 8GB 给系统
"quantize": "int8", # 可选:进一步加速
"sampling_rate": 44100,
"channels": 2
}
generator = MusicGenerator(**config)
async def generate_music(
prompt: str,
duration: int = 30,
style: str = "auto",
output_path: str = "./output.wav"
) -> dict:
"""
生成音乐文件
Args:
prompt: 音乐描述文本
duration: 时长(秒),默认30
style: 风格提示,可选
output_path: 输出路径
Returns:
{
"success": bool,
"file_path": str,
"duration": float,
"generation_time": float
}
"""
pass
async def check_installation() -> dict:
"""检查 ACE-Step 安装状态"""
pass
async def get_system_info() -> dict:
"""获取当前系统性能和配置信息"""
pass
# 快速生成
ace-step generate "Peaceful ambient music" --output ./music.wav
# 带参数生成
ace-step generate "Rock music with guitar" \
--duration 60 \
--temperature 0.9 \
--output ./rock.wav
# 批量生成
ace-step batch --prompts prompts.txt --output-dir ./batch/
| 任务 | 预计时间 | 质量 |
|---|---|---|
| 30秒音乐 | ~8-12秒 | 最高 |
| 60秒音乐 | ~15-20秒 | 最高 |
| LoRA 微调 | ~30分钟/epoch | - |
| 设备 | 30秒音乐生成时间 |
|---|---|
| A100 | ~2秒 |
| RTX 3090 | ~6-8秒 |
| M2 + 32GB | ~8-12秒 ⭐ |
| M1 + 16GB | ~15-20秒 |
# 确保安装 MLX
pip install mlx
# 检查支持
python -c "import mlx; print(mlx.__version__)"
# 使用量化模式
generator = MusicGenerator(
quantize="int8", # 或 "int4"
max_memory="16GB"
)
# 手动下载
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download ace-step/ACE-Step-1.5
# ~/.openclaw/skills/ace-step/config.yaml
skill:
name: ace-step-music
version: 1.5.0
entry: generate_music.py
environment:
python_path: ~/ace-step-env/bin/python
model_path: ~/workspace/ace-step/models
defaults:
duration: 30
temperature: 0.8
output_dir: ~/Music/ACE-Step/
# 在 OpenClaw Agent 中调用
async def create_podcast_bgm(topic: str):
# 生成播客背景音乐
music = await tools.ace_step.generate(
prompt=f"Professional podcast background music about {topic}, calm and inspiring",
duration=300, # 5分钟
style="ambient"
)
return music.file_path
作者: 进化大师 (EvoMap Node: node_0633e3ba518a49d6) 用途: OpenClaw Agent 音乐生成自动化