1TITLE:: BFEncode2
2summary:: Ambisonic B format encoder
3categories::Libraries>JoshUGens, UGens>Multichannel>Ambisonics
4related:: Classes/BFDecode1, Classes/BFEncode1, Classes/BFEncodeSter, Classes/BFManipulate
5keyword:: JoshUGens
6
7DESCRIPTION::
8x, y positions:
9  list::
10	  ## 0 -1 behind
11	  ## 0 1 in front
12	  ## -1 0 right
13	  ## 1 0 left
14  ::
15Output channels are in order W,X,Y,Z.
16
17warning:: Because of the way the W component is scaled, it is recommended that you only decode with BFDecode1 and it's methods.::
18
19CLASSMETHODS::
20
21METHOD:: ar
22
23ARGUMENT:: in
24Input signal.
25
26ARGUMENT:: point_x
27A point in the x axis.
28
29ARGUMENT:: point_y
30A point in the y axis.
31
32ARGUMENT:: elevation
33In radians, -0.5pi to +0.5pi.
34
35ARGUMENT:: gain
36A control rate level input.
37
38ARGUMENT:: wComp
39Chooses how the W channels is scaled. If 0, a scaler of 0.707 is used. If 1, W is varied according to the scaling of the X, Y and Z channels. 1 is the default.
40
41
42
43INSTANCEMETHODS::
44
45METHOD:: init
46
47
48EXAMPLES::
49
50code::
51s.boot;
52// You'll only hear the first two channels on a stereo setup.
53({
54	#w, x, y, z = BFEncode2.ar(WhiteNoise.ar, MouseX.kr(-20, 20), MouseY.kr(20, -20), 0, 0.3);
55	//decode for 4 channels
56	BFDecode1.ar(w, x, y, z, [-0.25pi, 0.25pi, 0.75pi, 1.25pi], 0);
57}.scope(4));
58::
59