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.
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 |
|
maxDistance |
0. |
|
refDistance |
0. |
|
release |
0 ≤ x ≤ 10 |
|
rolloffFactor |
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.
AudioTonePositional::readyAudioTonePositional::playAudioTonePositional::stop
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Five stones each carry a child Positional Audio Tone: bouncing balls land on them, and the stones' collision events play each one's note from where it sits.
With your sound on, click once to start the audio, then listen: every bounce plays the stone's note, and the log shows its frequency. Run the example again to replay. Drag to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(PositionalAudioToneComponent); if (component) log(component.props);}