Audio VAE Encode
The front door to the audio latent space
- audio
- vae
- latent
- info
Every node in this pack's audio half assumes you have a LATENT to work with. AudioVAEEncode is how you get one. Drop in any audio file - a drum loop, a vocal, a field recording - and it compresses the waveform into the compressed representation the VAE uses, with enough metadata attached that the decoder can give it back at the right sample rate. It's the entry point for interpolation, style transfer, guidance, the works.
How it works
The audio comes in as an AUDIO (which in ComfyUI is a waveform + sample rate pair), gets converted to float, and resampled to target_sample_rate if it isn't already. If normalize is on (it is by default), the waveform is scaled to peak at 1.0 so quiet clips don't vanish into the latent. Then it's vae.encode() under torch.no_grad() and packed back into a LATENT along with a LATENT_INFO describing what it did.
The two outputs are worth understanding:
latent- the encoded representation; feed it to AudioLatentInterpolate, AudioStyleTransfer, AudioLatentManipulator, or AudioLatentGuidance.info- aLATENT_INFOwith the original shape, latent shape, sample rate, and the latent's mean/std. Handy when you're debugging why two latents won't mix cleanly, ignorable the rest of the time.
The inputs that matter
audio- whatever you want encoded, from any audio source or loader in your workflow.vae- the Stable Audio VAE. This is the same VAE the rest of your audio workflow uses; keep it consistent.normalize- true by default; leave it unless you have a reason to preserve exact levels.target_sample_rate- 44100 default, adjustable 16000–48000. Match this across all the clips you plan to mix.
Installing it
From DavidPiazza/network_bending via ComfyUI Manager ("Network Bending") or:
cd ComfyUI/custom_nodes
git clone https://github.com/DavidPiazza/network_bending.git
Restart. Then install torchaudio and librosa - they're listed in the pack's requirements-audio.txt, and without them the audio nodes don't load at all (the pack disables them rather than crashing).
Common issues
The classic failure: encoding clips at different sample rates, then interpolating between them and getting warped audio out the other end. Pick one rate and stick to it. Also, normalize means every clip is normalized independently - if you were hoping a quiet clip would stay quiet relative to a loud one, that's not what this node does. And one honest note about the pack: it's 0.0.1, some nodes are stubs, but this one is fully implemented and it's the least surprising thing in the whole pack - a genuinely reliable first step for anybody new to audio generation in ComfyUI.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | Audio waveform to encode | |
| vae | VAE | Stable Audio VAE model | |
| normalizeopt | BOOLEAN | true | Normalize audio before encoding |
| target_sample_rateopt | INT | 4410016000–48000 | Target sample rate for encoding |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |
| info | LATENT_INFO | — |