TITLE:: BFEncodeSter
summary:: Ambisonic B format encoder for stereo signals
categories:: Libraries>JoshUGens, UGens>Multichannel>Ambisonics
related:: Classes/BFDecode1, Classes/BFEncode1, Classes/BFEncode2, Classes/BFManipulate
keyword:: JoshUGens

DESCRIPTION::
note::Output channels are in order W,X,Y,Z.::
warning::Because of the way the W component is scaled, it is recommended that you only decode with BFDecode1 and it's methods.::


CLASSMETHODS::

METHOD:: ar

ARGUMENT:: l
Left side of the input signal.

ARGUMENT:: r
Right side of the input signal.

ARGUMENT:: azimuth
In radians, -pi to pi.

ARGUMENT:: width
In radians, width of stereo image.

ARGUMENT:: elevation
In radians, -0.5pi to +0.5pi.

ARGUMENT:: rho
The speaker radius (1 places shound at the radius, <1 within the radius, >1 is outside the radius) beyond the radius, a distance scaling is applied (no filtering is done).

ARGUMENT:: gain
A control rate level input.

ARGUMENT:: wComp
Chooses 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.


INSTANCEMETHODS::

METHOD:: checkInputs

METHOD:: init


EXAMPLES::

code::
s.boot;
s.scope;
// You'll only hear the first two channels on a stereo setup.

SynthDef(\testster, {
	var w, x, y, z;
	#w, x, y, z = BFEncodeSter.ar(
		PinkNoise.ar(Decay.ar(Impulse.ar(2, 0, 0.25))),
		SinOsc.ar(440, 0, Decay.ar(Impulse.ar(2, 0.5, 0.25))),
		MouseY.kr(0, pi), // center position of image
		MouseX.kr(0, pi) // width
		);
	Out.ar(0, B2Ster.ar(w, x, y))
	}).add;

s.sendMsg(\s_new, \testster, a=s.nextNodeID, 0, 1);
s.sendMsg(\n_free, a);
::
