Revision Difference
sound_basics#563142
<warning>
This page is a work in progress
</warning>
<title>Sound Reference - Basics</title>
# Sound Reference
Other pages on the topic of audio and sound are:
* **Basics**
* <page text="Creating Looping Sounds">Creating_Looping_Sounds</page>
# Sound Basics⤶
# Folder Structure⤶
⤶
When the game attempts to load sound files, it looks for them in the following locations and order:⤶
1. `garrysmod/sound/`⤶
2. `garrysmod/addons/<Addon Name>/sound/`⤶
3. `garrysmod/gamemodes/<Gamemode Name>/content/sound/`⤶
⤶
<note>⤶
Unlike other asset folders (`materials/`, `models/`, etc.) the `sound` folder's name is singular (`sound`) rather than plural (`sounds`) and does **not** end with an "`s`".⤶
</note>⤶
⤶
<example name="Choosing a Folder Structure">⤶
<description>⤶
Suppose you have an audio file you want to play called `weapon_reload.mp3` that is intended for use as part of a <page text="Scripted Weapon (SWEP)">Structures/SWEP</page> called `rocket_launcher`.⤶
⤶
There are 3 locations where you might place `weapon_reload.mp3`:⤶
⤶
1. During the early proof-of-concept development of your weapon, you might add files to the game's basic folder structure. ⤶
In this case, you might use the path: `garrysmod/sound/weapons/rocket_launcher/weapon_reload.mp3`⤶
⤶
2. Suppose that this `rocket_launcher` weapon is part of an <page text="Addon">Addons</page> called `weapon_pack`. ⤶
Here you would use a folder structure like: `garrysmod/addons/weapon_pack/sound/weapons/rocket_launcher/weapon_reload.mp3`⤶
⤶
3. If this `rocket_launcher` is part of a larger <page text="Gamemode">Gamemode_Creation</page> called `rocket_deathmatch`, you would instead put this audio file within the gamemode's folder structure. ⤶
The folder structure here might look like: `garrysmod/gamemodes/rocket_deathmatch/content/sound/weapons/rocket_launcher/weapon_reload.mp3`⤶
⤶
In all 3 cases, the file path used to load and play the file from your Lua script(s) is: `weapons/rocket_launcher/weapon_reload.mp3`⤶
</description>⤶
</example>⤶
⤶
<example name="Load Order">⤶
<description>⤶
⤶
TODO⤶
⤶
</description>⤶
</example>⤶
⤶
⤶
# File Formats⤶
⤶
⤶