2 summary:: Rotate a sound field.
3 related:: Classes/BiPanB2, Classes/DecodeB2, Classes/PanB, Classes/PanB2
4 categories:: UGens>Multichannel>Ambisonics, UGens>Multichannel>Panners
9 Rotate2 can be used for rotating an ambisonic B-format sound field around
10 an axis. Rotate2 does an equal power rotation so it also works well on
11 stereo sounds. It takes two audio inputs (x, y) and an angle control
12 (pos). It outputs two channels (x, y). It computes this:
15 xout = cos(angle) * xin + sin(angle) * yin;
19 yout = cos(angle) * yin - sin(angle) * xin;
22 where angle = pos * pi, so that -1 becomes -pi and +1 becomes +pi. This
23 allows you to use an LFSaw to do continuous rotation around a circle.
42 angle to rotate around the circle from -1 to +1. -1 is 180
43 degrees, -0.5 is left, 0 is forward, +0.5 is right, +1 is behind.
52 var w, x, y, p, q, a, b, c, d;
54 p = WhiteNoise.ar(0.05); // source
55 q = LFSaw.ar(200,0,0.03)+LFSaw.ar(200.37,0,0.03)+LFSaw.ar(201,0,0.03);
57 // B-format encode 2 signals at opposite sides of the circle
58 #w, x, y = PanB2.ar(p, -0.5) + PanB2.ar(q, 0.5);
60 #x, y = Rotate2.ar(x, y, MouseX.kr(-1,1));
62 // B-format decode to quad
63 #a, b, c, d = DecodeB2.ar(4, w, x, y);
65 [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr
71 // Rotation of stereo sound:
76 x = PinkNoise.ar(0.4);
77 y = LFTri.ar(800) * LFPulse.kr(3,0,0.3,0.2);
78 #x, y = Rotate2.ar(x, y, LFSaw.kr(0.1));
86 x = Mix.fill(4, { LFSaw.ar(200 + 2.0.rand2, 0, 0.1) });
87 y = SinOsc.ar(900) * LFPulse.kr(3,0,0.3,0.2);
88 #x, y = Rotate2.ar(x, y, MouseX.kr(0,2));
93 // Rotate B-format about Z axis:
97 #xout, yout = Rotate2.ar(xin, yin, pos);
99 // Rotate B-format about Y axis:
103 #xout, zout = Rotate2.ar(xin, zin, pos);
105 // Rotate B-format about X axis:
109 #yout, zout = Rotate2.ar(yin, zin, pos);