Norda Scripts Creator of this doc
Document Updated ago
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
- 11025 Hz
- 22050 Hz
- 44100 Hz
Authorised and compatible formats
- .mp3
- .wav
- .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.
surface.PlaySound("addons/your_addon/sound/test.mp3")
Works on both client and server side :
-- Entity:EmitSound = Playing an audio file by an existing entity or a connected player
Entity:EmitSound(soundpath,soundLevel,pitch)
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 )
🇬 Gmod Base
How install an addon on Gmod ?
How to test an addon without uninstalling everything?
Backup problem in the data folder on Gmod server
How to replace Awesomium by Chromium on Gmod?
Sounds Formats supported on Gmod
Code minification (Optimisation)
Publish an addon on the Gmod workshop
🎯 Marketplace
Description of the Activation System - DRM
How to activate a Script on Gmod protected by a DRM ?
Write an review on a Gmod addon
Get technical support
🤖 Website
How to test a Gmod addon before buying it?
Text formatting language
Website ranks - Originahl Scripts
Presentation of the workspace
How avoid the Leak of your scripts