Gain Balance

Francesco Pasquale's icon

Hi guys!
How can I djust one audio signal according to the values of another?
(Example: You need to balance the volume after a comb filter with the original signal's volume)

Roman Thilenius's icon


avg~ or average~ can measure power (which is somewhat releated to the perceived loudness), peakamp~ can measure the peak history ("envelope").

you would measure both signals, then you know the difference, then you also know how to adjust signal B to match A.

Francesco Pasquale's icon

Thanks for replying!
How can I match the signal A B automaticly?

Source Audio's icon

1. read what Roman wrote several times.
2. check objects that can measure audio level
3. try to compare 2 measurements
4. use result to amplify or attenuate the post processed signal

Roman Thilenius's icon


i added something last night but deleted it because it was wrong. :)

it is basically rule of three: when the 2 peak (or power) analysis results are A=0.7 and B=0.8, you do B/A (0.8 / 0.7) to get the factor which says how much louder (or less loud) the B signal is. then you do 1./(B/A) and thats the attenuation control signal.

one might add slide~ or rampsmooth~ somewhere but this (picture) is the basic idea.

some people would convert the analysis signals/numbers to decibel, then you can work with + and - instead of this unintuitive [/!] [/! 1.] combination.

gain normalize peak power rhabarberbarbara


Roman Thilenius's icon

oh, and you might want to do [delay~ 250.] to the B music signal before gain attenuation. :)

Francesco Pasquale's icon

Thank you so much Roman!

Source Audio's icon

Another advice - measuring audio level to balance
post processed audio is tricky, because energy
produced by low frequencies is much higher than by high ones.
balance is somewhere arround 250 Hz.
Hearing is rather different than what audio level meter shows.
I did such a thing once for a singer that wanted
one knob eq/efx to dial from thiny sharp radio voice over nasty mid boosted
and light distorted sound, to fat deep bass with subharmonic + low octave
and wanted the output to be more or less the same.
Measuring the output to balance the sound did not help at all,
but adjusting the gain curve by hearing.
----------
P.S. replace that prepend 500 with $1 500 message
to get the gain right for the line~ object
One so often uses meter~ objects, they can be just as well used to measure the level

Max Patch
Copy patch and select New From Clipboard in Max.