Appearance
Sound â
js
let optionalProps = {
autoPlay: Boolean,
loop: Boolean,
positional: default True, // use positional audio
// saves the sound as a url, e.g. sound.url, useful for Tone.js
loadURL: Boolean,
volume: 0.7
};
// Create a new THREE.PositionalAudio object using an asset name
const song = await Sound("melody.mp3", optionalProps);
// Load using an array buffer, this might be from a download or p2p data
const song = await Sound(arrayBuffer);
// Load from a URL
const audioClip = await Sound("https://sound.com/mp3.com");
// Example usage
song.play()
world.add(song);For more info check three.js Audio and PositionalAudio