Nodes/Audio nodes/Load bark speaker .npz
ComfyUI Node

Load bark speaker .npz

How Bark keeps one voice across every generation

By gitmylo·Created 2 years ago·Updated about a year ago· 12
Load bark speaker .npz
    • text
    • coarse
    • fine
    ◄file▾►

    Bark's default voices are fine, but they're a roll of the dice: run the same prompt twice and you can get two completely different people. load_speaker_npz is the fix. It loads a saved speaker file - a .npz with the semantic, coarse, and fine prompt arrays that define a specific voice and delivery - and feeds it into the generation chain so every run sounds like the same person.

    What a "speaker" even is

    A speaker .npz is just three numpy arrays, saved under the keys semantic_prompt, coarse_prompt, and fine_prompt. They're the same kinds of tokens the generation stages produce - the trick is that Bark treats them as history: given a voice's past tokens as context, the model naturally continues in that voice. So a speaker file is effectively a frozen snippet of "this is how this voice sounds," and feeding it to the history inputs of each stage is what pins the voice.

    This node is the load half of the workflow. Its counterpart, save_speaker_npz, writes the files; the pack's models/bark/speakers folder is where both live.

    The input and outputs

    One input, a file dropdown that lists every .npz in ComfyUI/models/bark/speakers/. Put your speaker files there (the pack's README is explicit about that path) and they show up in the list after a refresh.

    It outputs three wires, named exactly like the prompts inside the file:

    • text (BarkSemanticTokens) → into the semantic_history input of bark_text_encode and bark_generate_coarse (the coarse stage uses both histories together).
    • coarse (EncodecCodeBooks) → into bark_generate_coarse's coarse_history.
    • fine (EncodecCodeBooks) → into bark_generate_fine's fine_history.

    Wire all three and you've got a consistent voice. Wire none and you get random stock voices. Wiring just one quietly does nothing useful - see below.

    Install & the trap everyone hits

    It ships with the pack (gitmylo/ComfyUI-audio-nodes) - ComfyUI Manager, search "Audio nodes", install, restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/gitmylo/ComfyUI-audio-nodes
    

    The gotcha is that the coarse stage only uses speaker history when both semantic_history and coarse_history are connected - the code checks them as a pair. Connect text and coarse to bark_generate_coarse and fine to bark_generate_fine, and only then does the voice actually stick. Half-wired, you get Bark's default voice with no error message, which is the most confusing failure mode in this pack.

    Where to get speaker files: the pack includes the means to build your own via bark_hubert_encode → bark_hubert_quantize → save_speaker_npz, and community-shared .npz files circulate for Bark's stock voices. Just don't expect one speaker file to be a perfect clone of a real person - this is a style anchor, not a deepfake machine, and cloning quality depends heavily on the reference audio you built the file from.

    Category🔉 AudioNodes/bark

    Inputs (1)

    NameTypeDefaultDescription
    fileCOMBO0 options:

    Outputs (3)

    NameTypeDescription
    textBarkSemanticTokens—
    coarseEncodecCodeBooks—
    fineEncodecCodeBooks—