SoundHotkeys.cs - get it on the Sansar Store
This is a script which lets the owner/creator of an experience start and stop a sound using configurable hotkeys. It plays the sound in sync for everyone, so all visitors hear the same audio at the same time.
Just add one or more of these scripts to an object or an existing audio emitter.
In social situations:
- You've invited friends to your scene and want to begin a guided VR meditation exercise or other shared group happening.
- You're DJing a party in Sansar, and have a few riffs to mix with the music playing. You might even try setting up a drum kit, although there will be some latency.
- You're hosting a game show, and have prepared some funny sounds (like canned laughter) to heighten the mood at key moments.
Playing the script as a background sound
Simply add it to an object without an audio emitter component present. This may be desirable if you want everyone to hear the sound at the same volume level, regardless of avatar/camera position.
Sound - Click this dropdown to choose a sound from your inventory.
- Note that if you're using this with an audio emitter, the script won't use the emitter's Sound and Loudness dB parameters (under Sound Settings).
- Volume Diff Percent - 0 means default loudness. This range appears different than the Level sliders found in non-scripted audio emitters, and ranges from -100 percent (silent) to 150. You may want to test it beforehand with voice chat, to make sure it's not too loud or startling.
- Looped - Leave this as Off for one-shot sounds.
StartKey and StopKey - Set keys to trigger and halt this sound, respectively. For example, Key_F7 and Key_F8.
- See a list of possible hotkeys here. Avoid Key_F1 to Key_F5, they're already in use by Sansar and will conflict. You'll want to experiment and practice to find something that works reliably for you, especially when playing sounds for others.
- You can use multiple instances of this script in a scene. For example, you could use the same StopKey to stop them all at once.
Note that since these are scripts, their sounds currently can't be heard with Audio Preview — you need to build and visit your scene to hear them.
If you edit these scripts and build upon them, you need to attribute them as with other example scripts we provide. Have fun!