hytopia
Version:
The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.
267 lines (115 loc) • 3.2 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [server](./server.md) > [AudioOptions](./server.audiooptions.md)
## AudioOptions interface
Options for creating an Audio instance.
**Signature:**
```typescript
export interface AudioOptions
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[attachedToEntity?](./server.audiooptions.attachedtoentity.md)
</td><td>
</td><td>
[Entity](./server.entity.md)
</td><td>
_(Optional)_ If set, audio playback will follow the entity's position.
</td></tr>
<tr><td>
[cutoffDistance?](./server.audiooptions.cutoffdistance.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ The cutoff distance between the audio source and the listener where the audio will be reduced to 0 volume. Must be greater than reference distance. Defaults to reference distance + 10.
</td></tr>
<tr><td>
[detune?](./server.audiooptions.detune.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ The detuning of the audio in cents.
</td></tr>
<tr><td>
[distortion?](./server.audiooptions.distortion.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ The amount of distortion to apply to the audio.
</td></tr>
<tr><td>
[duration?](./server.audiooptions.duration.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ The duration of the audio in seconds. Defaults to full duration.
</td></tr>
<tr><td>
[loop?](./server.audiooptions.loop.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether the audio should loop when it reaches the end. Defaults to false.
</td></tr>
<tr><td>
[offset?](./server.audiooptions.offset.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ The offset time in seconds from which the audio should start playing.
</td></tr>
<tr><td>
[playbackRate?](./server.audiooptions.playbackrate.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ The playback speed of the audio. Defaults to 1.
</td></tr>
<tr><td>
[position?](./server.audiooptions.position.md)
</td><td>
</td><td>
[Vector3Like](./server.vector3like.md)
</td><td>
_(Optional)_ The position in the world where the audio is played.
</td></tr>
<tr><td>
[referenceDistance?](./server.audiooptions.referencedistance.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ The maximum reference distance between the audio source and the listener where the audio will still be max volume. Defaults to 10.
</td></tr>
<tr><td>
[uri](./server.audiooptions.uri.md)
</td><td>
</td><td>
string
</td><td>
The URI or path to the audio asset to be played.
</td></tr>
<tr><td>
[volume?](./server.audiooptions.volume.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ The volume level of the audio. Defaults to 0.5.
</td></tr>
</tbody></table>