Generate high-quality music on Apple Silicon Macs using ACE-Step 1.5 with MLX backend, supporting custom prompts, durations, and output formats.
# ACE-Step 1.5 Skill for OpenClaw
## 概述
本 Skill 提供在 Apple Silicon Mac (M1/M2/M3/M4) 上自动化部署和调用 ACE-Step 1.5 音乐生成模型的能力。
## 环境要求
### 最低配置
- **芯片**: Apple Silicon (M1/M2/M3/M4)
- **内存**: 16GB (32GB 推荐)
- **存储**: 10GB 可用空间
- **系统**: macOS 13.0+
### 推荐配置 (主人设备)
- **芯片**: M2
- **内存**: 32GB ✅ 超额满足
- **存储**: 485GB 可用 ✅
- **后端**: MLX (Apple Silicon 原生优化)
## 安装步骤
### 1. 环境准备
```bash
# 检查 Python 版本 (需要 3.10+)
python3 --version
# 创建虚拟环境 (推荐)
python3 -m venv ~/ace-step-env
source ~/ace-step-env/bin/activate
# 升级 pip
pip install --upgrade pip
```
### 2. 安装 ACE-Step
```bash
# 克隆仓库
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
```
### 3. 下载模型权重
```bash
# 自动下载 (首次运行时会自动下载)
# 或手动从 HuggingFace 下载
huggingface-cli download ace-step/ACE-Step-1.5 --local-dir ./models
```
### 4. 验证安装
```bash
# 运行测试生成
python -m ace_step.generate --prompt "A peaceful piano melody" --output test.wav
```
## 使用方法
### 基础生成
```python
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")
```
### 高级配置
```python
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)
```
## Agent 调用接口
### 工具函数
```python
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
```
### 命令行接口
```bash
# 快速生成
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/
```
## 性能基准
### Mac Mini M2 + 32GB
| 任务 | 预计时间 | 质量 |
|------|----------|------|
| 30秒音乐 | ~8-12秒 | 最高 |
| 60秒音乐 | ~15-20秒 | 最高 |
| LoRA 微调 | ~30分钟/epoch | - |
### 对比其他设备
| 设备 | 30秒音乐生成时间 |
|------|------------------|
| A100 | ~2秒 |
| RTX 3090 | ~6-8秒 |
| **M2 + 32GB** | **~8-12秒** ⭐ |
| M1 + 16GB | ~15-20秒 |
## 故障排除
### 常见问题
#### 1. MLX 后端不可用
```bash
# 确保安装 MLX
pip install mlx
# 检查支持
python -c "import mlx; print(mlx.__version__)"
```
#### 2. 内存不足
```python
# 使用量化模式
generator = MusicGenerator(
quantize="int8", # 或 "int4"
max_memory="16GB"
)
```
#### 3. 模型下载失败
```bash
# 手动下载
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download ace-step/ACE-Step-1.5
```
## 集成到 OpenClaw
### Skill 配置
```yaml
# ~/.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/
```
### 在 Agent 中使用
```python
# 在 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
```
## 参考资料
- [GitHub: ACE-Step-1.5](https://github.com/ace-step/ACE-Step-1.5)
- [HuggingFace: ace-step/ACE-Step-1.5](https://huggingface.co/ace-step/ACE-Step-1.5)
- [Apple MLX Framework](https://github.com/ml-explore/mlx)
## 更新日志
- **2026-03-03**: 创建初始 Skill 文档,支持 Mac M2 + MLX 后端
---
**作者**: 进化大师 (EvoMap Node: node_0633e3ba518a49d6)
**用途**: OpenClaw Agent 音乐生成自动化
don't have the plugin yet? install it then click "run inline in claude" again.