Unofficial LSL Reference

[[functions:llplaysound]]


Unofficial LSL reference

User Tools

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

Forgotten your password? Get a new one: Set new password

This is an old revision of the document!


Function: llPlaySound

llPlaySound(string sound, float volume)

Plays a sound once in the current prim.

Parameters

sound

The sound name, or a UUID. If it is a sound name, it must exist in the inventory of the prim.

volume

The volume from 0.0 (minimum) to 1.0 (max)

Notes

  • The playing sound will move with the prim (if the prim moves, so will the sound).
  • A prim can only have one sound at a time. If another sound starts playing, the currently playing sound or loop will stop, unless llSetSoundQueueing is set to TRUE.
    • Note that llTriggerSound and llTriggerSoundLimited start sounds that are not part of a prim, but are "dropped" where the prim is at the time of starting and become independent, and are therefore not subject to this limitation.
  • If the prim belongs to a HUD, the sound started by llPlaySound will be heard only by the wearer. To play sounds from a HUD that can be heard by people around, use llTriggerSound or llTriggerSoundLimited.
  • If the sound is a UUID, it doesn't need to be present in the prim.
  • If the name of a sound present in the prim's inventory matches the UUID of a sound different to it, the sound that will play is the one in the inventory, not the UUID.
  • If the name is not a UUID, and it is not present in the prim's inventory, an error will be shouted in DEBUG_CHANNEL.

Short examples

// Looks for a sound named "Applause" in the prim's inventory,
// playing it at full volume if it exists, or giving an error if not:
llPlaySound("Applause", 1.0);

// Plays a gunshot sound (unless a sound called 00000000-...0101
// already exists in the prim's inventory, in which case that sound
// will be played instead). The volume will be half the maximum.
llPlaySound("00000000-0000-0000-000000000101", 0.5);

See also