Nodes/Network Bending for ComfyUI/Audio Style Transfer
ComfyUI Node

Audio Style Transfer

Put the texture of one sound onto another

By DavidPiazza·Created about a year ago·Updated 9 months ago· 0
Audio Style Transfer
  • content_latent
  • style_latent
  • latent
transfer_modeadaptive
style_strength0.70
preserve_content0.30
frequency_bands4
time_alignmentcrop_to_shortest

Style transfer is the classic latent-space party trick: keep the content of one thing, steal the texture of another. Audio Style Transfer does exactly that for sound - the melody and rhythm of your content track, the timbre and character of your style track, blended in latent space before anything is decoded. It's the node that makes "my melody, but as if that other song produced it" a single-node operation.

How it works

Both inputs are LATENTs (encode real files with AudioVAEEncode or use generation output). The node aligns their lengths - crop_to_shortest by default, pad_to_longest, or none if you're feeling risky - then does the style math in one of five transfer_modes:

  • global - classic statistics matching: normalize the content latent by its own mean/std, rescale it to the style latent's mean/std. The image-style-transfer standby, applied to audio.
  • frequency_bands - does the same trick in FFT space, band by band (how many is up to frequency_bands, default 4), so high-frequency "air" can be transferred independently of the low end.
  • temporal_segments - matches statistics per time segment rather than globally.
  • adaptive - correlation-based reshaping; the default, and the one that keeps things sounding most like the content.
  • neural_style - the deeper feature-matching variant.

style_strength (0–1, default 0.7) is how much style to transfer, and preserve_content (default 0.3) is how much of the original to keep. Together they're your wet/dry mix - and yes, they can both be high; the final blend is roughly stylized * style_strength + content * preserve_content.

The inputs that matter

  • content_latent - what stays (structure, melody, rhythm).
  • style_latent - what leaks in (timbre, texture, vibe).
  • transfer_mode - adaptive to start, frequency_bands when you want surgical control of the high end.
  • style_strength / preserve_content - the wet/dry pair.
  • frequency_bands - only relevant in band mode.

Output is a single latent, ready for AudioVAEDecode.

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 ComfyUI, and make sure torchaudio + librosa are present (requirements-audio.txt); the audio nodes hide themselves if they're missing.

Common issues

Length mismatch is the big one - crop_to_shortest protects you, but if you set time_alignment to none with wildly different lengths, the FFT-based modes get weird in the best and worst ways. And because transfer happens before decode, a style_strength of 1.0 can come out of the decoder sounding overcooked; 0.7 is a sane default for a reason. This is one of the better-implemented nodes in the pack - all five modes actually run, which, given how some of its siblings ship, is worth appreciating.

Categoryaudio/style

Inputs (7)

NameTypeDefaultDescription
content_latentLATENTContent audio latent
style_latentLATENTStyle audio latent
transfer_modeCOMBOadaptiveStyle transfer mode
style_strengthFLOAT0.700–1How much style to transfer
preserve_contentoptFLOAT0.300–1How much original content to preserve
frequency_bandsoptINT42–16Number of frequency bands for band-wise transfer
time_alignmentoptCOMBOcrop_to_shortestMake content/style latents the same temporal length

Outputs (1)

NameTypeDescription
latentLATENT