Nodes/Audio nodes/Decode encodec codebooks
ComfyUI Node

Decode encodec codebooks

The node that turns tokens back into sound

By gitmyloΒ·Created 2 years agoΒ·Updated about a year agoΒ· 12
Decode encodec codebooks
  • encodec_model
  • codebooks
  • audio

Every Bark workflow ends here. encodec_decode is the final stop of the pipeline - it takes the 8-row EnCodec codebook array that bark_generate_fine produced and runs it through the codec's decoder to get an actual AUDIO waveform you can listen to, save, or hand to any audio node. No codebooks, no sound. This is the node that makes all the token-churning upstream audible.

How it works

The codebook array is transposed, the quantizer decodes the discrete codes back into a continuous latent, and the codec's convolutional decoder reconstructs the waveform. The output comes out at the codec's native 24 kHz sample rate (that's what the sample_rate field in the audio dict says, straight from the loaded model). You don't pick a sample rate or quality level here - the model from encodec_loader fixed the bandwidth at 6 kbps, and this node just does what the codec does.

Inputs & outputs

  • encodec_model - from encodec_loader.
  • codebooks - an EncodecCodeBooks array. In a full TTS run this comes from bark_generate_fine. But it's a general-purpose node, and that's worth remembering: you can decode any codebook array, including the 2-row coarse output of bark_generate_coarse (to hear the rough skeleton - expect it to sound muffled and buzzy) or the output of encodec_encode (to hear what the codec's lossy round-trip does to a clip).

The output, audio, is ComfyUI's native AUDIO type. Wire it into a preview node - the pack's own example workflow uses PreviewAudio - or a save node to write a file.

Install & the one real gotcha

Same pack as always (gitmylo/ComfyUI-audio-nodes), same install - ComfyUI Manager β†’ "Audio nodes", or:

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

restart, and you're set. No model files to download for this node itself.

The gotcha: this node is dumb in a useful way. It will happily decode codebooks of any shape and give you noise if the shape is wrong. If your output sounds like a burst of static, you're almost certainly feeding it the wrong array - for instance, 2-row coarse codebooks when you meant to run fine generation first, or codebooks that got mangled upstream. When that happens, the bug is upstream (the coarse or fine stage), not here. Decode is also where quality expectations get set: 6 kbps EnCodec speech is clean and intelligible, but it's a codec, not a Hi-Fi reproduction - the crackle you might hear on sibilants is the codec's ceiling, not a broken node.

CategoryπŸ”‰ AudioNodes/general/encodec

Inputs (2)

NameTypeDefaultDescription
encodec_modelEncodecModelβ€”
codebooksEncodecCodeBooksβ€”

Outputs (1)

NameTypeDescription
audioAUDIOβ€”