Adding/Modifying Sound
Quake2 Demo Editing Tutorial

Written 5/99 by Overman

          

One of the most exciting parts of demo editing and movie making is the addition of new sounds, or the modification of existing sounds.   All sounds in a demo are indexed in the Sound List in Keygrip2.  These sounds can be triggered in a number of ways, but most often with a Sound message. 

The Sound List

This window shows all the sounds which appear in a demo, with only a few exceptions which we will cover later.  The sounds are listed with their Sound subdirectory name (such as world/ ) and their filename (such as electro.wav).   For the most part, these sound files are actually contained in one of the Quake 2 pak files, but more sounds may be added to the baseq2\sound\ subdirectory (or to the appropriate mod subdirectory).  If you have completed the tutorial in the Keygrip2 help documentation, you have a basic understanding of how this works:  place your sound in baseq2\sound, and add it to the Sound List

Notice that some sounds in the Sound List are preceded with an asterisk (for example, *death1.wav).  These sound entries are designed to automatically trigger the appropriate player-specific sound for each player in the demo, based on the model they are using.  If a male player emits the *death1.wav sound, the file players/male/death1.wav will be played.  If a cyborg emits that same sound, the file players/cyborg/death1.wav will be played instead.  As a result, these "special" sound entries are pointers to a model-relative sound, not a specific sound in the Quake2 pak or sound subdirectory.  Just something to keep in mind.

Messagetype:  Sound

Most sounds in a demo are triggered with a Sound message.  The following table shows the list of parameters of a Sound message:

Parameter Description
Index The index number of the sound you wish to play from the Sound List
Volume 0.0 (off) to 1.0 (max)
Attentuation The degree to which the sound fades away with distance, (0, 1, 2, or 3)
Time offset The offset in seconds between the frame start and the sound start (should remain at 0)
Entity The entity from which the sound originates
Channel The sound channel which Q2 should use for this sound (0, 1, 2, 3, or 4)
Origin (X,Y,Z)  The coordinates from which the sound originates (optional)

Index should be self-explanatory.  If the sound appears in the Sound List, it will have an index number.  You can add as many individual sounds to the list as you like, up to the internal per-demo limit of 256 (0-255).

Note that 1.0 is the maximum sound volume.  Values above 1.0 will not work properly.

Attentuation can have the following values:

     0 = none;  the sound will play at full volume throughout the entire level
1 = normal;  the sound will fade somewhat as distance is increased from it's source
2 = idle;  the sound will fade even more quickly with distance
3 = static;  for extreme background sounds, which will fade very quickly as distance increases

Time offset will delay the playback of sounds, but has no useful value.  After all, if you want a sound to play later, then place it later... right?

You can choose to have the sound emit from a particular entity, such as a player or any other entity in your demo.   This is most effective when used with an Attentuation of 1.  If you want the sound to play throughout the level, leave entity and attentuation at 0.

There are eight sound channels available in Quake2, however only the first five (0-4) are actually used.  Most of the time, it is wise to use Channel 0, since this channel works as an auto-assign for the channel number.  However, here is a breakdown for the intended uses of all the sound channels:

     0 = auto;  selects a channel automatically
1 = weapon;  weapon use sounds
2 = voice;  pain calls
3 = item;  item get sounds
4 = body;  jump and fall sounds

Finally, you can assign a set of 3-dimensional coordinates as the sound origin, rather than an entity.   Note that these are not the same format of the camera coordinates displayed on the Demo Server window.  To determine the origin coordinates, you should divide the equivalent camera coordinates by 8.  For example, if you move your camera to where you want the sound origin to be, here is an example of the conversion:

Camera Coordinate Origin Coordinate (div. by 8)
X:  5568 X:  696
Y:  -7712 Y:  -1051
Z:  -1055 Z:  -131.875

Any of these parameters can be modified for any sound in the demo.  Simply search for the sound message you wish to edit, and do so in the Block Tree.  Or, you can locate most sounds on the filmstrip itself, by clicking on the Red down arrow to reveal the sound channels and a graphical display of sounds in the demo as they occur.   As long as the 3D preview window is NOT open, you can left-click on any sound in the filmstrip to play it, or right-click on any sound to zoom to it in the Block Tree for editing. 


 

Adding New Sounds

When adding custom sounds to your demo, it is important to remember that Quake2 only supports mono (one channel) sounds, not stereo (dual-channel) sounds.  If the sound you wish to add is in stereo, be sure to convert it to mono before adding it to your demo.

Once you have added your sound to the Sound List, the next step is to decide which block you want the sound to start playing in.  When you have chosen a block in which to insert the sound, there are two ways to place the sound in that block.  You can Insert - New Message and set all the parameters manually.  However, a much easier method is to locate your block on the filmstrip, and then simply drag-and-drop the sound from the Sound List to the block of your choice.  Keygrip2 will automatically create a sound message at that block with the correct index number, and the following defaults:  Volume 1.0, Attentuation 1, Time offset 0, Entity 0, and Channel 0.  You can then edit these parameters to suit your needs using the info we covered on the previous page.

Sometimes custom sounds that you add will not appear on the graphical display for the demo, this appears to be a bug in Keygrip2, but you can still locate the sound by looking at the appropriate message in the block tree.

Other Sound Messages

The following table briefly summarizes other possible sources of sound in a demo.  We will wait to go into detail on these parameters until the "Silent Movie" tutorial later on.  If you desire more information on these messages now, check Uwe's DemoSpecs page.

Message : Parameter  Description
packetentities : sound Used for certain looping sounds that emit from an entity (railgun hum, BFG hum, etc.)
packetentities : event Player footsteps, other universal player sounds
muzzleflash These events sometimes have sounds "embedded" into their occurrence (railgun shot, etc.)
muzzleflash2 (see muzzleflash)
tempentity : sounds This parameter is normally 0, but should be able to be modified to an appropriate sound index.  Some tempentities have sounds "embedded" into their occurrence as well.
configstring Occasionally (usually with some Quake2 mods), a sound will be added to the Sound List with a configstring message... however, it will not actually appear in the Sound List, even though it's index number will still be a valid reference.

That's the basics of adding and modifying sounds within a Quake2 demo.  Really rather easy, no?  Later tutorials will go into detail on these other sound sources, as well as give some tips for preparing your custom sounds using a sound editor for best results and download efficiency.