← Back to Skills Marketplace
andyrenxu7255

Ai Songwriter

by Andy Ren · GitHub ↗ · v3.0.2 · MIT-0
cross-platform ✓ Security Clean
81
Downloads
0
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install ai-songwriter-renxu
Description
AI歌曲创作核心技能 — 合辙押韵歌词创作 + MiniMax mmx-cli 正确调用 + 歌词验证 + 歌曲生成全流程。包含押韵规范、mmx模型路由、音乐生成参数、文件发送。当用户要求写歌/创作歌曲/生成音乐时激活。
README (SKILL.md)

AI歌曲创作核心技能

技能分支

ai-songwriter(核心)
├── poetry/        古诗词谱曲子技能(保留原文 + 递进押韵)
└── thematic/      主题歌曲子技能(客户/景点调研 → 写入歌词)

全流程标准链路

所有写歌请求必须严格按以下顺序执行:

  1. 需求整理:确认主题、风格、情绪、受众、语言
  2. 路由子技能
    • 古诗词相关 → poetry/
    • 企业/客户/景点/品牌相关 → thematic/
    • 其他 → 本核心技能直接处理
  3. 歌词创作:按押韵规范创作歌词
  4. 押韵验证:用 Python 脚本逐句检查
  5. 时长计算:预估时长,不足 3 分钟则补足
  6. 歌词确认:输出歌词草案 + 预计时长 + 是否 repeat → 等用户确认
  7. 音频生成:用户确认后执行 mmx music generate
  8. 文件发送:生成后通过正确方式发送给用户

⚠️ 未经用户确认歌词,不得直接生成音频。这是硬规则。


核心原则:合辙押韵

押韵模式 A(全韵统一)⭐

选定一个韵母后,每一句最后一个字都必须发该韵。

韵母 常见安全字
-ang 光/望/扬/荡/长/忙/香/霜/央/黄/苍/场/昌
-in 心/亲/情/金/新/林/琴/音
-ai 爱/来/白/海/开/才
-ou 楼/舟/流/秋/游/留/悠/收/投/酬
-an 山/寒/难/残/叹/关/湾/前

押韵模式 B(诗词格律)

第三句不押韵(白脚),一、二、四句押韵。适用于古诗词改编。

押韵验证脚本

def validate_rhyme(lyrics_text, rhyme_set, poem_lines=None):
    """验证押韵
    Args:
        lyrics_text: 歌词字符串(多行)
        rhyme_set: 押韵字集合
        poem_lines: 原诗锚点集合,默认None表示无锚点
    """
    if poem_lines is None:
        poem_lines = set()
    lines = [l.strip() for l in lyrics_text.strip().split('\
') if l.strip()]
    errors = []

    for i, line in enumerate(lines):
        pos_in_stanza = (i % 4) + 1
        is_white = (pos_in_stanza == 3)
        last_char = line[-1]

        if line in poem_lines:
            continue

        if is_white:
            ok = last_char not in rhyme_set
            note = f"✓ 白脚" if ok else f"✗ 白脚'{last_char}'押韵了"
        else:
            ok = last_char in rhyme_set
            note = f"✓" if ok else f"✗ '{last_char}'不押韵"

        if not ok:
            errors.append((i+1, line, last_char, note))
        print(f"{'✓' if ok else '✗'} 第{i+1:2d}句 {line} → {last_char} {note}")

    return errors

常见错误字

目标韵 容易混入的错误字
-ang 月/前/向/星/心/梦/声/里/思
-ou 心/情/声/美/歌/路

mmx-cli 正确调用

模型路由

任务 模型 命令
歌词生成 lyrics_generation mmx text chat --model lyrics_generation
歌曲生成 music-2.6 mmx music generate --model music-2.6
语音合成 speech-2.8-hd mmx speech synthesize --model speech-2.8-hd
图片生成 image-01 mmx image generate --model image-01
视频生成 hailuo-2.3 mmx video generate --model hailuo-2.3

⚠️ 必须指定 --model:music-2.6 而非 music-2.5。

歌词生成(第一阶段)

mmx text chat \
  --message "为主题'xxx'创作歌曲歌词。全程押韵(韵脚自选,如-ang/-in/-ai/-ou/-an等),每段4句。" \
  --model lyrics_generation \
  --non-interactive \
  --quiet

⚠️ lyrics_generation 是独立文本模型,不是 mmx music 子命令! ⚠️ 如果 lyrics_generation 返回空内容,换用 mmx text chat --model MiniMax-M2.7 作为备用。

歌曲生成(第二阶段)

mmx music generate \
  --prompt "音乐风格描述" \
  --lyrics "歌词文本" \
  --vocals "人声描述" \
  --model music-2.6 \
  --out song.mp3 \
  --non-interactive \
  --quiet

歌词结构标签(可选): mmx music generate 支持以下结构标签:[Intro] [Verse] [Pre Chorus] [Chorus] [Interlude] [Bridge] [Outro] [Post Chorus] [Transition] [Break] [Hook] [Build Up] [Inst] [Solo]。标签必须干净(括号内不要加描述),标签会被演唱出来。

长歌词(48句+)用异步模式:

mmx music generate \
  --prompt "..." --lyrics "..." --vocals "..." \
  --model music-2.6 \
  --out song.mp3 \
  --async --non-interactive --quiet

⚠️ --async 不带 --output json,否则报错。

也可以用 --lyrics-file 代替 --lyrics,读取本地歌词文件:

mmx music generate \
  --prompt "..." --lyrics-file /path/to/lyrics.txt --vocals "..." \
  --model music-2.6 \
  --out song.mp3 \
  --async --non-interactive --quiet

风格 Prompt 示例

古诗词风格(慢板悠扬):

古诗词风格,慢板,悠扬沉郁,古琴独奏为主,箫声点缀,
节奏舒缓如行云流水,歌声要有气势有情感,字正腔圆,中速偏慢

温暖企业歌曲风格:

温暖积极的企业歌曲,节奏明快,充满希望和凝聚力,
现代企业宣传片风格,副歌更有推动感,适合合唱

景点歌曲风格:

古风景点歌曲,笛子为主,箫声点缀,
悠扬悠远,仿佛山水画卷展开

声线参数

期望声线 --vocals 示例
童声 "sweet innocent child vocal"
女声 "bright female soprano"
男声 "warm male baritone, father singing"
合唱 "choir, uplifting chorus"

时长控制

最短 最长 目标
3分钟 5分钟 3:00 ~ 5:00
预估时长 ≈ 歌词总句数 × 3.2秒/句
24句 → 约77秒(明显不够)
48句 → 约2分34秒(仍偏短)
56句 → 约2分59秒(下限边缘)
60~92句 → 推荐交付区间

硬规则: 如果首版歌词不足 3 分钟,必须扩写或重复主结构后再交付确认稿。 补足优先级: 重复副歌 → 增加主歌 → 增加 Bridge → 整首 repeat。


歌词确认机制

在执行 mmx music generate 前,必须先把歌词文本发给用户确认。

流程固定为:

  1. 输出歌词草案
  2. 标注预计时长
  3. 明确说明是否采用 repeat 扩时
  4. 等用户确认后,再生成音频

未确认歌词前,不得直接生成歌曲。


歌词交付格式

必须:纯文本歌词,一行一句,禁止包含结构标签(如[Verse][Chorus])和说明文字。

⚠️ 以上是用户确认稿格式。确认后传给 mmx music generate 时,歌词仍然保持纯文本(无结构标签),--prompt 中已包含风格描述,模型会根据上下文自行安排结构。


文件发送

企业微信(wecom)

当通道为 wecom 时,使用 message 工具直发本地附件:

推荐参数:

  • action: "send"
  • channel: "wecom"
  • target: "wecom:\x3Cuserid>"
  • media + filePath: 本地绝对路径
  • filename: 显式文件名(如 song.mp3
  • mimeType: 如 audio/mpeg
  • forceDocument: true

发送前检查:

  • 文件存在
  • 使用绝对路径
  • 文件大小 ≤ 20MB
  • MIME 正确

⚠️ 不要只输出 MEDIA: 路径。 如果 MEDIA: 在该会话不稳定,直接用 message 工具。

飞书

# 第一步:获取 token
TOKEN=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
  -H "Content-Type: application/json" \
  -d "{\"app_id\":\"$FEISHU_APP_ID\",\"app_secret\":\"$FEISHU_APP_SECRET\"}" \
  | python3 -c "import sys,json; print(json.load(sys.stdin)['tenant_access_token'])")

# 第二步:上传文件
UPLOAD_RESP=$(curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/files" \
  -H "Authorization: Bearer $TOKEN" \
  -F "file_name=song.mp3" -F "file_type=stream" \
  -F "file=@/path/to/song.mp3;type=audio/mpeg")
FILE_KEY=$(echo $UPLOAD_RESP | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['file_key'])")

# 第三步:发送
curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=chat_id" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"receive_id\":\"$CHAT_ID\",\"msg_type\":\"file\",\"content\":\"{\\\"file_key\\\":\\\"$FILE_KEY\\\"}\"}"

其他通道

默认使用 MEDIA:\x3C绝对路径> 在回复中交付。


已知问题与解法

押韵合规率低

  • AI 生成的歌词押韵合规率约 75%
  • 必须用 Python 脚本逐行验证尾字
  • 合规率低于 30% 时,直接手工创作

歌词生成模型不稳定

  • lyrics_generation 可能返回空内容(exit 0 但 content 为空)
  • 遇到此情况,换用 MiniMax-M2.7 作为备用

音乐生成超时

  • 48句+ 长歌词容易超时
  • 解法:--async 模式 + 轮询检查文件是否生成

粤语问题

  • MiniMax music-2.6 不支持真正的粤语演唱
  • 即使 prompt 写"粤语",实际输出仍是普通话

审查清单

□ 每句尾字是否都是目标韵母?
□ 是否有字重复出现?(特别是句尾)
□ 每段是否都是4句?
□ 预计时长是否在3:00-5:00之间?
□ 是否已先把歌词草案发给用户确认?
□ 若长度不足,是否已通过扩写/重复主结构补足?
□ 是否指定了 --model music-2.6?
□ --vocals 是否描述了期望的声线?
□ 生成后是否验证了押韵?
□ 歌词是否纯文本交付(无结构标签)?
□ 生成后是否通过正确方式发送文件给用户?
Usage Guidance
Install if you are comfortable letting the agent use MiniMax/mmx to generate songs and send the resulting audio file through your current chat channel. Use trusted mmx tooling, scoped credentials, and double-check shared-channel destinations before confirming generation.
Capability Analysis
Type: OpenClaw Skill Name: ai-songwriter-renxu Version: 3.0.2 The ai-songwriter-renxu skill bundle is a well-structured and functional set of instructions for an AI agent to generate lyrics, validate rhymes, and produce audio using the MiniMax API. It includes specialized sub-skills for classical poetry and thematic/corporate songwriting, utilizing Python scripts for local rhyme validation and the 'mmx' CLI for music generation. The delivery logic in SKILL.md and delivery/SKILL.md provides standard procedures for sending files via platforms like WeCom and Feishu, using official API endpoints (e.g., open.feishu.cn). No evidence of malicious intent, data exfiltration, or harmful prompt injection was found; the instructions are strictly aligned with the stated creative and delivery purposes.
Capability Tags
cryptorequires-sensitive-credentials
Capability Assessment
Purpose & Capability
The requested capabilities—writing lyrics, validating rhyme, generating audio with MiniMax/mmx, and sending the finished file—fit the stated songwriting purpose.
Instruction Scope
The skill clearly requires user confirmation before audio generation, but after generation it instructs the agent to send the file immediately through the current channel.
Install Mechanism
The package is instruction-only and does not include or pin the mmx CLI, while SKILL.md declares mmx as required.
Credentials
MiniMax API credentials and optional messaging-service credentials are purpose-aligned, but the registry metadata says no required env vars or primary credential.
Persistence & Privilege
No background persistence, self-propagation, broad local indexing, or hidden long-running worker behavior is shown in the provided artifacts.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install ai-songwriter-renxu
  3. After installation, invoke the skill by name or use /ai-songwriter-renxu
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v3.0.2
v3.0.2: 修正示例消息,不再固定 -ang 韵脚,改为'韵脚自选(如-ang/-in/-ai/-ou/-an等)',支持其他韵母
v3.0.1
v3.0.1: 修正 -ang 韵错误字列表,响/唱 韵母为 -ang(正确押韵),已移除
v3.0.0
v3.0 — 2026-05-13: Fix mmx model names (speech-2.8-hd, hailuo-2.3), remove invalid --output json from lyrics_generation, add music-2.6 full structure tag list, unify sub-skill versions to 3.0. Requires mmx-cli and MINIMAX_CN_API_KEY.
Metadata
Slug ai-songwriter-renxu
Version 3.0.2
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 3
Frequently Asked Questions

What is Ai Songwriter?

AI歌曲创作核心技能 — 合辙押韵歌词创作 + MiniMax mmx-cli 正确调用 + 歌词验证 + 歌曲生成全流程。包含押韵规范、mmx模型路由、音乐生成参数、文件发送。当用户要求写歌/创作歌曲/生成音乐时激活。 It is an AI Agent Skill for Claude Code / OpenClaw, with 81 downloads so far.

How do I install Ai Songwriter?

Run "/install ai-songwriter-renxu" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Ai Songwriter free?

Yes, Ai Songwriter is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Ai Songwriter support?

Ai Songwriter is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Ai Songwriter?

It is built and maintained by Andy Ren (@andyrenxu7255); the current version is v3.0.2.

💬 Comments