Nodes/XB_ToolBox/XB-BOX - 🎵 YuE2 乐谱工作台
ComfyUI Node

XB-BOX - 🎵 YuE2 乐谱工作台

The YuE2 Score Workbench

By wjluoxiao·Created 7 months ago·Updated a day ago· 406
XB-BOX - 🎵 YuE2 乐谱工作台
    • abc
    • 报告
    ◄操作只查看 / Inspect►
    ◄和声处理保留和弦 / Keep Chords►
    ◄重叠处理人声优先 / Vocal Priority►
    ◄编辑框►
    ◄abc—►

    Most music models give you a black box: prompt in, audio out, bad bar in the middle, re-roll and pray. YuE2 isn't built that way. It plans an editable ABC score first and renders audio from that score, so there's an intermediate object you can read and edit - which is exactly what makes this node useful. XB-BOX - 🎵 YuE2 乐谱工作台 (Score Workbench) takes a score and does a handful of symbolic operations on it, then hands it back. No render, no re-roll.

    One thing to internalise before you start: the score carries no instruments. If you want a guitar instead of a piano, that's the Style Prompt node's job. The workbench only touches notes, chords and timing.

    Inputs and outputs

    The required inputs are 操作 / Operation and its sidekicks, plus the editing box; abc is the optional upstream score (the abc output of YuE2GenerateABC, or whatever the transcription intake gave you). Outputs are abc - for the official music node, or back into another pass - and 报告 / Report.

    The report's first line is the mode suggestion. That's the practical bit: read it before you render, because it tells you whether this score wants full (harmony present) or melody (a bare melody line). Widgets that don't apply to your chosen operation hide themselves, so the panel stays short.

    The five operations

    只查看 / Inspect validates the score and writes a report without touching it. The most valuable diagnostic here is truncation: a score cut off mid-phrase fails structure validation outright, which is how you find out the planner ran out of tokens before you blame the renderer.

    去掉和弦 / Strip Chords deletes the chord symbols from the Vocal voice. Do that and the downstream mode has to be melody, since melody mode rejects any chord symbol. Your accompaniment gets regenerated freely in whatever style you chose.

    人声移到器乐轨 / Vocal to Ins moves the sung melody onto the Ins track and leaves Vocal holding chords and rests. Only the melody moves; nothing about instruments changes. Two conditionals appear with it:

    • 和声处理 / Harmony - keep the chords on the score (then downstream mode must be full, and you can keep editing the harmony) or drop them (then melody).
    • 重叠处理 / Overlap - what to do when the moved melody collides with existing Ins notes. Vocal Priority is the official default: Ins gets shortened to make room. Error Out fails instead, so you can go fix the collision by hand rather than silently clipping someone's riff.

    用编辑框 / Use Edited takes a score you edited by hand in 编辑框 / Edited ABC, revalidates it, and diffs it against the upstream score so you can see exactly what you changed.

    编译事件 / Compile Events is the odd one out: paste an official events.json into the edit box and it compiles a legal score from the events, using the same event compiler the instrumental path uses. The format, per the widget's own tooltip, with times measured in quarter notes as integers or fraction strings like "3/2":

    {"bpm":81,"key":"Bm","bars":[{"meter":"4/4","section":"verse"},{}],
     "notes":[[0,1,71],[1,"1/2",74]],
     "chords":[[0,"Bm"]]}
    

    Single melody only - no stacked or overlapping notes. Out-of-range pitches, conflicting chords and durations the notation can't express all raise errors rather than getting quietly rounded off.

    Where people get burned

    • A score still holding chords fed into melody mode. Immediate rejection, and it looks like the render node is broken.
    • Expecting the diff to prove musical correctness. It proves the notes you intended are in the score you're rendering. It says nothing about whether the score sounds like what you imagined.
    • Reaching for the workbench to change instruments. It won't. Style node, every time.
    • Assuming the error messages are the node's own. They're the official validator's, passed through verbatim - which is deliberate, and worth reading rather than skimming.

    Install

    Search XB_ToolBox in ComfyUI Manager, or clone it and restart:

    cd ComfyUI/custom_nodes
    git clone https://github.com/wjluoxiao/XB_ToolBox.git
    

    You'll need a ComfyUI build with the native YuE2GenerateABC / YuE2GenerateMusic nodes, since this only emits strings. The ABC parsing is an in-node port of the official bounded-dialect implementation and uses the standard library only, so it works offline and doesn't drag in the pack's optional dependency pile.

    CategoryJZL/YuE2

    Inputs (5)

    NameTypeDefaultDescription
    操作COMBO只查看 / Inspect只查看:仅校验并出报告,谱面不动。也能用来发现谱面被截断(截断的谱面结构校验会直接失败)。 去掉和弦:删掉 Vocal 声部的和弦记号(下游 mode 要选 melody)。 人声移到器乐轨:把唱旋律搬到 Ins 轨、Vocal 清空留和弦与休止(只搬旋律,不改乐器)。 用编辑框:改用手工修改的谱面并重新校验,同时列出与上游的差异。 编译事件:编辑框里贴官方 events.json(同 instrumental 的事件编译器),由事件生成一份合法谱面。 无关选项会自动隐藏
    和声处理COMBO保留和弦 / Keep Chords仅「人声移到器乐轨」时生效。 保留和弦 → 谱面仍带和弦,下游 mode 必须选 full(可继续改和声)。 去掉和弦 → 下游 mode 必须选 melody(伴奏自由发挥)。 配器(钢琴/吉他等)不在这里设:请用上游「🎵 YuE2 风格提示」的「主奏乐器 / 辅助乐器」
    重叠处理COMBO人声优先 / Vocal Priority仅「人声移到器乐轨」时生效。 人声优先:Vocal 与 Ins 时间重叠时,Ins 被裁短让位(官方默认)。 直接报错:检测到重叠就报错,让你先手工改谱
    编辑框STRING「用编辑框」时放谱面;「编译事件」时放 events.json。 events.json 格式(时间单位=四分音符,只用整数或 "3/2" 这类分数字符串): {"bpm":81,"key":"Bm","bars":[{"meter":"4/4","section":"verse"},{}],"notes":[[0,1,71],[1,"1/2",74]],"chords":[[0,"Bm"]]} 只能单旋律、不能重叠或叠音;越界/冲突和弦/不可表达时值都会报错
    abcoptSTRING上游谱面:接 YuE2GenerateABC 的 abc 输出

    Outputs (2)

    NameTypeDescription
    abcSTRING—
    报告STRING—