Audio Commands

gi.soundindex(sound_filename)

Entities use this function to cache sound, stored in the PAK-file, during spawning. After that they simply refer to the index returned from this function.

gi.sound(entity, channel, sound_index, volume, attenuation, time_ofs)

Generates sound centered on given entity. Channel specifies which channel to use. It is sound type related and a second sound of the same sort will overwrite the first sound. The function plays a sound given a sound index, which is retreived with gi.soundindex. Volume is between 0 and 1. Attenuation gives how far away sound can be heard. Time_ofs signifies the delay before playing the sound.

channel can be any of:

  • CHAN_AUTO

new sound - does not overwrite any others

  • CHAN_WEAPON

weapon sound

  • CHAN_VOICE

sound made by entities vocal chords :)

  • CHAN_ITEM

invulnerability, quad damage, etc

  • CHAN_BODY

footsteps, stomach rumblings :) plus optional flags :

  • CHAN_NO_PHS_ADD

everyone hears this (same as ATTN_NONE)

  • CHAN_RELIABLE

important sound - make sure it gets there safely

attenuation can be :

ATTN_NONE

heard everywhere

ATTN_NORM

carries a long way

ATTN_IDLE

does not carry as far?

ATTN_STATIC

does not go very far at all

gi.positioned_sound(origin, entity, sound_index, volume, attenuation, time_ofs)

Similar to sound (see above for most of settings). Origin sets position for sound to come from relative to level origin (NOT entity origin)