Skip to content

Instantly share code, notes, and snippets.

@Atlante45
Created November 7, 2018 02:48
Show Gist options
  • Save Atlante45/b09a16c12c6a09396eb34737a8a8c92f to your computer and use it in GitHub Desktop.
Save Atlante45/b09a16c12c6a09396eb34737a8a8c92f to your computer and use it in GitHub Desktop.
var soundURL = "http://hifi-public.s3.amazonaws.com/birarda/medium-crowd.wav";
var injector = null;
var sound = null;
function startInjector() {
injector = Audio.playSound(sound, {
position: MyAvatar.position,
volume: 0.5,
localOnly: false,
loop: false
});
}
sound = SoundCache.getSound(soundURL);
if (sound.downloaded) {
startInjector();
} else {
sound.ready.connect(startInjector);
}
Script.scriptEnding.connect(function() {
injector.stop();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment