Skip to content

Audio Tone

Updated

A synthesizer scripts play notes on: one-shots, held notes and chords.

Type
comp-audio-tone
Script class
AudioToneComponent
Per entity
One
Version
1.0.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
release 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.

  • AudioTone::ready
  • AudioTone::play
  • AudioTone::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(AudioToneComponent);
if (component) log(component.props);
}