View Single Post
11-05-2015, 07:18 PM   #82
derek.john.evans
Human being with feelings

Join Date: Feb 2011
Posts: 217

Quote:
 Originally Posted by mrlimbic Yes that's it. It is like ducking but for panning instead of volume (pucking?!!) It seems I could do it as a multichannel effect (like ducking) or via envelope generation and stick the envelope to the pan parameter of another item.
Cool. Yea, I can see a use for that with left/right panned instruments which go mono based on the stereo field of the drum track. I can see a number of ways to implement this, depending on how fancy you want it.

Via the DAW, you would modulate a pan parameter of an effect (eg: volume_pan), and use "audio control signal" which tracks audio coming from channel 4. This channel would be sent over from the drum beat (to channels 3+4) and converted to MS, which means channel 4 would be the drum stereo field.

Via a compressor. A little harder, but, you compress a tracks side (S) in MS mode. The detector input of the compessor again would be the side (S) signal sent from a drum track.

Via code. O, my. A lot of algorithms are running though my head.

Start with a basic pan effect for channels 1+2. Calculate MS for 1+2. Calculate a envelope follower for the side (S) of 3+4. Apply the envelope to the (S) of 1+2. Convert MS back to LR and output to 1+2.

This is a quick implementation. EDIT: Only tested at srate=44100. Im not sure I got the decay calculation correct in relation to srate.

Code:
```desc: Pan Ducker (The Pucker)

slider1:0<-1,1>Pan
slider2:10<0,20>Puck Level
slider3:50<0,100>Puck Decay

@init

sc = 6 / log(2);

@slider

sin = sin(slider1 * \$pi * 0.5);

pan0 = (1 - sin) * 0.5;
pan1 = (sin + 1) * 0.5;

decay = slider3 / srate;

@sample

spl0 *= pan0;
spl1 *= pan1;

in0 = spl0 + spl1;
in1 = spl0 - spl1;

in3 += (sqrt(abs(spl2 - spl3)) - in3) * decay;
in1 *= cos(atan(in3 * slider2));

spl0 = (in0 + in1) * 0.5;
spl1 = (in0 - in1) * 0.5;```
If you pan a guitar to the left (via the effect), and send the drums to channels 3+4, you will hear the guitar pump to the center when the drums hit off center.

Another idea I have is, track the average angles of 2 stereo tracks using atan2(). Again, use a decay or average over time.

This should get you two angles which you want to separate (push apart). Calculate the desired angles. ie: 45 degrees apart and again, apply a decay to soften the shift.

Then you know how much to push the angles apart via cos/sin rotation. Its all 2D maths. I come from a 3D background, so I see LR as being XY, and therefore vector maths apply.

In theory, you could have an effect with 8 stereo inputs, with a stereo field repulsion of each stereo tracks average angle.

Hope that's not too much babble, but, yea, I see some potential ideas here.
__________________
http://wascal.net/music/