Skip to content

Audio Tone Positional

Updated

A synthesizer placed in the world, quieter with distance.

Type
comp-audio-tone-positional
Script class
PositionalAudioToneComponent
Per entity
One
Version
1.1.0

Read about it in Tones: what it does, how to use it from a script, and examples.

The props the runtime declares for this component, with their defaults and accepted ranges.

Prop Default Range
attack 0 ≤ x ≤ 10
decay 0 ≤ x ≤ 10
duration 0 ≤ x ≤ 60
maxDistance 0.001 ≤ x ≤ 10000
refDistance 0.01 ≤ x ≤ 10000
release 0 ≤ x ≤ 10
rolloffFactor 0 ≤ x ≤ 10
sustain 0 ≤ x ≤ 1
voices 1 ≤ x ≤ 64, integer
volume 0 ≤ x ≤ 1

Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.

  • AudioTonePositional::ready
  • AudioTonePositional::play
  • AudioTonePositional::stop

Run it in the browser, read its scripts, and download it as an XR Creator project.

#pragma lifecycle(startup)
function startup() {
const component = self.parent.getComponent(PositionalAudioToneComponent);
if (component) log(component.props);
}