Part 2

Written by Mark Haidekker

Editor's Note - This article series by the author of Jungles of Caldoun, will show level makers how to make their own terrific levels - part-by-part. Last month, Mark looked at creating waxes - this month he tackles VOCs....

VOC tutorial

What always astonishes me in LucasArts games are the extremely life-like ambient sounds. This was true in Dark Forces (think especially of the Gromas Mines) and it is again true in Jedi Knight. My opinion is that sound is among the most important single components that make a level interesting. One of the best examples (again, this is my personal opinion) of well-used sound is INTRUDER by David Lovejoy. You enter a facility and you are immediately surrounded by the eerie humming and whining of alien machinery. The whole atmosphere is scary, and you are permanently reminded that something sinister is happening.

In this tutorial, I want to provide hints how to use and how to create sound backgrounds. Since this scheme is also used in Jedi Knight, you'll probably be able to apply the ideas given in this article to JK levels as well.

Once again, I want to start with a few explanations. The sound files I will be talking about consist of 8-bit signed data samples ("raw data") with the value 0x80 (128) as zero value. To create common sound file formats, a header must be added. Windows uses the WAV format, in DF, the Creative Voice VOC format is used. VOC is more flexible, it includes some commands like "repeat" or "silence", which are important. If you want to experiment with sound files, I recommend that you get some shareware sound editor, for example from the SimTel shareware collection. This sound editor should be at least capable of interconverting WAV, VOC, and raw data, and should provide basic editing functions like Cut, Copy, and Paste. More advanced editors allow to insert those VOC commands, which is quite useful. If you don't have this feature, you'll need a hex editor which allows to insert hexadecimal bytes. Of course, you'll need a sound card, loudspeakers, and a good microphone, possibly with a built-in preamplifier.

A wealth of sounds already comes with Dark Forces itself. If you UNGOB the file SOUNDS.GOB (whew, who guessed that?), you'll find all the sounds played within the levels, including background sounds, machinery sounds, weapons, and people talking. Less known is the file JEDISFX.LFD in the \dark\lfd directory which can be unassembled with the BMPDF utility. I suggest that you go ahead right now and - in a separate directory - take apart both SOUNDS.GOB and JEDISFX.LFD.

If you are still not satisfied, get the files ALSBGVOC.ZIP and ALSKJVOC.ZIP from Allen Newman. Allen did a terrific job of recording and filtering sounds out of the original Star Wars videos and other LA games. You get it from ALSBGVOC supplies many background noises, while ALSKJVOC contains talk between Jan and Kyle, either via comlink or natural, unfiltered. I used many of these sounds myself both in the Hunt for the Arc Hammer and in Jungles of Caldoun.

So, how can you use the sounds within a level? There are three possibilities, which I'll cover in detail: A sound object (background spot sounds), machinery sounds associated to an elevator or switch via the INF file, and paged sounds which are triggered by an event and are audible anywhere within the level. Of course, all opponents use sounds as well. The best way to access these is to have a look at the Resources Cross Reference that comes with the WDFUSE help system. There, you can look up all sounds associated with one enemy logic and you know which files to provide or replace. An enemy logic generally plays a specific sound file when spotting Kyle, when shooting, when being hit, and when dying. So, if you think of creating a new enemy, remember to provide suitable sounds as well.

Background sounds:

Probably most easy to use. Just insert an object with CLASS: SOUND and assign the file name (e.g. WIND.VOC) to it. If you walk close to this invisible object, you'll hear the sound. Several sound objects placed close together will continuously change from one sound to the other as the player walks past those objects - I used this frequently in the Caldoun level.

Machinery sounds:

Elevators and switches will play a sound when activated. Letīs take a look at the following INF code from the Hunt for the Arc Hammer, a switch in wall #1 of a sector called small_supply:

item: line   name: small_supply   num: 1
    class: trigger switch1
    event_mask: 16
    client: adoor1

You press the switch, and you hear a sound. Why? The swtiches and elevators have default sounds. The switch in this example plays SWITCH3.VOC from SOUNDS.GOB. Suppose you want to change the sound. Just insert the SOUND: statement:

item: line   name: small_supply   num: 1
    class: trigger switch1
    event_mask: 16
    sound: switch1.voc
    client: adoor1

The specified VOC file may be any file which is either located in SOUNDS.GOB or in your custom GOB. In that case, donīt forget to add the sound file to your WDFUSE project directory.

With elevators, the sound scheme is more complex. An elevator plays three different sound files- one when its movement starts, one while the elevator is running, and the third when the elevator stops. Another example from the Hunt for the Arc Hammer (it is slightly modified to suit the needs of the example):

item: sector name: hang_pwrgen
   class: elevator move_floor
    master: off
    sound: 1 auxpwr_1.voc
    sound: 2 auxpwr_2.voc
    sound: 3 auxpwr_3.voc
    speed: 0
  stop: @0 0
  stop: @1 0

Instead of the standard sounds, this elevator (the auxiliary power unit in the hangar area, as you certainly guessed...) plays the file AUXPWR_1.VOC, which is the starting of the generator. Immediately after AUXPWR_1 finished, it continues with AUXPWR_2, repeating it endlessly. As soon as this sector gets the MASTER_OFF message, it plays AUXPWR_3.VOC and then returns to silence. BTW, if you want to experiment with my examples, be sure to get the level from The AUXPWR sounds are neither SOUNDS.GOB nor JEDISFX.LFD sounds. I recorded them myself, but Iīll come to that later.

If you want an elevator to be silent, just add the lines -

 sound: 1 0
 sound: 2 0
 sound: 3 0

Paged sounds:

Paged sounds can be heard anywhere within the level. A PAGE statement may be issued from an elevator or trigger. The following example is the INITIALIZE sector from Jungles of Caldoun, which plays the initial sequence of the Crow crashing into the foliage and Kyles trying to raise Jan. Please note that I added comments which do not belong into the INF file:

item: sector name: initialize  seq
  class:elevator move_floor
   event_mask: 0
   sound: 1 0
      The elevator mustnīt
   sound: 2 0      play any sounds
   sound: 3 0      of its own
   speed: 0
  stop: @0 0.2
  stop: @1 5
   message: 1 start_point wakeup         
Start the VUE immediately
   page: 1 landing1.voc         and play LANDING.VOC
  stop: @2 0.2
   message: 2 start_point next_stop         
Start the earthquake
   page: 2 ex-med1.voc         play EX-MED1
  stop: @3 0.3
   page: 3 ex-small.voc         
after 0.2 secs, play EX-MED2
  stop: @4 4
   page: 4 ex-med1.voc         
after 0.3 secs, play EX-MED1
  stop: @5 3
   page: 5 m02kyl01.voc         
4 secs, then:"Jan...?"
  stop: @6 2
   page: 6 m02kyl01.voc         
3 secs, then again "Jan...?"
  stop: @7 1
   page: 7 m08kyl05.voc         
Lost temper: "Aaah, Sh****".
  stop: @8 terminate

You can run away from the initial sector, but youīll still hear the sounds at full volume. Thatīs how PAGE works. In the following section, I want to give some hints of how to create your own sounds. Generally, there are three ways:

1. Take existing sound files and cut/paste them together.

I did so in the final sequence in Jungles of Caldoun, where - for example - Kyle says "we need more ships and more firepower". This is based on the files M05KYL03.VOC, and Allenīs ALSKYL23. M05KYL03 says "If that thing down there is any indication of what weīre dealing with, weīre gonna need more firepower". I just cut out the section "weīre gonna need more firepower". Then I extracted "ships" from ALSKYL23 ("Ok, Jan. Ship secured") with that convenient S following "ship". Where I got that "and" from I donīt remember. But by now you know how it works. The result was stored in the file CALDKYL3.VOC.

2. Synthesize the sound.

To do this, youīll have to have basic programming knowledge and you should have an idea how the sound looks like. Look at the file HISS.VOC from the Hunt for the Arc Hammer - youīll realize a very clean exponential decay which could well be the result of a natural process - except that it is too clean (yes, thatīs what I mean. Go ahead and load this file into your sound editor).

HISS.VOC was generated by a couple of lines of PASCAL code (which I slightly simplified for easier understanding):

Procedure Hiss (Duration: Real);
VAR R: Real;
   Sign: Shortint;
   I: Longint;
   P1, P2, P3: Longint;
  P1:=Round(11000*Duration);     {No of samples}
  P2 := P1 DIV 2;    {Decay constant}
  P3:=P1 DIV 30;    {Attack constant}
  FOR I:=1 TO P1 DO
   R := Random ($F8);
   IF R>=$80 THEN BEGIN Sign:=1; R:=R-$80; END ELSE Sign:=-1;
   R:=R*Exp (-I/P2); IF I    PB := $80+Sign*Round(R);
   Write (f,pb);

Please donīt discuss performance aspects of the code. This procedure just had to work and I wanted to get it ready FAST. So I just wrote it quick and dirty. P1 contains the number of samples as given by the sample rate of 11000 Hz and the duration. 3 % of the total duration is the attack time. The sound doesnīt start abruptly but needs a few miliseconds to come to itīs full amplitude. This time is determined by P3.

For each sample, I get a random number (random numbers generate white noise, a hissing sound). Then, it is either modulated linearly (attack period if i is less than P3), or it decays exponentially with the decay constant of P2. After that, the sign is restored, the floating-point value converted into a byte which is written to the file F. In this example, I removed a recursive filter which softens the high-frequency components during the decay period, so that the example does not get too complicated.

Then, in the next step, you load this raw file into your sound editor and convert it into VOC format. Done.

This method allows you to create any sound which is described analytically. Sine-wave sounds, white or colored noise, etc. For those who are interested in this method, Iīll include another example, this time the soft humming sound of the force field in Jungles of Caldoun. Youīll recognize the scheme. Itīs a sine wave of 100 Hz overlaid by a low-amplitude sine wave of 240 Hz.

Procedure Humm;
CONST Amplitude = $40;
VAR A,R: Real;
   J: Integer; I: Longint;
  A:=1; J:=0;
  FOR I:=1 TO 11000 DO
   R := Amplitude*sin (100.0*3.1415926*i/11000)
    + Amplitude/8.0*sin (240.0*3.1415926*i/11000);
   PB := $80 + Round(R);
   Write (f,pb);

If you have a certain sound in mind and you donīt think you can describe it with a simple formula, youīll have to record it yourself. I canīt give you general hints - the only limit is your own creativity. Always remember that you can convert a recorded sound into RAW format, read it with the help of a small program, modify it (e.g. filtering, fourier transformation) and write it back as raw sound, ready for your sound editor.

I will provide a few examples, though, just to get your imagination going and to show what is possible.

The AUXPWR sounds are recorded from an ancient 8-inch, 10 MB Shugart hard disk drive. The heavy discs show this characteristical slow acceleration phase which I found very suitable for this supposedly heavy machinery.

Another hard disk was used to create the sounds WHINE.VOC and PROPAG.VOC in Jungles of Caldoun. This time, it was a 40 MB Fujitsu 3.5" drive which recalibrates the heads immediately after startup. Whine.VOC is the acceleration phase played backwards (and with a part from LANDING2.VOC appended). PROPAG.VOC is the head calibration phase following the disc startup, played at half speed. This is what you hear after you activate the propagator (uppermost level of the installation) and at the antenna site, where it is a paged sound.

The third example is the Caldoun Wasp. It is no real wasp but an electrical toothbrush, converted to a higher pitch.

As I said, there are no real limits for the combination of recording/synthesizing sound, modifying it, and cutting parts together. I hope that the level creators among you will make heavy use of sound effects in both DF levels and the JK levels to come. Nothing can beat the atmosphere created by well-used ambient sounds.