Nodes/Audio nodes/Load encodec model
ComfyUI Node

Load encodec model

The codec Bark is secretly built on

By gitmyloΒ·Created 2 years agoΒ·Updated about a year agoΒ· 12
Load encodec model
    • model
    β—„cpuβ€”β–Ί

    Every Bark generation you've ever heard ended at this model's decoder. encodec_loader loads Meta's EnCodec - the neural audio codec that Bark uses as its "language of sound." It's the bridge between the token world (codebooks) and the actual audio waveform world, and it's a general-purpose node: it's also the one you reach for when you want to work with EnCodec entirely on its own, no Bark involved.

    What you're actually loading

    EnCodec is a convolutional autoencoder that compresses audio into discrete codes (a fixed-size vocabulary of 1,024 tokens per codebook, 8 codebooks at 24 kHz) and reconstructs it. It's not generative - it's a lossy compressor with a learned vocabulary. That's exactly why Bark is built on it: if all of audio can be written as discrete tokens, then a GPT can "predict audio" by predicting tokens, and the codec's decoder turns those tokens back into sound.

    This node specifically loads the 24 kHz model at 6 kbps bandwidth (encodec_model_24khz() with set_target_bandwidth(6.0) in the source). The bandwidth setting determines the bitrate/quality tradeoff; 6 kbps is the sweet spot Bark was trained against, so you almost never change it - and the pack doesn't expose it, which is fine.

    The input

    Exactly one: cpu (boolean). true forces the codec onto CPU (slow but usable); false runs it on the GPU. There's no model file to pick and no weights to hunt down - EnCodec is bundled inside the encodec Python package, which is one of the two deps this pack installs. That's the nicest thing about this node: zero model downloads.

    The output is a single model (EncodecModel) that feeds encodec_encode (audio β†’ codebooks) and encodec_decode (codebooks β†’ audio).

    Install & when you'd use it standalone

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

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

    and restart.

    Standalone, EnCodec is a neat toy for lossy audio experiments: encode a clip and decode it back and you can hear what the codec considers worth keeping. More practically, it's the engine behind the pack's voice-cloning chain - encodec_encode produces the fine codebooks that end up inside a saved speaker .npz. One thing to keep in mind: the codec's quality ceiling is baked in. It sounds fine for speech - that's its job - but music encoded at 6 kbps will come out crunchy, and that's not a setup problem on your end.

    CategoryπŸ”‰ AudioNodes/general/encodec

    Inputs (1)

    NameTypeDefaultDescription
    cpuBOOLEANβ€”

    Outputs (1)

    NameTypeDescription
    modelEncodecModelβ€”