Audio Reference Encoder
Turn up to four reference tracks into one steerable latent
- vae
- audio_a
- audio_b
- audio_c
- audio_d
- combined_latent
- info
Reference tracks are how every producer actually works, and Audio Reference Encoder is how you bring that habit to latent generation. It takes one to four audio clips, encodes them with a Stable Audio VAE, and merges them into a single combined latent you can then feed to Audio Latent Guidance or Audio Style Transfer. It's the "load my references" node for everything else in this pack's audio half.
How it works
Each AUDIO input goes through the same vae.encode() path - resampled to the VAE's rate, normalized, encoded, and wrapped as a latent. Then the latents get combined with whichever combination_mode you picked: average (plain mean), weighted (mean scaled by the per-input weight_a–weight_d), pca (project onto principal components), or attention (learned weighting). attention is the default, and it's the one that tends to give you a blend that's actually usable rather than a wash.
There's a genuinely nice option hiding in here: extract_segments. Flip it on and the node scans each clip, finds the highest-energy window of segment_duration seconds, and uses only that - so a 3-minute track becomes "the loudest, most characteristic 2 seconds." Great for pulling the vibe of a track without dragging in ten minutes of it.
The inputs that matter
vae- a Stable Audio VAE, the same one you use elsewhere in the audio workflow.audio_a- required; the first reference.audio_b/audio_c/audio_d- optional references; the node collects however many you plug in.combination_mode- how the refs are merged.weight_a–weight_d- per-reference weights (0–2) forweightedmode.extract_segments/segment_duration- the "grab the best bit" option.
Outputs are combined_latent (a LATENT) and info (a LATENT_INFO with the shapes and statistics). The latent is the one you wire into guidance or style transfer; the info output you can largely ignore or inspect.
Installing it
From the DavidPiazza/network_bending pack via ComfyUI Manager ("Network Bending"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/DavidPiazza/network_bending.git
Restart, and install the audio deps (torchaudio, librosa) from requirements-audio.txt - without them every audio node in the pack quietly vanishes.
Where it bites
The classic mistake is mixing references at wildly different sample rates or lengths and wondering why the blend sounds like a warped cassette - encode through the same path (AudioVAEEncode defaults to 44100) so they're comparable. Also, this node doesn't decode anything itself; the combined_latent is only useful if it's feeding guidance or style transfer, or being decoded by AudioVAEDecode. On the plus side, unlike some declared-but-stub nodes in this pack, every mode here is actually implemented - weighted and attention are the useful ones; pca is a fun experiment more than a workflow staple.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| vae | VAE | Stable Audio VAE model | |
| audio_a | AUDIO | First reference audio | |
| combination_mode | COMBO | attention | How to combine multiple references |
| audio_bopt | AUDIO | Second reference audio | |
| audio_copt | AUDIO | Third reference audio | |
| audio_dopt | AUDIO | Fourth reference audio | |
| weight_aopt | FLOAT | 1.000–2 | — |
| weight_bopt | FLOAT | 1.000–2 | — |
| weight_copt | FLOAT | 1.000–2 | — |
| weight_dopt | FLOAT | 1.000–2 | — |
| extract_segmentsopt | BOOLEAN | false | Extract most characteristic segments |
| segment_durationopt | FLOAT | 2.000.5–10 | Duration of segments to extract (seconds) |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| combined_latent | LATENT | — |
| info | LATENT_INFO | — |