Nodes/XB_ToolBox/XB-BOX - 🎵 音频切片V2(双人)
ComfyUI Node

XB-BOX - 🎵 音频切片V2(双人)

Stitch two voice clips into one track, gap and all

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-BOX - 🎵 音频切片V2(双人)
    • combined_audio
    • total_frames
    • fps
    • audio1
    • frames1
    • audio2
    • frames2
    audio1
    fps25
    start10.00
    end110.00
    audio2
    start20.00
    end210.00
    gap_frames25
    total_display0 帧

    Two-person dialogue is where single-file slicing stops being enough. You have Speaker A's line and Speaker B's line as two separate recordings, and what you actually need for the video is one continuous audio track: A speaks, a beat of silence, B speaks. XB_AudioSlicerV2 is purpose-built for exactly that - two independent slices plus a gap_frames gap, all merged into a single AUDIO output with a total frame count you can feed straight to a video model.

    This is the "双人" (two-person) node in XB_ToolBox's audio-slicer family. If you've ever faked a two-voice track by rendering two videos and praying they sync, this replaces the whole dance.

    How it works

    Each of the two inputs gets the same treatment as the single slicer: decode, mono downmix, clamp your start/end to the file, and snap the frame count to the 4N+1 rule video models like Wan expect. Then the node:

    1. Cuts audio1 between start1/end1.
    2. Cuts audio2 between start2/end2.
    3. Inserts a silent gap of gap_frames frames between them (default 25 - one second at the default fps).
    4. Concatenates the three pieces and reports the total in frames.

    Because every segment is individually 4N+1-snapped and the gap is expressed in frames, the combined track is a clean, deterministic length. No floating-point drift between the audio samples and the video's frame counter.

    The inputs that matter

    • audio1 / audio2 - dropdowns of files in ComfyUI/input. Drop both recordings there.
    • start1 / end1, start2 / end2 - per-speaker in/out points in seconds.
    • gap_frames - the pause between speakers in frames, default 25 (1s at 25fps). Raise it for a more conversational pause, lower it to 0 for back-to-back lines.
    • fps - default 25. Shared across both slices and the gap.

    Outputs worth naming: combined_audio (the merged track), total_frames (INT), fps, and then per-speaker audio1/frames1 and audio2/frames2 - the individual slices, in case you want to do anything else with them separately. The total_frames output is what you wire into a segment_length input.

    Installing

    It's in XB_ToolBox - install the pack once and the whole family appears. ComfyUI Manager, search XB_ToolBox, or:

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

    then restart. PyAV (av) handles decoding; it's in the pack's requirements.txt and normally already installed.

    Common issues

    • Only one voice in the output - check you didn't leave one audio dropdown on none; that silently produces an empty slice.
    • Gap feels wrong - gap_frames is in frames, not seconds. At 25fps, 25 frames = 1 second. At 24fps it's slightly longer, so the number is not "seconds."
    • Voices overlap or start too late - double-check start2/end2 against the second file's own timeline, not the combined one.

    The honest limitation: V2 is relay-only, A then B, one gap. If you need per-track silences inside a line (drop a word, mute a section) or an actual overlap between voices, V3 is the advanced variant that adds mute regions and a merge mode.

    CategoryXB_ToolBox/Audio

    Inputs (9)

    NameTypeDefaultDescription
    audio1COMBO1 options: none
    fpsFLOAT251–120
    start1FLOAT0.000–99999
    end1FLOAT10.000–99999
    audio2COMBO1 options: none
    start2FLOAT0.000–99999
    end2FLOAT10.000–99999
    gap_framesINT250–99999
    total_displaySTRING0 帧

    Outputs (7)

    NameTypeDescription
    combined_audioAUDIO
    total_framesINT
    fpsFLOAT
    audio1AUDIO
    frames1INT
    audio2AUDIO
    frames2INT