# llPlaySound

*LSL function*

Replaces deprecated `llSound`.

```lsl
void llPlaySound(string sound, float volume);
```

- `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**

```lsl title="How to use" frame="terminal"
llPlaySound("", 0.0);
```

## Caveats

- 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](https://wiki.secondlife.com/wiki/LlSound) which always plays sound files till the end.
- Sound files must be 30 seconds or shorter.
- [Sounds are always sampled](https://wiki.secondlife.com/wiki/Sound_Clips) 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](https://wiki.secondlife.com/wiki/HUD), the sound is only heard by the user the HUD is attached to.
- To play a sound inworld from a HUD use [llTriggerSound](/functions/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](https://jira.secondlife.com/browse/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](/functions/llSetSoundQueueing/), sounds may incorrectly. [play more than once.](https://community.secondlife.com/forums/topic/443645-llplaysound-plays-the-sound-twice-or-more/) 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

<details open>
<summary>Example 1</summary>

```lsl
default
 {
     state_entry()
     {
          llPlaySound("some_sound",1.0);
     }
 }
```

</details>

## 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

### Functions

- [llTriggerSound](/functions/llTriggerSound/) — 3=Plays a sound `unattached`.
- [llTriggerSoundLimited](/functions/llTriggerSoundLimited/)
- [llLoopSound](/functions/llLoopSound/) — 3=Plays a sound `attached`.
- [llLoopSoundMaster](/functions/llLoopSoundMaster/)
- [llLoopSoundSlave](/functions/llLoopSoundSlave/)
- [llPlaySoundSlave](/functions/llPlaySoundSlave/)
- [llSetSoundQueueing](/functions/llSetSoundQueueing/) — 3=Sets a prim property which allows sounds to be queued, instead of overwriting each other.
- [llStopSound](/functions/llStopSound/)
- [llLinkPlaySound](/functions/llLinkPlaySound/) — 3=Plays a sound from a prim in the linkset, with flexible options.
- [llPreloadSound](/functions/llPreloadSound/) — 3=Preloads sound on viewers in range.
- [llAdjustSoundVolume](/functions/llAdjustSoundVolume/) — 3=Adjusts volume of `attached` sound.

### Articles

- [Sound Clips](https://wiki.secondlife.com/wiki/Sound_Clips) — 3=Specifications for uploading sounds.

---

*Source: [LlPlaySound](https://wiki.secondlife.com/wiki/LlPlaySound) on the Second Life Wiki. Content from the Second Life Wiki articles LlPlaySound (revision 1217843, 2025-01-04), Template:Issues/SVC-4897 (revision 1050552, 2010-10-02), Template:Issues/BUG-4130 (revision 1182632, 2013-10-15) and Template:LSL Function/inventory (revision 1191151, 2014-06-07), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llPlaySound/
