Nodes/Audio nodes/Course-ify encodec codebooks
ComfyUI Node

Course-ify encodec codebooks

One trim, and suddenly they're 'coarse'

By gitmyloΒ·Created 2 years agoΒ·Updated about a year agoΒ· 12
Course-ify encodec codebooks
  • fine_codebooks
  • coarse_codebooks

The most honest node in this pack: bark_encodec_coarseify ("Course-ify encodec codebooks" - yes, the typo is in the display name) does exactly one thing, and its entire source is a single line: it takes a full 8-row EnCodec codebook array and keeps only the first two rows. That's it. No model, no settings, no surprises.

Why that single trim matters

EnCodec's codebooks are hierarchical. Row 0 and row 1 carry the coarse shape of the audio - the fundamental structure of the sound. Rows 2–7 layer on finer detail until it's listenable. Bark has two separate generation stages built around that hierarchy: the coarse model predicts rows 0–1, and the fine model fills in the rest.

So when you encode a real audio clip with encodec_encode, you get one complete 8-row array - but a speaker .npz needs its coarse_prompt and fine_prompt as separate arrays. The fine prompt is the full 8-row output of encodec_encode; the coarse prompt is rows 0–1 of that same array. This node is what splits them. It sits in the middle of the voice-cloning chain:

encodec_encode ──fine_codebooks──► bark_encodec_coarseify ──► save_speaker_npz (coarse_prompt)
                                   └────────────────────────► save_speaker_npz (fine_prompt, unchanged)

The input fine_codebooks is that full 8-row array from encodec_encode; the output coarse_codebooks is the 2-row version.

Install & when you'd use it

Pack install, standard - ComfyUI Manager, search "Audio nodes", or:

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

then restart. It has no dependencies beyond the pack itself.

If you're only generating TTS from text, you'll never touch this node - the coarse stage already outputs coarse codebooks directly. It exists purely for the speaker-building workflow, so reach for it when you're putting together a .npz from a reference clip. And if you're poking around and wondering whether you can make your own coarse array by just... manually deleting rows in a custom node - yes, that's literally what this does. This node is the pack being polite about it.

CategoryπŸ”‰ AudioNodes/bark

Inputs (1)

NameTypeDefaultDescription
fine_codebooksEncodecCodeBooksβ€”

Outputs (1)

NameTypeDescription
coarse_codebooksEncodecCodeBooksβ€”