A ComfyUI custom node that allows you to mix two audio tracks together with volume control for each track.
The Combine Audio node takes two audio inputs and merges them into a single audio track while providing independent volume control for each input. This is particularly useful for:
- Adding background music to voice recordings
- Mixing multiple audio tracks
- Creating layered audio effects
- audio1: First audio input track (AUDIO type)
- audio2: Second audio input track (AUDIO type)
- volume1: Volume multiplier for the first audio track
- Default: 1.0
- Range: 0.0 to 2.0
- Step: 0.1
- volume2: Volume multiplier for the second audio track
- Default: 1.0
- Range: 0.0 to 2.0
- Step: 0.1
- Returns a combined AUDIO track
- The node loads both input audio tracks using pydub
- Applies volume adjustments to each track independently
- Volume is converted from linear scale to decibels (dB)
- A volume of 1.0 means no change
- Values below 1.0 decrease volume
- Values above 1.0 increase volume (up to 2.0x)
- Automatically matches the length of both tracks
- If one track is longer, the shorter track is padded with silence
- Overlays the tracks together while preserving both audio streams
- Exports the result as a new audio file
- Output Format: MP4 audio
- Volume Conversion: Uses 20 * log10(volume) for dB conversion
- Length Matching: Automatic padding with silence
- Error Handling: Returns the first audio track if combination fails
- pydub: Audio processing library
- Connect two audio sources to the node's audio1 and audio2 inputs
- Adjust volume1 and volume2 to balance the audio levels
- The combined audio will be available at the output
Note: The node automatically handles different length audio files by padding the shorter one with silence to match the longer track's duration.