# Tone.Listener

↳ EXTENDS Tone
SINGLETON

Both Tone.Panner3D and Tone.Listener have a position in 3D space using a right-handed cartesian coordinate system. The units used in the coordinate system are not defined; these coordinates are independent/invariant of any particular units such as meters or feet. Tone.Panner3D objects have an forward vector representing the direction the sound is projecting. Additionally, they have a sound cone representing how directional the sound is. For example, the sound could be omnidirectional, in which case it would be heard anywhere regardless of its forward, or it can be more directional and heard only if it is facing the listener. Tone.Listener objects (representing a person’s ears) have an forward and up vector representing in which direction the person is facing. Because both the source stream and the listener can be moving, they both have a velocity vector representing both the speed and direction of movement. Taken together, these two velocities can be used to generate a doppler shift effect which changes the pitch.

Note: the position of the Listener will have no effect on nodes not connected to a Tone.Panner3D

### CONSTRUCTOR

new Tone.Listener ( )

{
positionX : 0 ,
positionY : 0 ,
positionZ : 0 ,
forwardX : 0 ,
forwardY : 0 ,
forwardZ : 1 ,
upX : 0 ,
upY : 1 ,
upZ : 0
}

## Members

#### .upZ

Number #

The z coordinate of the listener’s up direction. i.e. the direction the listener is standing in.

#### .forwardY

Number #

The y coordinate of the listeners front direction. i.e. which way they are facing.

#### .forwardZ

Number #

The z coordinate of the listeners front direction. i.e. which way they are facing.

#### .isListener

Boolean #

Is an instanceof Tone.Listener

#### .positionX

Number #

The x position of the panner object.

#### .positionY

Number #

The y position of the panner object.

#### .positionZ

Number #

The z position of the panner object.

#### .upX

Number #

The x coordinate of the listener’s up direction. i.e. the direction the listener is standing in.

#### .upY

Number #

The y coordinate of the listener’s up direction. i.e. the direction the listener is standing in.

#### .forwardX

Number #

The x coordinate of the listeners front direction. i.e. which way they are facing.

## Methods

#
↪ returns

this

Clean up.

#### .setOrientation ( )

#
x
type: Number
y
type: Number
z
type: Number
upX
type: Number
upY
type: Number
upZ
type: Number
↪ returns

this

Sets the orientation of the listener using two vectors, the forward vector (which direction the listener is facing) and the up vector (which the up direction of the listener). An up vector of 0, 0, 1 is equivalent to the listener standing up in the Z direction.

#### .setPosition ( )

#
x
type: Number
y
type: Number
z
type: Number
↪ returns

this

Sets the position of the listener in 3d space.

docs generated Sep 15 2019