Egregora DAC Encode
Squish audio into neural codec latents — and see what your codec throws away
- audio
- codes
- log
DAC - the Descript Audio Codec - is the neural codec that turned up everywhere in 2024: it's one of the models behind a lot of text-to-audio and music-generation pipelines, and it does the audio world's version of a VAE. It takes a waveform and compresses it into a small set of latent codes, then reconstructs from those codes. This node gives you the encode half: audio in, latent codes out, as a DICT you can hang onto or pipe straight into the pack's DAC Decode node.
Why would you want that in an enhancement pack? Two honest uses. First, it's a codec stressor: encode → decode with DAC and compare against the original (the pack has metrics and null-test nodes for exactly this) to measure how much quality a neural codec eats, which matters if you're shipping audio into a pipeline that codecs it. Second, it's a round-trip building block - if you're experimenting with anything that operates on compressed audio latents, DAC is the standard encoding, and this node gets you there from a ComfyUI AUDIO buffer without leaving the graph.
How it works
The node loads the descript-audio-codec model for your chosen model_type, resamples your audio to the model's native rate, runs the DAC encoder, and returns the latents. There's a wrinkle worth knowing: this implementation returns the latent z tensors (the continuous codes) rather than the quantized token indices - check the log string, which tells you the model and sample rates involved.
The weights auto-download from the DAC project on first use (via dac.utils.download), so unlike the FlashSR node there's no manual file-hunting.
The inputs that matter
audio- the AUDIO buffer.model_type-44khz(default),24khz, or16khz. Match it to your source's quality; 44kHz is the full-fidelity option.device-auto/cpu/cuda. Auto picks your GPU if present.
Outputs are a codes DICT and a log STRING. The codes dict carries model_type, the original and model sample rates, and the latents - wire it into Egregora_DAC_Decode.
Install notes
descript-audio-codec is in the pack's requirements.txt and install.py runs a warmup that downloads the 44 kHz weights on first setup. If you cloned the pack and skipped the installer, you'll hit "descript-audio-codec not installed." One gotcha: DAC pulls in its own torch bits as dependencies in some versions, so if you see environment weirdness afterward, it's usually a dependency resolution clash with ComfyUI's torch - the pack's installer intentionally tries to avoid touching torch.
The trap
The classic mistake is expecting a transparent round trip. DAC is a lossy codec - that's the point of compressing to latents. At 44 kHz it's remarkably good, but it is not bit-perfect, and on speech-heavy or sparse material you can hear artifacts in the reconstructed highs. That's not the node misbehaving; it's the codec doing its job. Which is exactly why the pack pairs it with the eval tools: encode → decode → run Metrics (LSD + SI-SDR) against the original, and you'll have a number for how much the codec cost you.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | — | |
| model_type | COMBO | 44khz | 3 options: 44khz, 24khz, 16khz |
| device | COMBO | auto | 3 options: auto, cpu, cuda |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| codes | DICT | — |
| log | STRING | — |