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

Save bark speaker .npz

The end of the voice-cloning workflow

By gitmyloΒ·Created 2 years agoΒ·Updated about a year agoΒ· 12
Save bark speaker .npz
  • semantic_prompt
  • coarse_prompt
  • fine_prompt
    β—„namespeakerβ–Ί

    This is the node that turns a voice you like into a reusable file. save_speaker_npz takes the three token arrays - semantic, coarse, and fine - and writes them to ComfyUI/models/bark/speakers/<name>.npz, which is exactly the format load_speaker_npz reads back later. One workflow builds a speaker, another workflow consumes it. This is the build side.

    The full voice-cloning chain

    To make a speaker you need to extract all three token types from a reference audio clip. The pack ships the pieces, wired in this order:

    1. load_bark_hubert + bark_hubert_encode (layer 9) turn your audio into HuBERT vectors, then bark_hubert_quantize maps those to semantic tokens - this gives you the semantic_prompt.
    2. encodec_loader + encodec_encode turn the same audio into the full 8-codebook EnCodec array - that's your fine prompt.
    3. bark_encodec_coarseify takes that array and keeps only the first 2 rows - that's your coarse prompt.
    4. All three feed this node, which saves them together.

    The inputs

    • name - the filename, without extension. Default speaker; the node appends .npz itself. So name = "dave" produces dave.npz in the speakers folder. Overwriting an existing name silently replaces the file.
    • semantic_prompt (BarkSemanticTokens) - from bark_hubert_quantize (voice cloning) or bark_generate_semantic (if you're building a speaker from a generated take you liked).
    • coarse_prompt (EncodecCodeBooks) - from bark_encodec_coarseify.
    • fine_prompt (EncodecCodeBooks) - from encodec_encode.

    It's an output node (OUTPUT_NODE = True in the source), so it has no outputs - you wire tokens in, it saves to disk, done. You'll see it in the list of execution nodes and it marks the workflow as "finished" when it runs.

    Install & practical notes

    Standard pack install - ComfyUI Manager, search "Audio nodes", or:

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

    then restart.

    Practical advice from actually running this: use a clean, dry reference clip - 5–10 seconds of a single speaker, no background music, no overlapping voices. The quality of your speaker file is capped by the quality of that reference, and you can't fix a bad reference downstream. The main disappointment to manage expectations on: Bark's speaker cloning is "same character" more than "same human." It captures delivery and timbre surprisingly well, but it won't pass for a forensic copy of someone's voice, and it shouldn't be used as one either. Also worth knowing: you can build a speaker from a generated clip you love just by capturing the three token outputs mid-pipeline and running them into this node - no HuBERT chain needed.

    CategoryπŸ”‰ AudioNodes/bark

    Inputs (4)

    NameTypeDefaultDescription
    nameSTRINGspeakerβ€”
    semantic_promptBarkSemanticTokensβ€”
    coarse_promptEncodecCodeBooksβ€”
    fine_promptEncodecCodeBooksβ€”

    Outputs (0)

    No outputs