Sounds Formats supported on Gmod🇫🇷 🇬🇧
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. I can also do it for you. In this case please contact me.
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
- 11025 Hz
- 22050 Hz
- 44100 Hz
Authorised and compatible formats
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
-- 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 )