> For the complete documentation index, see [llms.txt](https://saitama-studio.gitbook.io/essential-systems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://saitama-studio.gitbook.io/essential-systems/systems/audio.md).

# Audio

Our Audio Controller manages and plays sounds, allowing sounds to be triggered, paused, or stopped. Including other features such as random pitch & easily separate sounds into different tracks.

<figure><img src="https://3846168334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhjeEdzvIH0d5vrHiguxu%2Fuploads%2FjJPhI45BjrJNGKKyxOVZ%2FMedia04.png?alt=media&amp;token=a04749d0-27bf-4281-a43c-d162973dba92" alt=""><figcaption></figcaption></figure>

For us to play sounds, we need to store the sounds somewhere. This is where the `Audio Master` helps us. Add the `Audio Master` script to an object in the scene.

{% hint style="warning" %}
There **must** always be exactly **one** `Audio Master` object in the scene at once.
{% endhint %}

Here, we can add/remove/update sounds and differentiate sound effects into different tracks allowing multiple sounds to play in parallel with different settings.&#x20;

For us to add sounds, we need to create one. Go to `Create/Essentials/Audio/Sound`. This will create a `Sound` object. Here we can add multiple audio clips (it will select one at random) and change a lot of other settings (all with tooltips if you hover the property).

{% hint style="info" %}
Be sure to name your sound to be able to easily play a sound from any other script by referencing its name.
{% endhint %}

To add the sound we simply add it to the `Audio Master`. You can choose any track or create a new one.

To now play the sound, we simply add the following line anywhere:

```csharp
AudioMaster.PlaySound("soundnamehere");
```

### Automatically add play sound calls

Sometimes, you would simply like to play a sound without digging around in your own code all the time. This is where the `Audio Player` comes in handy. Add the `Audio Player` script to any game object. Now you can add a new entry. Select the sound you want to play and add an event. You can now `Subscribe` to that sound and it will automatically generate a line of code that simply calls the `Audio Master` to play the sound.
