Skip to content
lsl.devlsl.devLSL Dev

llLinkPlaySound

function
Function syntax
llLinkPlaySound(
  1. integer link,// Link number (1 for root, >1 for children) or a LINK_* flag. Values: Links
  2. string sound,// Name of a sound in the prim's inventory, or a UUID.
  3. float volume,// Volume level to set, between 0.0 (silent) and 1.0 (loud).
  4. 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

How to use
llLinkPlaySound(0, "", 0.0, 0);
ConstantValueDescriptionLSL Function
SOUND_PLAY0x00This is the default behavior. Plays the sound once, attached to the linked primitive.llPlaySound
SOUND_LOOP0x01Loops the sound attached to the linked primitive.llLoopSound
SOUND_TRIGGER0x02Triggers 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_SYNC0x04Synchronizes sound playback to the nearest sound master. Please see llLoopSoundMaster.llLoopSoundSlave, llPlaySoundSlave
  • A call to llPlaySound replaces 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 llLinkStopSound to stop a looped sound started in a link with SOUND_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.”
Example 1
default
{
state_entry()
{
llLinkPlaySound(LINK_ROOT, "some_sound", 1.0, SOUND_PLAY);
}
}
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.