Help / Sounds Formats supported on Gmod (Gmod Base)

Sounds Formats supported on Gmod

Lang 🇬🇧 Lang 🇫🇷

imgNorda Scripts Creator of this doc
Document Updated ago
Sometimes some audio files don't work and you don't understand why, I am often asked, and the error is always the same, the format is not the right one or the sampling rate.

In the example below, this is a recurring problem, the user is using a sound that has a sample rate of 48000 and it doesn't work on Garry's Mod, there are several formats that are compatible and others that are not, that's why I create this documentation to help you better. To solve this problem you will have to get closer to an audio compilation software or use another audio file.

Fortunately, when this happens, it is displayed in the customer console in red, for example :

Unsupported 32-bit wave file alarmeagendaalarme.wav*** Invalid sample rate (48000) for sound 'alarme/agenda/alarme.wav'

This means that the user is using a sound that has a sample rate of 48000 and this does not work on Garry's Mod.

Authorised and compatible sampling rates on Gmod

Compatible sample rate
  1. 11025 Hz
  2. 22050 Hz
  3. 44100 Hz

Authorised and compatible formats

  1. .mp3
  2. .wav
  3. .ogg

Where to install sounds on Garry's Mod ( Gmod )?

The sounds must be placed in the sound/ folder. This can also be placed in an addons file so : addons/your_addon/sound/

The different GLua functions that can play a sound

In our example we will assume that the sound is installed in the folder: addons/your_addon/sound/test.mp3

Works only on the Client side :

-- surface.PlaySound = Play an audio file without a configurable position, perfect for interface buttons.

Works on both client and server side :

-- Entity:EmitSound = Playing an audio file by an existing entity or a connected player
Entity:EmitSound("addons/your_addon/sound/test.mp3", 65,100)

-- sound.Play = Playing an audio file at a position x y z
sound.Play( string Name, Vector Pos, number Level, number Pitch, number Volume )
sound.Play("addons/your_addon/sound/test.mp3", Vector(0,0,0), number Level, number Pitch, number Volume )