# llPreloadSound

*LSL function*

Replaces deprecated `llSoundPreload`.

```lsl
void llPreloadSound(string sound);
```

- `string sound`: Name of the sound in the prim's inventory, or a UUID.

- Delay: 1 s
- Energy: 10

Causes nearby viewers in range to preload the specified sound from the object's inventory to prevent playback delays.

Preloads **sound** on viewers within range

```lsl title="How to use" frame="terminal"
llPreloadSound("");
```

## Examples

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

```lsl collapse={1-6, 12-16}
//Will preload a sound when rezzed, then play it when 'touched'.
string sound = "name or uuid";//sound in inventory or UUID of a sound.

default
{
    on_rez(integer start_param)
    {
        llSetText("Preloading....",<1,0,0>,1);
        llPreloadSound(sound);
        llSetText("Touch To Play",<1,1,1>,1);
    }
    touch_start(integer num_detected)
    {
        llPlaySound(sound, 1.0);
    }
}
```

</details>

## Shared wiki templates

The wiki article also includes shared templates whose conditional content is not reproduced here: [Template:Issues/BUG-7854](https://wiki.secondlife.com/wiki/Template:Issues/BUG-7854).

---

*Source: [LlPreloadSound](https://wiki.secondlife.com/wiki/LlPreloadSound) on the Second Life Wiki. Content from the Second Life Wiki articles LlPreloadSound (revision 1210617, 2022-04-11), Template:Issues/BUG-7854 (revision 1198283, 2015-12-16) and Template:LSL Function/inventory (revision 1191151, 2014-06-07), CC BY-SA 3.0.*

---

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