atmoky Engage Server SDK is now available! Check out the documentation to learn more.
API Reference
Classes
AudioObject

AudioObject

Summary
This class defines an audio object that can be positioned in space and can be rendered spatially.
⚠️
Do not instantiate an AudioObject yourself.

Properties

name

Optional name of the audio object.
Can be used to identify the audio object.
Type
string

Accessors

isConnected

Returns true if an input node is currently connected to this audio object.
Type
boolean

Methods

connect

Connects the input node to the audio object.
Signature
connect()
Returns
void

delete

Deletes this audio object object instance from the scene.
Signature
delete()
Returns
void
Remarks
This call will disconnect the input node from the renderer (if connected), and free this object's used slot.
⚠️
Do not use this instance after you've called delete on in.

disconnect

Disconnects this object from its input.
Signature
disconnect()
Returns
void

getDirectPathGainDecibels

Returns the currently set direct-path gain in decibels.
Signature
getDirectPathGainDecibels()
Returns
number The current direct-path gain in decibels.
💡
The effective direct-path gain will be the product of this value and the distance-dependent value of this object's distance model.

getDirectPathGainLinear

Returns the currently set direct-path gain as a linear value.
Signature
getDirectPathGainLinear()
Returns
number The current linear direct-path gain.
💡
The effective direct-path gain will be the product of this value and the distance-dependent value of this object's distance model.

getDistanceModel

Returns the currently used DistanceModel for the direct gain.
Signature
getDistanceModel()

getGainDecibels

Returns the currently set gain in decibels.
Signature
getGainDecibels()
Returns
number The current gain in decibels.

getGainLinear

Returns the currently set gain as a linear value.
Signature
getGainLinear()
Returns
number The current linear gain.

getInput

Returns the currently set input node.
Signature
getInput()
Returns
AudioNode The current input AudioNode.

getOcclusion

Returns the current occlusion value.
Signature
getOcclusion()
Returns
number The occlusion value.

getPosition

Returns the current position in cartesian coordinates.
Signature
getPosition()
Returns
Vector3D The position object with the current coordinates.

getPositionMode

Gets the current position mode.
Signature
getPositionMode()
Returns
PositionMode The position mode.

getRenderingMode

Gets the current rendering mode.
Signature
getRenderingMode()
Returns
RenderingMode The rendering mode.

getReverbDistanceModel

Returns the used DistanceModel for the reverb send.
Signature
getReverbDistanceModel()
Returns
undefined | DistanceModel The used distance model or null if no model has been set.

getReverbSendDecibels

Returns the currently set reverb gain in decibels.
Signature
getReverbSendDecibels()
Returns
number The current reverb send gain in decibels.

getReverbSendLinear

Returns the currently set reverb send gain as a linear value.
Signature
getReverbSendLinear()
Returns
number The current linear reverb send gain.

removeInput

Removes the previously set audio input.
Signature
removeInput()
Returns
void

setDirectPathGainDecibels

Sets the direct-path gain in decibels.
Signature
setDirectPathGainDecibels(gainInDecibels: number)
NameTypeDescription
gainInDecibelsnumberThe gain in decibels to apply to this object's direct path.
Returns
void
💡
The effective direct-path gain will be the product of this value and the distance-dependent value of this object's distance model.

setDirectPathGainLinear

Sets the direct-path gain from a linear value.
Signature
setDirectPathGainLinear(gain: number)
NameTypeDescription
gainnumberThe linear gain to apply to this object's direct path.
Returns
void
💡
The effective direct-path gain will be the product of this value and the distance-dependent value of this object's distance model.

setDistanceModel

Sets the DistanceModel for the direct gain.
Signature
setDistanceModel(distanceModel: DistanceModel)
NameTypeDescription
distanceModelDistanceModelThe distance model to be used.
Returns
void

setGainDecibels

Sets the gain in decibels.
Signature
setGainDecibels(gainInDecibels: number)
NameTypeDescription
gainInDecibelsnumberThe gain in decibels to apply to this audio object.
Returns
void

setGainLinear

Sets the overall gain from a linear value.
Signature
setGainLinear(gain: number)
NameTypeDescription
gainnumberThe linear gain to apply to this audio object.
Returns
void

setInput

Sets the audio input for this audio object.
Signature
setInput(input: AudioNode, outputIndex?: number, connect?: boolean)
NameTypeDescription
inputAudioNodeThe WebAudioAPI AudioNode that should be used for this object.
outputIndex optionalnumberThe output index of the audio input to use.
connect optionalbooleanWhether the input should be connected or disconnected.
Returns
void

setInputFromMediaStreamTrack

Sets the audio input when using a MediaStreamTrack and not an AudioNode.
Signature
setInputFromMediaStreamTrack(input: MediaStreamTrack, outputIndex?: number, connect?: boolean)
NameTypeDescription
inputMediaStreamTrackThe WebAudioAPI MediaStreamTrack that should be used for this audio object.
outputIndex optionalnumberThe output index of the audio input to use.
connect optionalbooleanWhether the input should be connected or disconnected.
Returns
void

setOcclusion

Sets the occlusion value.
Signature
setOcclusion(occlusion: number)
NameTypeDescription
occlusionnumberThe occlusion value to apply. Can range from 0.0 to 1.0.
Returns
void
Remarks
Turning occlusion up will make the audio object quieter as well as filtering out the top end of the spectrum.

setPosition

Sets the position using cartesian coordinates.
Signature
setPosition(x: number, y: number, z: number)
NameTypeDescription
xnumberThe new x coordinate.
ynumberThe new y coordinate.
znumberThe new z coordinate.
Returns
void

setPositionMode

Sets the position mode.
Signature
setPositionMode(mode: PositionMode)
NameTypeDescription
modePositionModeThe position mode to apply.
Returns
void

setRenderingMode

Sets the rendering mode.
Signature
setRenderingMode(mode: RenderingMode)
NameTypeDescription
modeRenderingMode
Returns
void

setReverbDistanceModel

Sets a DistanceModel for the reverb send.
Signature
setReverbDistanceModel(distanceModel: undefined | DistanceModel)
NameTypeDescription
distanceModelundefined | DistanceModelthe DistanceModel to set
Returns
void
💡
If null is passed, the distance model will be unset.

setReverbSendDecibels

Sets the gain in decibels that is applied to the reverb send.
Signature
setReverbSendDecibels(gainInDecibels: number)
NameTypeDescription
gainInDecibelsnumberThe gain in decibels to apply to the reverb send.
Returns
void

setReverbSendLinear

Sets the linear gain that is applied to the reverb send.
Signature
setReverbSendLinear(gain: number)
NameTypeDescription
gainnumberThe linear gain to apply to the reverb send.
Returns
void

unsetReverbDistanceModel

Unsets the DistanceModel for the reverb send.
Signature
unsetReverbDistanceModel()
Returns
void

atmoky Logo

© 2024 atmoky, GmbH.
All rights reserved.

We use cookies to measure and improve your browsing experience, and serve personalized ads or content.