Take the 2-minute tour ×
Sound Design Stack Exchange is a question and answer site for sound engineers, producers, editors, and enthusiasts. It's 100% free, no registration required.

I'm trying to understand a patch/abstraction in Max for Live called M4L.bal1, but I think the question is a pretty general one about digital audio processing.

The patch mixes two audio signals according to an adjustable parameter P ranging from 0 to 1; so that P=0 corresponds to 100% signal 1 and P=1 to 100% signal 2.

Naively I would expect you can multiply signal 1 with 1-P and signal 2 with P and then add them together. But the patch does something quite different:

The patch multiplies both signals with cosine waves (the frequency of which are not specified, I assume it's a default value) and then added together. The cosines have the same frequencies but different phases; the actual phases depend on P and range from 0 to 0.25 while the difference between the cosine phases is equal to 0.75 independent of P. I assume the phases are given in units of pi radians.

I'd be grateful if anyone could explain how this accomplishes mixing the signals!

Here's a picture of the patch:

enter image description here

share|improve this question

migrated from music.stackexchange.com Feb 24 at 21:52

This question came from our site for musicians, students, and enthusiasts.

add comment

1 Answer 1

up vote 1 down vote accepted

The underlying math is

out=cos(phi)*signal_1 + sin(phi)*signal_2

The reason why this is used is due to the fact that, although we deal with the amplitudes of signals, volume is related to the (mean) power, i.e. magnitude squared, of the signal. Trigonometric functions are used here since sin^2 phi + cos^2 phi =1 -- i.e. the sum of the squares of the factors remain constant, I also suspect that using trig functions here helps the "intuitive" feel of the control parameter.

the resulting power is

<out^2> = (cos^2 phi) < signal_1^2 > + (sin^2 phi)*<signal_2^2 >+ cos(phi)*sin(phi)* < signal_1 * signal_2 >

If we have two independent signals of the same net power, then the output power will be the same as the input power.

Notes:

  1. Angles are represented as "fractions of a whole rotation"

  2. I'm pretty sure that the cycle's are not "running" -- they are just a way to compute cos(phi) and sin( phi)=cos( phi+0.75) in a manner that produces a signal (as opposed to a control), they have not had a frequency input into their first port.

  3. As the first "angle" varies from 0 to 0.25, the cos factor varies from 0 to 1.

  4. Setting the second angle to be the first angle +3/4 shifts the factor from cos to sin, and has it vary in the opposite sense.

  5. Your proposed factors a,(1-a) will yield overall volume changes since

a^2+(1-a)^2 = 1 -2a+2a^2 which is not constant.

share|improve this answer
    
Aha, that explains it perfectly, thanks a lot! From your explanation I guess that the "default frequency" I mentioned is probably 0, so that the oscillators actually just compute the cos and sine of the phase like you say. Sounds a bit weird to me to do it this way (the program does have objects that calculate cos and sin) but I guess they have their reasons.. –  jorgen Feb 24 at 19:00
    
Max may have the requirement that *~ requires both inputs to be audio-signals, while the cos, sin blocks only produce control signals, so the cycle blocks are a good way to get the desired value at signal-rate. –  Dave Feb 24 at 19:20
    
That would explain it. There is an object cos~, and the tilde is supposed to indicate that it's an MSP audio signal - but maybe I've misunderstood this part a bit. –  jorgen Feb 24 at 19:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.