Forums > MaxMSP

Calculating /compensating relative gains of 2 signals

September 1, 2006 | 4:49 pm

I am trying to take 2 signals of different amplitudes, calculate the level difference between them then apply the appropriate amount of gain to one of them so that they are both exactly the same gain (typically, though not essentially, the gain of one of the signals). Does anyone have any good approaches for doing this?


September 1, 2006 | 4:51 pm

define "gain".


September 1, 2006 | 5:24 pm

Thanks for your interest, Roman.
Defining gain properly would take a long time!
Yes, I was a little vague, but I am talking about a numerical, instantanious measurement of a signal’s amplitude, either linear or logarithmic. Typically the output from peakamp~ would be one way of looking at it, for instance, if I had 2 audio signals, both feeding their own peakamp~ objects, how can I automatically manipulate one of the signals so that both peakamp~s subsequently displayed the same number?
Does that answer your question?


September 2, 2006 | 1:41 am

compare them … by diving one from the other or by divigin both from 1 float … a fiktive third signal … then you
know the difference between the two … so you know what
to add to A to make its peak (or power?) envelope like B …
the gainslider object with its ramp time should be the
appropiate opposite of peakamp … maybe …


September 2, 2006 | 2:54 am

It sounds like you might want to use a side-chained
compressor/noise-gate such as omx.comp~.

Peter McCulloch


September 2, 2006 | 10:47 am

Justin Paterson wrote:
> I am trying to take 2 signals of different amplitudes, calculate the
> level difference between them then apply the appropriate amount of
> gain to one of them so that they are both exactly the same gain

Depends on the signal if "exactly" makes sense. If you have the output
of two oscillators, it might mean something, if you take two channels of
a classical recording you probably don’t want them to be exactly the
same always… ;-)

> (typically, though not essentially, the gain of one of the signals).
> Does anyone have any good approaches for doing this?

Look into envelope following and averaging, as you have to define how
fast/slow the adaption should be…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


September 2, 2006 | 1:46 pm

Thanks for the help guys. I have been trying everyone’s ideas along with what seems to me the most obvious which is using the normalize~object, but I cannot get anything to work correctly. I am only going for peak values at the moment. I think a lot of it has to do with my relative newness to Max, and I am under time pressure which make thorough study around the immediate problem difficult. Would anyone be so kind as to be a little more explicit in their advice for a brain-fried newbie?


September 2, 2006 | 1:53 pm

Oh, Stefan- I should add that my scenario in the short term is closer to an oscillator than a classical recording. I am in fact looping a short (400ms) section of audio,


September 2, 2006 | 2:33 pm

Here is a picture of a little problem. The red signal is coming from one buffer and the 2 yellows are both coming from another. Each buffer contains successive handclaps. The 2 signals are named higher and lower, so that when it functions correctly, ‘normalized lower’ is the same as ‘actual higher’. It is currently automatically reporting every 525ms, not using the bang from the top left.
It works perfectly on the first handclap in the sequence, but if I then choose a different handclap, it does not report correctly. Also, if I mess with the individual volumes of the working handclap, it will work for a while and then perhaps not work.
What is causing this inconsistency/inaccuracy?


September 2, 2006 | 2:59 pm

Check out tl.balance~ from the tl.objects:

http://www.bek.no/~lossius/download

Best,
Trond

Justin Paterson wrote:
> I am trying to take 2 signals of different amplitudes, calculate the level difference between them then apply the appropriate amount of gain to one of them so that they are both exactly the same gain (typically, though not essentially, the gain of one of the signals). Does anyone have any good approaches for doing this?
>


September 2, 2006 | 4:44 pm

Hey Trond!
What a great collection of objects- Well done!
At first glance, the help file for tl.balance~ does not seem to work, but the object itself is pretty self-explanatory. Tweaking its refresh rate might prove interesting…
I will investigate and let you know how I get on.
Thanks very much.


September 2, 2006 | 6:11 pm

My apologies for the off-topic nature of this post to the list, but
I’m getting pretty desperate and I hope that some of the sages here
may have some advice.

Since upgrading the macs in our lab to OS 10.4.7 from 10.3.9 I can no
longer get them to recognize the Tascam US-428′s. I get not even a
flicker on the 428′s usb indicators and neither the US-428 Manager
app or Audio MIDI Setup recognize the units.

I have tried using the US-428 drivers v3.2.3 (which is supposed to be
Tiger compatible) and the new UB v3.4. I have tried first using the
supplied deinstaller before installing, I have tried manually
deinstalling all the components before installing (as recommended by
Tascam tech support, after several hours on hold), I have tried
manually installing all the components. Still no luck.

All the Macs are 466MHz G4s running OS 10.4.7, with iTunes 6.0.5, Max/
MSP 4.6.1, Pluggo 3.5.4, Digital Performer 5.1, Finale 2006d,
Sibelius 4. There are no other audio drivers, or any other
miscellaneous usb drivers installed.

Any ideas? As I said, I’m getting pretty desperate as I have classes
beginning on Tuesday which rely on this machines (I know, I know, I
should never have done an OS upgrade with only a week of shake-down
time).

Thanks for any help you might have. Feel free to contact me off-list
if you want to keep down the OT bandwidth.

John Burrow/Technical Director, Music Dept.
Cornish College of the Arts
206-726-5087
jburrow@cornish.edu
noisyjB@comcast.net


September 3, 2006 | 6:06 pm

Have you tried using the OMX~ objects? They were designed for this problem.

KMc

Justin Paterson wrote:
Here is a picture of a little problem. The red signal is coming from one buffer and the 2 yellows are both coming from another. Each buffer contains successive handclaps. The 2 signals are named higher and lower, so that when it functions correctly, ‘normalized lower’ is the same as ‘actual higher’. It is currently automatically reporting every 525ms, not using the bang from the top left.
It works perfectly on the first handclap in the sequence, but if I then choose a different handclap, it does not report correctly. Also, if I mess with the individual volumes of the working handclap, it will work for a while and then perhaps not work.
What is causing this inconsistency/inaccuracy?

Keith McMillen
BEAM Foundation
http://www.beamfoundation.org/
510.502.5310


September 5, 2006 | 10:27 am

Basically, the tl.balance works perfectly and effortlessly. Big thanks, Trond!
I guess the only down side is that I did not get to learn anything from designing it myself, but as I said, I am short of time on this one and will come back to it all later. Thanks to everyone who helped.


Viewing 14 posts - 1 through 14 (of 14 total)