sound
Used primarily for adding new soundscript entries.
Methods
Creates a sound script. It can also override sounds, which seems to only work when set on the server.
You can find a list of common sound scripts that are shipped with the game by default here: Common Sounds.
A list of sound scripts can be retrieved with sound. GetTable.
sound.AddSoundOverrides( string filepath )
Overrides sounds defined inside of a txt file; typically used for adding map-specific sounds.
Emits a sound hint to the game elements to react to, for example to repel or attract antlions.
sound.Generate( string indentifier, number samplerate, number length, function callbackOrData, number loopStart = nil )
Creates a sound from a function.
Returns the most dangerous/closest sound hint based on given location and types of sounds to sense.
Returns properties of the soundscript.
Returns a list of all registered sound scripts.
New ones can be registered using sound. Add, and detailed information about each one can be retrieved via sound. GetProperties.
sound.Play( string snd, Vector pos, number level = 75, number pitch = 100, number volume = 1, number dsp = 0 )
Plays a sound from the specified position in the world.
If you want to play a sound without a position, such as a UI sound, use surface. PlaySound instead.
This function is similar to EmitSound, but with less options.
Plays a file from GMod directory. You can find a list of all error codes here
For external file/stream playback, see sound. PlayURL.
This fails for looping . wav files in 3D mode. Issue Tracker: 1752This fails with unicode file names. Issue Tracker: 2304
Allows you to play external sound files, as well as online radio streams.
You can find a list of all error codes here
For offline file playback, see sound. PlayFile.
Due to a bug with BASS, AAC codec streams cannot be played in 3D mode. Issue Tracker: 2296
Sets the gender of a specific actor (model). This is a system from base Half-Life 2 - global_actors. txt.
This will affect what voice lines npc_citizen will use when they have the given model set.
It is not limited to npc_citizens - any sound played on any entity with given model can have gender specific sounds playing, including soundscripts, by including $gender token in the sound file path.
Internally the gender is stored by model file name only (i. e. models/alyx. mdl would be stored as alyx), not the full path! Be aware of potential collisions.