Nodes/ComfyUI-FL-YuE2/FL YuE2 · Piano Roll
ComfyUI Node

FL YuE2 · Piano Roll

The editor that stops YuE2 being a slot machine

By filliptm·Created 3 days ago·Updated 3 days ago· 9
FL YuE2 · Piano Roll
    • score_abc
    score_abcX:1 T: M:4/4 L:1/16 Q:1/4=88 V: Vocal clef=treble name="Vocal Melody" snm="Vocal" V: Ins clef=treble name="Ins Melody" snm="Inst." K:Am % verse V: Vocal "Am7"z16|"Dm7"z16|"G7"z16|"Cmaj7"z16| V: Ins E2A2c4B2A2G4|F2A2d4c2A2F4|G2B2d4c2B2A4|E2G2c4B2G2E4| % outro V: Vocal "Fmaj7"z16|"Dm7"z16|"E7"z16|"Am7"z16| V: Ins F2A2c4A2G2F4|D2F2A4G2F2D4|E2^G2B4A2G2E4|A8z8|
    incoming_score_abc
    source_score_hash

    Every text-to-music tool has the same failure mode: you type a prompt, you get four minutes of something, and you have no way to say "that's the melody I wanted, but the second chord is wrong." Your only lever is reroll. YuE2 sidestepped this by writing songs as ABC notation - a text score with named voices and chord symbols - and this node is the pack's attempt to make that editable by hand, visually, without you learning ABC first.

    It's an actual piano roll, drawn on the ComfyUI canvas. Click empty space to add a note, drag to move pitch and time, drag the white right-edge handle to resize. Right-click or Delete removes. Snap runs on the familiar quarter/eighth/sixteenth grid, and gaps become rests automatically. Undo/Redo works. Play/Pause previews the current section through a browser synth - a sketchpad, not a preview of what YuE2 will produce - and the metronome is preview-only; neither is sent to the model.

    The score it edits is not a blob. Under the hood you've got two monophonic melody voices - a vocal line and an instrumental line - plus a separate chord lane, which is why the node can tell you that your notes overlap, or refuse a move that would make a voice polyphonic. That's the format's constraint, not editor fussiness: YuE2's score expects monophonic melodies.

    The inputs, and the two that matter

    score_abc is required and comes pre-filled with the pack's eight-bar instrumental example - a Vocal voice that's all rests, an Inst voice playing a real melody, and chord symbols like "Am7". It's the document, stored as a STRING widget.

    incoming_score_abc is the interesting optional one. Wire Compose's score_abc output into it, queue the editor, and the generated score loads into the piano roll for editing. From then on it's live: re-queue with upstream ABC unchanged and your edits survive; change the upstream score and a new one loads. source_score_hash is the fingerprint that makes that decision, and it's saved with the workflow, so reopening a project doesn't clobber your edits. Disconnect the input and the current edited score just stays.

    One output: score_abc, the STRING. It goes into a Compose node's optional score_abc input.

    The wiring people get wrong

    The pattern the README spells out, in order:

    Compose #1 ──score_abc──> Piano Roll ──score_abc──> Compose #2 ──> Render ──> Decode
    

    Never feed the editor's output back into the same Compose node that hands it its input. You get a loop with no defined resolution. Use a second Compose that receives the score and reuses it without writing another one - keep its style and lyrics consistent with the first, since it still passes those through to the render.

    And a practical trick worth stealing: queueing the whole chain does not pause for you to edit. If you want to inspect a score before paying for a render, mute the downstream Render/Decode/audio nodes, queue the Piano Roll, edit, then unmute. Otherwise you'll render a song you were about to fix.

    Working on a whole song

    Beyond drawing notes, the editor handles structure: add bars, duplicate/reorder/remove sections, set tempo, transpose. Transposition is the one to trust - changing Key moves melody notes and chord roots/bass notes by the same interval, so timing and intervals survive intact, and major/minor doesn't get rewritten into a different mode behind your back. Out-of-range transpositions are refused rather than clipped. Sustained notes crossing a section boundary must be shortened before you can rearrange sections, which is annoying exactly once.

    Imports and exports go through ABC; key or meter changes mid-piece mean editing in the Advanced ABC view instead of the grid. Harmony controls start collapsed, and chords stay in the score while hidden.

    Install, and the two things that bite

    Same pack install as everything else here: Manager → search ComfyUI-FL-YuE2, or

    cd ComfyUI/custom_nodes
    git clone https://github.com/filliptm/ComfyUI-FL-YuE2.git
    

    Restart ComfyUI and hard-refresh the browser. The editor's validation is served from a local /fl_yue2/score/validate endpoint; if that endpoint isn't up, you get "editor validation unavailable" and nothing you draw sticks. Same fix after any upgrade of this pack.

    A rejected edit isn't necessarily your mistake. Validation runs through YuE2's own ABC parser, which is structural - so notation that's perfectly legal ABC but not something YuE2 understands gets turned away. And be clear on the boundary: you're steering the model with a score, not dictating a waveform, so audio adherence at render time stays generative. There's no MIDI import/export and no audio transcription; if those were the features you wanted, this isn't the wrapper.

    CategoryFL YuE2

    Inputs (3)

    NameTypeDefaultDescription
    score_abcSTRINGX:1 T: M:4/4 L:1/16 Q:1/4=88 V: Vocal clef=treble name="Vocal Melody" snm="Vocal" V: Ins clef=treble name="Ins Melody" snm="Inst." K:Am % verse V: Vocal "Am7"z16|"Dm7"z16|"G7"z16|"Cmaj7"z16| V: Ins E2A2c4B2A2G4|F2A2d4c2A2F4|G2B2d4c2B2A4|E2G2c4B2G2E4| % outro V: Vocal "Fmaj7"z16|"Dm7"z16|"E7"z16|"Am7"z16| V: Ins F2A2c4A2G2F4|D2F2A4G2F2D4|E2^G2B4A2G2E4|A8z8|
    incoming_score_abcoptSTRINGLoad a generated score for editing. Edits persist until the upstream score changes.
    source_score_hashoptSTRING

    Outputs (1)

    NameTypeDescription
    score_abcSTRING