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.
Properties
Section titled “Properties”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 |
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
AudioTone::readyAudioTone::playAudioTone::stop
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
A success jingleOn puzzle/solved, an Audio Tone schedules a rising C major arpeggio and a final chord in one go.
Press Solve puzzle to hear the jingle.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(AudioToneComponent); if (component) log(component.props);}