The in-game speaker editor is a graphical user interface to create and manipulate ambient speakers. The GUI can be used to select the sound file, edit the properties of the target speaker entity, the origin, etc. The speaker entities and co-ordinates are stored in a separate file ‘/sound/maps/<mapname>.sps’, this file is saved every time you use one of the commands.
There are four commands (toggles) available for editing speaker’s as follows: (Any of these commands can be bound to keys for quicker editing)
This enables the edit mode for speakers. It automatically disables drawing of your HUD and weapon. You will get an overview of current number of speakers in the map (only those placed with \editSpeakers) and what keys your edit commands are bound to. Once in edit mode you can use the commands for creating, modifying and reverting. Executing \editSpeakers again will disable edit mode.
This creates a new speaker right in front of you (64 units horizontal offset of the player origin for the techies out there). You can’t place speakers inside solid structures, if you attempt this it will be moved horizontally towards your origin until it can be placed.
Point your crosshair at the speaker you want to edit and use \modifySpeaker to bring up the GUI. The GUI has the following options to set the speaker’s flags:origin
Click on the speaker’s axis and move the mouse to change the origin (x,y,z).
Type the path to the sound file you want to use (it must be within the etmain directory) typically this is sound/world/<filename>.wav for ambient sounds. You can use TAB to auto complete the filename or write it manually.
The name you can use to trigger the speaker from a script file. Valid letters are those from the English alphabet, digits 0-9, hyphen ‘-‘ and underscore ‘_’, capitalisation is ignored (see the scripting section).
The choices are no, on and off:
no – speaker plays once or randomly (see Wait and Random flags).
on – speaker plays in a loop forever or until deactivated.
off – speaker plays in a loop after activation forever or until deactivated again.
The choices are no, nopvs and global.
no – the speaker is subject to pvs, if you “walk around the corner” you will not be able to hear it anymore. Note that sound engine has no means of calculating obstruction, occlusion or reflection.
nopvs – the speaker is audible everywhere within it’s range, even if you can’t see it.
global – the speaker is audible everywhere on the map (e.g. the thunders on radar). Global sounds can’t be looped and ignore all other flags.
Sets the time in milliseconds after which the speaker is played again. The looped flag must be set to no. Speakers with a wait time can’t be triggered from a script.
Sets the span in milliseconds by how much a wait time is randomised, e.g. setting wait to 10000 and random to 2000 will repeat the sound every 8 to 12 seconds.
The actual volume is defined by the sound sample and not by the game engine, the volume flag acts as an amplifier. The default volume is 127 which means there is no volume modification done to the sound file. To make a sound twice as loud (+6dB) in game you would set the volume to 255 or half as loud (-6dB) you would set it to 63. How much amplification you can use depends on the volume of the sound file, if you use too much you will notice digital clipping in which case you should reduce the volume.
A speaker emits noise omni-directional; imagine the audible area as being a sphere with the speaker in the centre of it. The range flag sets the radius of the sphere (default is 1250 units). The noise gradually fades out over the range. Range and Volume flags work closely together, if you have an object with a loud noise, you would want to increase Volume and Range for a realistic effect.
The last speaker system command will undo the last command issued while in edit mode.
There are three trigger types available to trigger sound events from map scripts. Every speaker that is supposed to be executed via a script needs a unique targetname. The triggers are:
||plays a speaker on execution
||turns on a looped speaker on execution (speaker’s looped flag must be ‘off’ or it will play)
||turns off a looped speaker on execution
togglespeaker will switch the speaker from one state to another. If toggling a looped sound it will start or stop playing. A non-looped sound will play once and then stop.
enablespeaker and disablespeaker can be used to switch on and off a looping sound, e.g. the Morse code sound for the command posts).