m4l.bal: how does it work

jorgen's icon

I'm looking through some M4L patches and I don't understand the abstractions m4l.bal1 and m4l.bal2.

They are supposed to take in a dry and a wet signal plus a percentage P and then mix the signals together according to P. Naively I would think that you could multiply the wet signal with P and the dry signal with 1-P using *~ and then add them together using +~.

But what the patch does is multiply them both with a cosine wave from cycle~, with an unspecified frequency (default?) and a phase depending on P. The two cosines for wet and dry have a phase difference of 0.75 (I'm assuming in units of pi radians). The signals are then added together.

I'd be grateful if anyone could explain me how this does what it should!

David's icon

Your "naive" approach is called "linear panning", which makes signals that are balanced in the middle appear 3dB quieter than signals balanced to the extreme left or right, while "equal power panning", which is probably used in the named abstractions gives you the same perceived volume all the way from left to right.
How it works in detail is explained in "MSP Tutorial 22: MIDI Panning" much better, than I could do it here ;-).

jorgen's icon

Ok that explains it, thank you very much!

I've been avoiding the MSP tutorials since they are made for standalone Max and have to be tweaked for use with M4L. Maybe I should see that as an opportunity for practice..