QuakeMap Documentation
Ambient sounds


How to record sounds, and then use them in Quake as ambient sounds ?


Creating the sound file

You must first be sure you recorded them in the right format : 11 KHz, 8 bits, mono. The delicate point here is that the sound must be looped, i.e. you must set up the sound file's attributes so that the sound is played continuously in a loop. If you fail to do so, Quake will display an error : sound not looped, and the sound will not be played. Don't ask me why they didn't just tell Quake to loop any sound started with the AmbientSound command ! Anyway, you need something to get your sound looped. id Software's ambient sounds' properties say they made the sounds with Cool Edit v.95 by Syntrillium Software Corporation. As I know neither this editor nor another one that could let me specify my sound would be looped, I used a hexadecimal editor to hack the sound file.

I finally discovered that just adding a few bytes to a .wav file will do it. I put these bytes in a file, loophack.bin, so if you have no sound editor capable of doing it for you, you can download the file and use a DOS command like this one :

  copy /b oldsound.wav+loophack.bin newsound.wav

Importing the sound into QuakeMap

Now for the QuakeMap part. First, import the sound : in the QuakeMap Explorer window, choose New, Imported file. Click on the Import button and select your .wav file. You imported it into QuakeMap; now, you must tell QuakeMap where to put it when you want to play with it. Enter the file path in the box labeled "File name within Quake search path" : I suggest a name like

  sound/ambience/yourname/filename.wav

Then, you must create a new entity classname. To do this, make a new QuakeC patch (New, QuakeC) and enter this code :

  void() ambient_yourname_filename =
  {
      precache_sound ("ambience/yourname/filename.wav");
      ambientsound (self.origin, "ambience/yourname/filename.wav", 1, ATTN_STATIC);
  };

Don't forget to change yourname and filename to the correct name, all three times.

The last step is to register this new type of entity for QuakeMap. Choose New, New Entities, click on Open QuakeMap Editor, and insert here any already existing ambient sound (Edit, New item). Then, click on 'New entity' wizard and enter in field classname your entity's classname, i.e.

  ambient_yourname_filename

You can choose OK and close the map editor. Choose Quake, Extract files and compile .qc. If you don't know what this operation does, read this introduction to the QuakeMap Explorer.

You can now create a new map and add your new ambient sound entity to it. The new entity appears at the bottom of the New items window.

A sample file where the above operations have been done is available : Ambience.zip.


More about it


Back to the main page
Date: 21.01.97, by Armin Rigo