(deforum) AmplitudeToAudio
Rebuild actual audio from a magnitude and phase pair
- amplitude
- phase
- audio_samples
(deforum) AmplitudeToAudio is the return half of a frequency-domain round trip. Some of the audio nodes in this pack work in the FFT domain - they split a signal into magnitude and phase (AMPLITUDE series, like ExtractDominantNoteAmplitude's outputs), let you mangle the spectrum, and then you need a way back to actual sound. This node is that way back: it takes an amplitude and a phase, runs an inverse FFT, and hands you an AUDIO object you can feed into a (deforum) Save Video node to mux as the soundtrack. In other words, it turns processed spectrum data into something you can hear.
How it works
The math is compact: it reconstructs a complex spectrum as amplitude * exp(1j * phase), applies np.fft.ifft, keeps the real part, and normalizes the result into 16-bit PCM mono samples. Those samples get wrapped into the pack's AudioData object (a pydub-style AudioSegment under the hood) at whatever sample_rate you asked for, and that's your AUDIO output. It's a faithful inverse transform - if you pass back the exact magnitude and phase you extracted, you get something very close to the original signal back.
The inputs that matter
amplitude- theAMPLITUDEseries holding the magnitudes (one per FFT bin).phase- theAMPLITUDEseries holding the phases. Both are required, and they must be the same length or the node raises a clear "must have the same length" error. Wire both outputs of an FFT-analysis node here in the right order and you're fine.sample_rate- optional, default 44100. Should match the sample rate the audio was analyzed at; mismatches just pitch-shift or time-stretch the result, which you almost never want.
Output is audio_samples of type AUDIO, ready for the Save Video node's audio input.
When it's actually useful
Honestly? This is a niche node, and most people building beat-synced Deforum videos will never touch it - they drive animation from amplitude curves and let the original audio be the soundtrack. AmplitudeToAudio earns its keep in two cases: when you've synthesized or heavily processed a spectrum (modifying bins, filtering, generating tones) and want to hear the result; and when you're prototyping an FFT chain and want a sanity-check listen before committing the workflow. If you're not doing either, skip it - it's the kind of node that exists to make the pack's FFT features complete, not because every animation needs it.
Installing it
Part of Deforum Nodes (XmYx). ComfyUI Manager → search "Deforum Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/XmYx/deforum-comfy-nodes.git
Restart, and let the first-boot install.py run - it installs the heavy stack (librosa, opencv-contrib-python, moviepy, pydub, numpy<2.0.0, deforum-studio backend). Python 3.10 required per the README.
Where people get burned
Two things. First, feeding it a mismatched amplitude/phase length - that's the one hard error, and it's an exception, not a silent bad result. Second, forgetting that this node expects spectral amplitude, not the time-domain envelope you'd feed a TimeSmoothing node; passing the wrong series gives you noise, not music. If the output is harsh static, you've wired the wrong amplitude source in.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| amplitude | AMPLITUDE | — | |
| phase | AMPLITUDE | — | |
| sample_rateopt | INT | 441001–192000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| audio_samples | AUDIO | — |