# engineAddSound (Client)

> Registers an audio file under a name, which `playSound` and `playSound3D` then play by that name.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Sound
- **URL**: https://wiki.mymp.gg/en/engineAddSound

## Syntax

```lua
bool engineAddSound(string name, string path [, int priority = 0])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `name` | `string` | The sound's name, up to 255 characters. Case does not matter. |
| `path` | `string` | Path of the audio file in the resource. |
| `priority` | `int` | Priority among those who register the same name. The highest wins; among equals, the newest. *(default: `0`)* |

## Returns

`true` if the sound was registered. Raises an error if the name is too long or the file cannot be read.

The sounds a resource registered are removed when it stops.

## Example

```lua
engineAddSound("horn_custom", "sounds/horn.ogg")
playSound("horn_custom")
```

## See also

- [engineRemoveSound (Client)](https://wiki.mymp.gg/en/engineRemoveSound.md): Removes a sound this resource registered with engineAddSound. If another registration of the same name exists, it takes over again.
- [engineGetSounds (Client)](https://wiki.mymp.gg/en/engineGetSounds.md): Lists the named sounds in effect now: the game's, the packs' and the resources'.
- [playSound (Client)](https://wiki.mymp.gg/en/playSound-client.md): Plays a sound with no position in the world, on this client only. Fires onClientSoundStarted with the reason play.
