Garry's Mod Wiki

Used primarily for adding new soundscript entries.

Methods

void sound.Add( table soundData )

Creates a sound script. It can also override sounds, which seems to only work when set on the server.

void sound.AddSoundOverrides( string filepath )

Overrides sounds defined inside of a txt file; typically used for adding map-specific sounds.

void sound.Generate( string indentifier, number samplerate, number length, function callback )

Creates a sound from a function.

This function cannot generate sounds that have a duration of less than 1 second.
Sounds persist between disconnects.
table sound.GetProperties( string name )

Returns properties of the soundscript.

table sound.GetTable()

Returns a list of all registered sound scripts.

void sound.Play( string Name, Vector Pos, number Level, number Pitch, number Volume )

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.

void sound.PlayFile( string path, string flags, function callback )

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.
This fails with unicode file names.
void sound.PlayURL( string url, string flags, function callback )

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.

Page Links


Special Pages


Wikis

?

Render Time: 32ms

Session 0
DB GetPage 3
Generate Html 5
SaveChanges 9
Render Body 0
Render Sidebar 12