Nodes/MKRShift_Nodes/Audio Gain + Pan
ComfyUI Node

Audio Gain + Pan

Level your audio and place it left or right — inside the graph

By criskb·Created 7 months ago·Updated 5 months ago· 0
Audio Gain + Pan
  • audio
  • audio
  • output_path
  • duration_sec
  • summary
gain_db0.0
pan0.00
force_stereofalse
normalize_peakfalse
output_formatauto
filename_prefixMKR_audio_gain_pan
subfolder
overwritefalse
filename_label

Volume and pan are the two things you adjust on basically every piece of audio, and up until recently there was no good reason to do either inside ComfyUI - then video workflows started carrying soundtracks and dialogue, and suddenly you want a voice quieter than the music without leaving the graph. MKRAudioGainPan is that: one node, a gain knob and a pan knob, plus a couple of stereo conveniences. It's the kind of boring utility that quietly does exactly what it says.

It lives in the Utility branch of the MKRShift_Nodes audio set, so it's the stage before FX rather than the FX itself. Typical use: pull dialogue down with gain_db, push a voice a touch off-center with pan, then feed the result into MKRAudioMix to combine it with a bed track.

How it works

Gain is straightforward dB scaling (0 dB = unchanged, −6 dB halves the level, +6 dB doubles it). Pan uses a constant-power law - the standard studio trick where the left and right channels get cos(angle) and sin(angle) gains so the perceived loudness stays constant as you move across the field - rather than a naive linear fade that makes the middle sound louder. pan runs −1 (hard left) to +1 (hard right), 0 dead center.

Two stereo conveniences make it more than a pair of knobs:

  • force_stereo - turns a mono input into a real two-channel signal (necessary before panning a mono voice, and for getting a mono track into a stereo mix).
  • normalize_peak - rescales the result to just under full scale. If you've boosted by a lot and don't want to clip, flip this on.

Inputs that matter

  • audio - MKR_AUDIO payload, waveform tensor, or file path.
  • gain_db - −60 to +24 dB. The volume knob.
  • pan - −1 to +1. The position knob.
  • force_stereo / normalize_peak - the two toggles above.
  • Standard save block: output_format, filename_prefix, subfolder, overwrite, optional filename_label.

Outputs: audio (MKR_AUDIO), output_path, duration_sec, summary.

Install

ComfyUI Manager (search "MKRShift Nodes"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/criskb/MKRShift_Nodes

Restart. Pure numpy math - no ffmpeg required for the processing itself; it only matters for compressed output formats. No models.

Common issues

The trap is panning a mono source and hearing nothing move: with force_stereo off, a mono waveform just gets a shared gain and pan does effectively nothing. Turn force_stereo on first. Second, watch the cumulative math - if you've boosted +6 dB and your upstream was already hot, normalize_peak is off by default and you will clip; the summary output shows you the peak if you inspect it. And negative pan means left, positive means right - the old DAW convention where "pan left" was negative catches people constantly.

CategoryMKRShift Nodes/Media/Audio/Utility

Inputs (10)

NameTypeDefaultDescription
audio*
gain_dbFLOAT0.0-60–24
panFLOAT0.00-1–1
force_stereoBOOLEANfalse
normalize_peakBOOLEANfalse
output_formatCOMBOauto5 options: auto, wav, mp3, flac, ogg
filename_prefixSTRINGMKR_audio_gain_pan
subfolderSTRING
overwriteBOOLEANfalse
filename_labeloptSTRING

Outputs (4)

NameTypeDescription
audioMKR_AUDIO
output_pathSTRING
duration_secFLOAT
summarySTRING