llPlaySound
function
Replaces deprecated llSound.
Function syntax
llPlaySound(string sound,// Name of a sound in the prim's inventory, or a UUID.float volume// Volume level to set, between 0.0 (silent) and 1.0 (loud).
);- Energy
- 10
Plays the specified sound once at volume, attached to the object. Only one sound can be attached to a prim at a time; new sounds or calling llStopSound stops previous playback. A second call with the same sound adjusts the volume without restarting it.
Plays attached sound once at volume
llPlaySound("", 0.0);Caveats
Section titled “Caveats”- A call to
llPlaySoundreplaces any other sound (so that only one sound can be played at the same time from the same prim), except sounds started with the deprecated llSound which always plays sound files till the end. - Sound files must be 30 seconds or shorter.
- Sounds are always sampled at 44.1KHz, 16-bit (unsigned), mono (stereo files will have one channel dropped — merged (as in combined) — when uploading).
- If the object playing the sound is a HUD, the sound is only heard by the user the HUD is attached to.
- To play a sound inworld from a HUD use
llTriggerSound. - It is impossible to play two (or more) sounds at the same time and have them start playing at exactly the same time ~ VWR-15663
- If multiple sound emitters play the same exact sound within range of the viewer at the same time, they are usually not in sync due to latency between the server/client and script execution & communication delays. This can produce echoes, odd resonance, and other strange effects that you (probably) do not want.
- When used in conjunction with
llSetSoundQueueing, sounds may incorrectly. play more than once. This can be fixed by disabling the sound queue if only a single sound sample is to be played. - Playing sounds is throttled. If the average number of played sounds per second exceeds the limit (22 sounds/s), all sounds from the object are suppressed until the average falls sufficiently. The throttle is per object, not per link or per script, so multiple links cannot be used to overcome the throttle.
- Once the throttle is hit, the following error will be shown in debug channel: “Too many sound requests. Throttled until average falls.”
Examples
Section titled “Examples”Example 1
default { state_entry() { llPlaySound("some_sound",1.0); } }Known issues
Section titled “Known issues”From the issue templates included by the wiki article:
- SVC-4897 (nf): llSetSyncTime() - a function for synchronising client side effects
- BUG-4130 (bug): llTriggerSoundLimited generates an improper script error when avatar sounds are disabled, llPlaySound disregards parcel settings
See also
Section titled “See also”Functions
Section titled “Functions”llTriggerSound— 3=Plays a soundunattached.llTriggerSoundLimitedllLoopSound— 3=Plays a soundattached.llLoopSoundMasterllLoopSoundSlavellPlaySoundSlavellSetSoundQueueing— 3=Sets a prim property which allows sounds to be queued, instead of overwriting each other.llStopSoundllLinkPlaySound— 3=Plays a sound from a prim in the linkset, with flexible options.llPreloadSound— 3=Preloads sound on viewers in range.llAdjustSoundVolume— 3=Adjusts volume ofattachedsound.
Articles
Section titled “Articles”- Sound Clips — 3=Specifications for uploading sounds.
Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.