Nodes/ComfyUI-aihub-workflow-exposer/AIHub Action New Audio Segment
ComfyUI Node

AIHub Action New Audio Segment

Placing generated audio into an editor's timeline, next to a specific segment

By otavanopisto·Created about a year ago·Updated 22 days ago· 7
AIHub Action New Audio Segment
  • audio
    actionAPPEND
    namenew audio
    reference_segment_id
    reference_segment_actionNEW_AFTER
    formatwav
    file_name
    autoplayfalse

    AIHub Action New Audio Segment is the version of AIHub Action New Audio that cares about where the clip lands. Plain New Audio just hands the generated sound to the client. This one also says "insert it after segment three, replace segment two, or merge it with segment one" - which is exactly what you want when a workflow is generating a piece of a soundtrack inside a DAW or video editor and needs it dropped onto the timeline at the right spot.

    It's the same pack, so the same context applies: otavanopisto's ComfyUI-aihub-workflow-exposer is a bridge that lets external apps drive ComfyUI as their generation engine. Expose nodes pull data in; action nodes push results out over the pack's own websocket (port 8111). This node is one of those outbound pipes, and it does nothing visible unless an aihub client is listening on the other end.

    How it works

    Identical mechanics to New Audio: take the AUDIO tensor, encode it with torchaudio (wav, ogg, or flac), stream the bytes to the client under a NEW_AUDIO_SEGMENT event. The difference is the envelope also carries a reference_segment_id and a reference_segment_action, which is the client's instruction for where in the segment list the new clip goes.

    The inputs that matter

    • audio (required) - the AUDIO tensor to export.
    • reference_segment_id - which existing segment this new clip is positioned against. The client knows its own segment ids; this is where you (or a condition node) feed that value in.
    • reference_segment_action - what to do at that spot: NEW_AFTER, NEW_BEFORE, REPLACE, or MERGE. Merge is the interesting one - it tells the client to composite the new audio onto the referenced segment rather than inserting a new one, which is how you layer generated ambience over existing dialogue.
    • action - the filesystem-level APPEND/REPLACE for the stored file (same as the plain node).
    • name, format (wav/ogg/flac), file_name, autoplay - same as New Audio.

    No outputs. Pure side-effect node.

    Installing it

    Via ComfyUI Manager (search "ComfyUI-aihub-workflow-exposer"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/otavanopisto/ComfyUI-aihub-workflow-exposer
    # restart ComfyUI
    

    No model downloads, no requirements - the pack leans on what ComfyUI already has installed.

    Where people get burned

    Same trap as every action node in this pack: run it in the plain web UI and it looks like it does nothing, because the bytes go out over the aihub websocket to a client that isn't connected. Don't debug "why is my node empty" - verify a client is actually driving the workflow. The other gotcha is semantic: reference_segment_id must match an id the client recognizes, or the segment placement silently falls back to whatever the client does with an unknown reference. Get the id from the client's exposed state, not from memory.

    Categoryaihub/actions

    Inputs (8)

    NameTypeDefaultDescription
    audioAUDIO
    actionCOMBOAPPENDIf append is selected, the audio will be added a number to the name to make it unique, if replace is selected, the audio will be replaced with the new one
    nameSTRINGnew audioThe name of the audio to be used
    reference_segment_idSTRINGThe reference segment id of the audio layer
    reference_segment_actionCOMBONEW_AFTERSpecify the action to execute at the given segment id
    formatoptCOMBOwavThe format to save the audio in
    file_nameoptSTRINGThe filename to use, with the extension, if not given the name value will be used with the given format extension
    autoplayoptBOOLEANfalseIf true, the audio segment will autoplay when added

    Outputs (0)

    No outputs