BinauralPanner
Binaural panner with multiple sources and a listener.
Constructor Summary
| Public Constructor | ||
| public |
constructor(options: Object) Constructs an HRTF set. |
|
Member Summary
| Public Members | ||
| public set |
coordinateSystem(system: CoordinateSystem): * Set coordinate system. |
|
| public get |
Get coordinate system. |
|
| public set |
filterAfterLoad(post: Boolean): * Set post-filtering flag. |
|
| public get |
Get post-filtering flag. |
|
| public get |
Get coordinate system for filter positions. |
|
| public set |
filterCoordinateSystem(system: CoordinateSystem): * Set coordinate system for filter positions. |
|
| public set |
filterPositions(positions: Array<Coordinates>): * Set the filter positions of the HRTF set. |
|
| public get |
Get the filter positions of the HRTF set. |
|
| public get |
Get the HrtfSet. |
|
| public set |
Refer an external HRTF set, and update sources. |
|
| public set |
Refer an external listener, and update sources. |
|
| public set |
listenerCoordinateSystem(system: CoordinateSystem): * Set coordinate system for listener. |
|
| public get |
Get coordinate system for listener. |
|
| public set |
listenerPosition(positionRequest: Coordinates): * Set listener position. |
|
| public get |
Get listener position. |
|
| public set |
listenerUp(upRequest: Coordinates): * Set listener up direction (not an absolute position). |
|
| public get |
Get listener up direction. |
|
| public set |
listenerView(viewRequest: Coordinates): * Set listener view, as an aiming position or a relative direction, if viewIsRelative is respectively false or true. |
|
| public get |
Get listener view. |
|
| public set |
listenerViewIsRelative(relative: Boolean): * Set the type of view: absolute to an aiming position (when false), or a relative direction (when true). |
|
| public get |
Get the type of view. |
|
| public set |
sourcePositions(positionsRequest: Array<Coordinates>): * Set the sources positions. |
|
| public get |
Get the source positions. |
|
Method Summary
| Public Methods | ||
| public |
connectInputByIndex(index: Number, nodesToConnect: AudioNode | Array<AudioNode>, output: Number, input: Number): this Connect the input of a source. |
|
| public |
connectOutputByIndex(index: Number, nodesToConnect: AudioNode | Array<AudioNode>, output: Number, input: Number): this Connect the output of a source. |
|
| public |
connectOutputs(nodesToConnect: AudioNode | Array<AudioNode>, output: Number, input: Number): this Connect the output of each source. |
|
| public |
disconnectInputByIndex(index: Number, nodesToDisconnect: AudioNode | Array<AudioNode>): this Disconnect the input of one source. |
|
| public |
disconnectInputs(nodesToDisconnect: AudioNode | Array<AudioNode>): this Disconnect the input of each source. |
|
| public |
disconnectOutputByIndex(index: Number, nodesToDisconnect: AudioNode | Array<AudioNode>): this Disconnect the output of a source. |
|
| public |
disconnectOutputs(nodesToDisconnect: AudioNode | Array<AudioNode>): this Disconnect the output of each source. |
|
| public |
getSourcePositionByIndex(index: Number): Coordinates Get the position of one source. |
|
| public |
loadHrtfSet(sourceUrl: String): Promise.<this | Error> Load an HRTF set form an URL, and update sources. |
|
| public |
setSourcePositionByIndex(index: Number, positionRequest: Coordinates): this Set the position of one source. |
|
| public |
Update the sources filters, according to pending changes in listener, and source positions. |
|
Public Constructors
public constructor(options: Object) source
Constructs an HRTF set. Note that the filter positions are applied during the load of an HRTF URL.
Params:
| Name | Type | Attribute | Description |
| options | Object | ||
| options.audioContext | AudioContext | mandatory for the creation of FIR audio buffers |
|
| options.coordinateSystem | CoordinateSystem |
|
BinauralPanner#coordinateSystem |
| options.sourceCount | Number |
|
|
| options.sourcePositions | Array<coordinates> |
|
must be of length options.sourceCount BinauralPanner#sourcePositions |
| options.crossfadeDuration | Number |
|
in seconds. |
| options.hrtfSet | HrtfSet |
|
refer an external HRTF set. BinauralPanner#hrtfSet |
| options.filterCoordinateSystem | CoordinateSystem |
|
BinauralPanner#filterCoordinateSystem |
| options.filterPositions | Array<coordinates> |
|
array of positions to filter. Use undefined to use all positions from the HRTF set. BinauralPanner#filterPositions |
| options.filterAfterLoad | Boolean |
|
true to filter after full load of SOFA file |
| options.listener | Listener |
|
refer an external listener. BinauralPanner#listener |
| options.listenerCoordinateSystem | CoordinateSystem |
|
BinauralPanner#listenerCoordinateSystem |
| options.listenerPosition | Coordinates |
|
BinauralPanner#listenerPosition |
| options.listenerUp | Coordinates |
|
BinauralPanner#listenerUp |
| options.listenerView | Coordinates |
|
BinauralPanner#listenerView |
| options.listenerViewIsRelative | Boolean |
|
See:
- HrtfSet
- BinauralPanner#loadHrtfSet
Public Members
public set filterAfterLoad(post: Boolean): * source
Set post-filtering flag. When false, try to load a partial set of HRTF.
public get filterAfterLoad: Boolean: * source
Get post-filtering flag. When false, try to load a partial set of HRTF.
public get filterCoordinateSystem: CoordinateSystem: * source
Get coordinate system for filter positions.
public set filterCoordinateSystem(system: CoordinateSystem): * source
Set coordinate system for filter positions.
public set filterPositions(positions: Array<Coordinates>): * source
Set the filter positions of the HRTF set.
public set hrtfSet(hrtfSet: HrtfSet): * source
Refer an external HRTF set, and update sources. Its positions coordinate system must be 'gl'.
Throw:
when hrtfSet in undefined or hrtfSet.coordinateSystem is not 'gl'. |
See:
- HrtfSet
- BinauralPanner#update
public set listener(listener: Listener): * source
Refer an external listener, and update sources.
Throw:
when listener in undefined. |
See:
- Listener
- BinauralPanner#update
public set listenerCoordinateSystem(system: CoordinateSystem): * source
Set coordinate system for listener.
public set listenerPosition(positionRequest: Coordinates): * source
Set listener position. It will update the relative positions of the sources after a call to the update method.
Default value is [0, 0, 0] in 'gl' coordinates.
See:
- Listener#position
- BinauralPanner#update
public set listenerUp(upRequest: Coordinates): * source
Set listener up direction (not an absolute position). It will update the relative positions of the sources after a call to the update method.
Default value is [0, 1, 0] in 'gl' coordinates.
See:
- Listener#up
- BinauralPanner#update
public set listenerView(viewRequest: Coordinates): * source
Set listener view, as an aiming position or a relative direction, if viewIsRelative is respectively false or true. It will update the relative positions of the sources after a call to the update method.
Default value is [0, 0, -1] in 'gl' coordinates.
See:
- Listener#view
- Listener#viewIsRelative
- BinauralPanner#update
public set listenerViewIsRelative(relative: Boolean): * source
Set the type of view: absolute to an aiming position (when false), or a relative direction (when true). It will update the relative positions after a call to the update method.
See:
public set sourcePositions(positionsRequest: Array<Coordinates>): * source
Set the sources positions. It will update the relative positions after a call to the update method.
Throw:
if the length of positionsRequest is not the same as the number of sources |
See:
- BinauralPanner#update
- BinauralPanner#setSourcePositionByIndex
Public Methods
public connectInputByIndex(index: Number, nodesToConnect: AudioNode | Array<AudioNode>, output: Number, input: Number): this source
Connect the input of a source.
Return:
| this |
public connectOutputByIndex(index: Number, nodesToConnect: AudioNode | Array<AudioNode>, output: Number, input: Number): this source
Connect the output of a source.
Return:
| this |
public connectOutputs(nodesToConnect: AudioNode | Array<AudioNode>, output: Number, input: Number): this source
Connect the output of each source.
Return:
| this |
See:
- BinauralPanner#connectOutputByIndex
public disconnectInputByIndex(index: Number, nodesToDisconnect: AudioNode | Array<AudioNode>): this source
Disconnect the input of one source.
Return:
| this |
public disconnectInputs(nodesToDisconnect: AudioNode | Array<AudioNode>): this source
Disconnect the input of each source.
Params:
| Name | Type | Attribute | Description |
| nodesToDisconnect | AudioNode | Array<AudioNode> | disconnect all when undefined. |
Return:
| this |
public disconnectOutputByIndex(index: Number, nodesToDisconnect: AudioNode | Array<AudioNode>): this source
Disconnect the output of a source.
Return:
| this |
public disconnectOutputs(nodesToDisconnect: AudioNode | Array<AudioNode>): this source
Disconnect the output of each source.
Params:
| Name | Type | Attribute | Description |
| nodesToDisconnect | AudioNode | Array<AudioNode> |
Return:
| this |
public getSourcePositionByIndex(index: Number): Coordinates source
Get the position of one source.
Params:
| Name | Type | Attribute | Description |
| index | Number |
public loadHrtfSet(sourceUrl: String): Promise.<this | Error> source
Load an HRTF set form an URL, and update sources.
Params:
| Name | Type | Attribute | Description |
| sourceUrl | String |
Return:
| Promise.<this | Error> | resolve when URL successfully loaded. |
See:
public setSourcePositionByIndex(index: Number, positionRequest: Coordinates): this source
Set the position of one source. It will update the corresponding relative position after a call to the update method.
Params:
| Name | Type | Attribute | Description |
| index | Number | ||
| positionRequest | Coordinates |
Return:
| this |
See:
- BinauralPanner#update