Description
Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts • Server Entity Scripts • Assignment Client Scripts
TheAudio
API provides facilities to interact with audio inputs and outputs and to play sounds.Properties
Name | Type | Summary |
---|---|---|
muted | boolean |
|
mutedDesktop | boolean |
|
mutedHMD | boolean |
|
warnWhenMuted | boolean |
|
noiseReduction | boolean |
|
noiseReductionAutomatic | boolean |
|
noiseReductionThreshold | number |
Sets the noise gate threshold before your mic audio is transmitted.
(Applies only if |
inputVolume | number |
Adjusts the volume of the input audio, range |
inputLevel | number |
The loudness of the audio input, range |
clipping | boolean |
|
context | string |
The current context of the audio: either |
devices | object |
Read-only. Deprecated: This property is deprecated and will be removed. |
pushToTalk | boolean |
|
pushToTalkDesktop | boolean |
|
pushToTalkHMD | boolean |
|
pushingToTalk | boolean |
|
avatarGain | number |
The gain (relative volume in dB) that avatars' voices are played at. This gain is used at the server. |
localInjectorGain | number |
The gain (relative volume in dB) that local injectors (local environment sounds) are played at. |
serverInjectorGain | number |
The gain (relative volume in dB) that server injectors (server environment sounds) are played at. This gain is used at the server. |
systemInjectorGain | number |
The gain (relative volume in dB) that system sounds are played at. |
pushingToTalkOutputGainDesktop | number |
The gain (relative volume in dB) that all sounds are played at when the user is holding the push-to-talk key in desktop mode. |
acousticEchoCancellation | boolean |
|
isStereoInput | boolean |
|
isSoloing | boolean |
|
soloList | Array.<Uuid> |
The list of currently soloed avatar IDs. Empty list if not currently audio soloing. Read-only. |
Methods
Name | Return Value | Summary |
---|---|---|
addToSoloList
|
None |
Adds avatars to the audio solo list. If the audio solo list is not empty, only audio from the avatars in the list is played. |
getAvatarGain
|
number |
Gets the gain (relative volume) that avatars' voices are played at. This gain is used at the server. |
getInjectorGain
|
number |
Gets the gain (relative volume) that environment sounds from the server are played at. |
getLocalEcho
|
boolean |
Gets whether your microphone audio is echoed back to you by the client. When enabled, microphone audio is echoed even if you're muted or not using push-to-talk. |
getLocalInjectorGain
|
number |
Gets the gain (relative volume) that environment sounds from the client are played at. |
getNoiseReductionThreshold
|
number |
Gets the noise reduction threshold. |
getPushingToTalkOutputGainDesktop
|
number |
Gets the output volume gain that is used when the user is holding the push-to-talk key. Should be negative. |
getRecording
|
boolean |
Checks whether an audio recording is currently being made. |
getServerEcho
|
boolean |
Gets whether your microphone audio is echoed back to you from the server. When enabled, microphone audio is echoed only if you're unmuted or are using push-to-talk. |
getSystemInjectorGain
|
number |
Gets the gain (relative volume) that system sounds are played at. |
isStereoInput
|
boolean |
Gets whether the audio input is used in stereo. |
onContextChanged
|
None |
Deprecated: This function is deprecated and will be removed. |
playSound
|
AudioInjector |
Starts playing or "injecting" the content of an audio file. The sound is played globally (sent to the audio
mixer) so that everyone hears it, unless the |
playSystemSound
|
AudioInjector |
Starts playing the content of an audio file locally (isn't sent to the audio mixer). This is the same as calling
Audio.playSound with AudioInjector.AudioInjectorOptions |
removeFromSoloList
|
None |
Removes avatars from the audio solo list. If the audio solo list is not empty, only audio from the avatars in the list is played. |
resetSoloList
|
None |
Clears the audio solo list. |
setAvatarGain
|
None |
Sets the gain (relative volume) that avatars' voices are played at. This gain is used at the server. |
setInjectorGain
|
None |
Sets the gain (relative volume) that environment sounds from the server are played at. |
setInputDevice
|
None |
Deprecated: This function is deprecated and will be removed. |
setLocalEcho
|
None |
Sets whether your microphone audio is echoed back to you by the client. When enabled, microphone audio is echoed even if you're muted or not using push-to-talk. |
setLocalInjectorGain
|
None |
Sets the gain (relative volume) that environment sounds from the client are played at. |
setNoiseReductionThreshold
|
None |
Sets the noise gate threshold before your mic audio is transmitted. (Applies only if |
setOutputDevice
|
None |
Deprecated: This function is deprecated and will be removed. |
setPushingToTalkOutputGainDesktop
|
None |
Sets the output volume gain that will be used when the user is holding the push-to-talk key. Should be negative. |
setReverb
|
None |
Enables or disables reverberation. Reverberation is done by the client on the post-mix audio. The reverberation options come from either the domain's audio zone configured on the server or settings scripted by setReverbOptions. |
setReverbOptions
|
None |
Configures reverberation options. Use setReverb to enable or disable reverberation. |
setServerEcho
|
None |
Sets whether your microphone audio is echoed back to you from the server. When enabled, microphone audio is echoed only if you're unmuted or are using push-to-talk. |
setStereoInput
|
None |
Sets whether the audio input should be used in stereo. If the audio input doesn't support stereo then setting a value
of |
setSystemInjectorGain
|
None |
Sets the gain (relative volume) that system sounds are played at. |
startRecording
|
Uuid |
Starts making an audio recording of the audio being played in-world (i.e., not local-only audio) to a file in WAV format. Audio is recorded to snapshots directory specified in settings. |
stopRecording
|
None |
Finishes making an audio recording started with startRecording. |
toggleLocalEcho
|
None |
Toggles the echoing of microphone audio back to you by the client. When enabled, microphone audio is echoed even if you're muted or not using push-to-talk. |
toggleServerEcho
|
None |
Toggles the echoing of microphone audio back to you from the server. When enabled, microphone audio is echoed only if you're unmuted or are using push-to-talk. |
Signals
Name | Summary |
---|---|
acousticEchoCancellationChanged
|
Triggered when acoustic echo cancellation is enabled or disabled. |
avatarGainChanged
|
Triggered when the avatar gain changes. |
clippingChanged
|
Triggered when the clipping state of the input audio changes. |
contextChanged
|
Triggered when the current context of the audio changes. |
disconnected
|
Triggered when the client is disconnected from the audio mixer. |
environmentMuted
|
Triggered when the client is muted by the mixer because they're within a certain radius (50m) of someone who requested the mute through Developer > Audio > Mute Environment. |
inputLevelChanged
|
Triggered when the input audio level changes. |
inputReceived
|
Triggered when a frame of audio input is processed. |
inputVolumeChanged
|
Triggered when the input audio volume changes. |
isStereoInputChanged
|
Triggered when the input audio use changes between mono and stereo. |
localInjectorGainChanged
|
Triggered when the local injector gain changes. |
mutedByMixer
|
Triggered when the client is muted by the mixer because their loudness value for the noise background has reached the threshold set for the domain (in the server settings). |
mutedChanged
|
Triggered when the audio input is muted or unmuted for the current context (desktop or HMD). |
mutedDesektopChanged
|
Triggered when desktop audio input is muted or unmuted. |
mutedHMDChanged
|
Triggered when HMD audio input is muted or unmuted. |
noiseGateClosed
|
Triggered when the noise gate is closed. The input audio signal is blocked (fully attenuated) because it has fallen
below an adaptive threshold set just above the noise floor. Only occurs if |
noiseGateOpened
|
Triggered when the noise gate is opened. The input audio signal is no longer blocked (fully attenuated) because it has
risen above an adaptive threshold set just above the noise floor. Only occurs if |
noiseReductionAutomaticChanged
|
Triggered when the audio input noise reduction mode is changed. |
noiseReductionChanged
|
Triggered when audio input noise reduction is enabled or disabled. |
noiseReductionThresholdChanged
|
Triggered when the audio input noise reduction threshold is changed. |
nop
|
Deprecated: This signal is deprecated and will be removed. |
pushToTalkChanged
|
Triggered when push-to-talk is enabled or disabled for the current context (desktop or HMD). |
pushToTalkDesktopChanged
|
Triggered when push-to-talk is enabled or disabled for desktop mode. |
pushToTalkHMDChanged
|
Triggered when push-to-talk is enabled or disabled for HMD mode. |
pushingToTalkChanged
|
Triggered when the user starts or stops push-to-talk. |
pushingToTalkOutputGainDesktopChanged
|
Triggered when the push to talk gain changes. |
receivedFirstPacket
|
Triggered when the client receives its first packet from the audio mixer. |
serverInjectorGainChanged
|
Triggered when the server injector gain changes. |
systemInjectorGainChanged
|
Triggered when the system injector gain changes. |
warnWhenMutedChanged
|
Triggered when "warn when muted" is enabled or disabled. |
Method Details
(static) addToSoloList( ids ) | ||||||
---|---|---|---|---|---|---|
Adds avatars to the audio solo list. If the audio solo list is not empty, only audio from the avatars in the list is played. Parameters
Example
|
(static) getAvatarGain( ) → {number}
Returns: The avatar gain (dB) at the server. |
---|
Gets the gain (relative volume) that avatars' voices are played at. This gain is used at the server. Example
|
(static) getInjectorGain( ) → {number}
Returns: The injector gain (dB) at the server. |
---|
Gets the gain (relative volume) that environment sounds from the server are played at. |
(static) getLocalEcho( ) → {boolean}
Returns: true if echoing microphone audio back to you from the client is enabled,
false if it isn't.
|
---|
Gets whether your microphone audio is echoed back to you by the client. When enabled, microphone audio is echoed even if you're muted or not using push-to-talk. |
(static) getLocalInjectorGain( ) → {number}
Returns: The injector gain (dB) in the client. |
---|
Gets the gain (relative volume) that environment sounds from the client are played at. |
(static) getNoiseReductionThreshold( ) → {number}
Returns: The noise reduction threshold. 0.0 – 1.0
|
---|
Gets the noise reduction threshold. |
(static) getPushingToTalkOutputGainDesktop( ) → {number}
Returns: gain - The output volume gain (dB) while using push-to-talk. |
---|
Gets the output volume gain that is used when the user is holding the push-to-talk key. Should be negative. |
(static) getRecording( ) → {boolean}
Returns: true if an audio recording is currently being made, otherwise false .
|
---|
Checks whether an audio recording is currently being made. |
(static) getServerEcho( ) → {boolean}
Returns: true if echoing microphone audio back to you from the server is enabled,
false if it isn't.
|
---|
Gets whether your microphone audio is echoed back to you from the server. When enabled, microphone audio is echoed only if you're unmuted or are using push-to-talk. |
(static) getSystemInjectorGain( ) → {number}
Returns: The injector gain (dB) in the client. |
---|
Gets the gain (relative volume) that system sounds are played at. |
(static) isStereoInput( ) → {boolean}
Returns: true if the audio input is used in stereo, otherwise false .
|
---|
Gets whether the audio input is used in stereo. |
(static) onContextChanged( ) |
---|
Deprecated: This function is deprecated and will be removed. |
(static) playSound( sound, injectorOptionsopt ) → {AudioInjector}
Returns: The audio injector that plays the audio file. |
|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Starts playing or "injecting" the content of an audio file. The sound is played globally (sent to the audio
mixer) so that everyone hears it, unless the Parameters
Example
|
(static) playSystemSound( sound ) → {AudioInjector}
Returns: The audio injector that plays the audio file. |
||||||
---|---|---|---|---|---|---|
Starts playing the content of an audio file locally (isn't sent to the audio mixer). This is the same as calling
Audio.playSound with AudioInjector.AudioInjectorOptions Parameters
|
(static) removeFromSoloList( ids ) | ||||||
---|---|---|---|---|---|---|
Removes avatars from the audio solo list. If the audio solo list is not empty, only audio from the avatars in the list is played. Parameters
|
(static) resetSoloList( ) |
---|
Clears the audio solo list. |
(static) setAvatarGain( gain ) | ||||||
---|---|---|---|---|---|---|
Sets the gain (relative volume) that avatars' voices are played at. This gain is used at the server. Parameters
|
(static) setInjectorGain( gain ) | ||||||
---|---|---|---|---|---|---|
Sets the gain (relative volume) that environment sounds from the server are played at. Parameters
|
(static) setInputDevice( device, isHMD ) | |||||||||
---|---|---|---|---|---|---|---|---|---|
Deprecated: This function is deprecated and will be removed. Parameters
|
(static) setLocalEcho( ) |
---|
Sets whether your microphone audio is echoed back to you by the client. When enabled, microphone audio is echoed even if you're muted or not using push-to-talk. Example
|
(static) setLocalInjectorGain( gain ) | ||||||
---|---|---|---|---|---|---|
Sets the gain (relative volume) that environment sounds from the client are played at. Parameters
|
(static) setNoiseReductionThreshold( threshold ) | ||||||
---|---|---|---|---|---|---|
Sets the noise gate threshold before your mic audio is transmitted. (Applies only if Parameters
|
(static) setOutputDevice( device, isHMD ) | |||||||||
---|---|---|---|---|---|---|---|---|---|
Deprecated: This function is deprecated and will be removed. Parameters
|
(static) setPushingToTalkOutputGainDesktop( gain ) | ||||||
---|---|---|---|---|---|---|
Sets the output volume gain that will be used when the user is holding the push-to-talk key. Should be negative. Parameters
|
(static) setReverb( enable ) | ||||||
---|---|---|---|---|---|---|
Enables or disables reverberation. Reverberation is done by the client on the post-mix audio. The reverberation options come from either the domain's audio zone configured on the server or settings scripted by setReverbOptions. Parameters
Example
|
(static) setReverbOptions( options ) | ||||||
---|---|---|---|---|---|---|
Configures reverberation options. Use setReverb to enable or disable reverberation. Parameters
|
(static) setServerEcho( serverEcho ) | ||||||
---|---|---|---|---|---|---|
Sets whether your microphone audio is echoed back to you from the server. When enabled, microphone audio is echoed only if you're unmuted or are using push-to-talk. Parameters
|
(static) setStereoInput( stereo ) | ||||||
---|---|---|---|---|---|---|
Sets whether the audio input should be used in stereo. If the audio input doesn't support stereo then setting a value
of Parameters
|
(static) setSystemInjectorGain( gain ) | ||||||
---|---|---|---|---|---|---|
Sets the gain (relative volume) that system sounds are played at. Parameters
|
(static) startRecording( ) → {Uuid}
Returns: A valid Uuid if the specified file could be opened and audio recording has started, otherwise
Uuid.NONE .
|
---|
Starts making an audio recording of the audio being played in-world (i.e., not local-only audio) to a file in WAV format. Audio is recorded to snapshots directory specified in settings. Example
|
(static) stopRecording( ) |
---|
Finishes making an audio recording started with startRecording. |
(static) toggleLocalEcho( ) |
---|
Toggles the echoing of microphone audio back to you by the client. When enabled, microphone audio is echoed even if you're muted or not using push-to-talk. |
(static) toggleServerEcho( ) |
---|
Toggles the echoing of microphone audio back to you from the server. When enabled, microphone audio is echoed only if you're unmuted or are using push-to-talk. |
Signal Details
acousticEchoCancellationChanged(
isEnabled
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when acoustic echo cancellation is enabled or disabled. Parameters
|
avatarGainChanged(
gain
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the avatar gain changes. Parameters
|
clippingChanged(
isClipping
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the clipping state of the input audio changes. Parameters
|
contextChanged(
context
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the current context of the audio changes. Parameters
|
disconnected(
)
Returns: Signal |
---|
Triggered when the client is disconnected from the audio mixer. |
environmentMuted(
)
Returns: Signal |
---|
Triggered when the client is muted by the mixer because they're within a certain radius (50m) of someone who requested the mute through Developer > Audio > Mute Environment. |
inputLevelChanged(
level
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the input audio level changes. Parameters
|
inputReceived(
inputSamples
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when a frame of audio input is processed. Parameters
|
inputVolumeChanged(
volume
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the input audio volume changes. Parameters
|
isStereoInputChanged(
isStereo
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the input audio use changes between mono and stereo. Parameters
|
localInjectorGainChanged(
gain
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the local injector gain changes. Parameters
|
mutedByMixer(
)
Returns: Signal |
---|
Triggered when the client is muted by the mixer because their loudness value for the noise background has reached the threshold set for the domain (in the server settings). |
mutedChanged(
isMuted
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the audio input is muted or unmuted for the current context (desktop or HMD). Parameters
Example
|
mutedDesektopChanged(
isMuted
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when desktop audio input is muted or unmuted. Parameters
Example
|
mutedHMDChanged(
isMuted
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when HMD audio input is muted or unmuted. Parameters
|
noiseGateClosed(
)
Returns: Signal |
---|
Triggered when the noise gate is closed. The input audio signal is blocked (fully attenuated) because it has fallen
below an adaptive threshold set just above the noise floor. Only occurs if |
noiseGateOpened(
)
Returns: Signal |
---|
Triggered when the noise gate is opened. The input audio signal is no longer blocked (fully attenuated) because it has
risen above an adaptive threshold set just above the noise floor. Only occurs if |
noiseReductionAutomaticChanged(
isEnabled
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the audio input noise reduction mode is changed. Parameters
|
noiseReductionChanged(
isEnabled
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when audio input noise reduction is enabled or disabled. Parameters
|
noiseReductionThresholdChanged(
threshold
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the audio input noise reduction threshold is changed. Parameters
|
nop(
)
Returns: Signal |
---|
Deprecated: This signal is deprecated and will be removed. |
pushToTalkChanged(
enabled
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when push-to-talk is enabled or disabled for the current context (desktop or HMD). Parameters
Example
|
pushToTalkDesktopChanged(
enabled
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when push-to-talk is enabled or disabled for desktop mode. Parameters
|
pushToTalkHMDChanged(
enabled
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when push-to-talk is enabled or disabled for HMD mode. Parameters
|
pushingToTalkChanged(
talking
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the user starts or stops push-to-talk. Parameters
|
pushingToTalkOutputGainDesktopChanged(
gain
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the push to talk gain changes. Parameters
|
receivedFirstPacket(
)
Returns: Signal |
---|
Triggered when the client receives its first packet from the audio mixer. |
serverInjectorGainChanged(
gain
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the server injector gain changes. Parameters
|
systemInjectorGainChanged(
gain
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the system injector gain changes. Parameters
|
warnWhenMutedChanged(
isEnabled
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when "warn when muted" is enabled or disabled. Parameters
|