llLinkPlaySound
function
Function syntax
llLinkPlaySound(integer link,// Link number (1 for root, >1 for children) or a LINK_* flag. Values: Linksstring 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).integer flags// Bitwise flags (combination of SOUND_*) controlling the sound playback. Values: PlaySoundFlag
);- Energy
- 10
Plays the specified sound on the linked prim link (once or looping) at volume. Only one sound can be attached to a prim at a time; new attachments or calling llStopSound stops previous playback. Controlled by flags.
Plays attached sound once at volume
llLinkPlaySound(0, "", 0.0, 0);Specification
Section titled “Specification”| Constant | Value | Description | LSL Function |
|---|---|---|---|
SOUND_PLAY | 0x00 | This is the default behavior. Plays the sound once, attached to the linked primitive. | llPlaySound |
SOUND_LOOP | 0x01 | Loops the sound attached to the linked primitive. | llLoopSound |
SOUND_TRIGGER | 0x02 | Triggers the sound at the location of the linked prim. The sound is not attached and does not move with the prim. If this flag is set it overrides all others. | llTriggerSound |
SOUND_SYNC | 0x04 | Synchronizes sound playback to the nearest sound master. Please see llLoopSoundMaster. | llLoopSoundSlave, llPlaySoundSlave |
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, 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 echos, 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. - Use
llLinkStopSoundto stop a looped sound started in a link withSOUND_LOOP. - 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() { llLinkPlaySound(LINK_ROOT, "some_sound", 1.0, SOUND_PLAY); } }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 eachother.llStopSoundllLinkStopSoundllPreloadSound— 3=Preloads sound on viewers within range.llLinkAdjustSoundVolume— 3=Adjusts volume ofattachedsound.
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.