Adding ambient Sounds to your Map: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Line 55: Line 55:
Set up a speaker just as described above, with a few important property changes.
Set up a speaker just as described above, with a few important property changes.


First, change   
* First, change   
'''s_global      0'''
'''s_global      0'''


Second, place the speaker in the center of where you want your sound to be localized.   
* Second, place the speaker in the center of where you want your sound to be localized.   


Third, now you need to add a radius in which the sound will play.  Add the following two properties to the speaker:  '''s_maxdistance''' and   
* Third, now you need to add a radius in which the sound will play.  Add the following two properties to the speaker:  '''s_maxdistance''' and   
'''s_mindistance'''.
'''s_mindistance'''.



Revision as of 21:32, 3 May 2009

written by greebo

Ok, I will try to explain how to get a nice ambient sound into your map. Note that this ambient sound can be heard everywhere in your level. If you want to have certain areas playing certain ambients, this won't do the trick for you. For that there are two different options, a speaker approach which builds off this tutorial (described at the bottom of this tutorial, Adding_ambient_Sounds_to_your_Map#Localized_Ambient_Sounds_in_one_Area_.28with_Speakers.29), and a trigger or zone approach described at Ambient Sounds, a zone approach (which also gives some pros and cons of each method at the top).

Choose your Ambient Sound

All the Dark Mod ambient sounds are saved in the /sound/ambient/ambience folder. Fire up your preferred Media Player and pick one that's suitable for your map. We will use the sound darknessfalls.ogg for this tutorial.

The according sound shaders are stored in the /sound/tdm_ambient_ambience.sndshd file. Open it with the text editor of your choice and find the name of the sound shader. Our chosen sound is defined in this block:

darknessfalls
{
     description "Made by Darkness_Falls"
     sound/ambient/ambience/darknessfalls.ogg
}

The string outside of the curly braces is the name of the sound shader. We will need it for accessing it later via DarkRadiant.

Create a Speaker

Open up your map in DarkRadiant and right-click somewhere in the orthogonal view and choose "Create Entity...":

createentityss3.jpg

Select speaker. And voilà, the newly created green box is your speaker. You can drag it anywhere you want in your map, the actual place is irrelevant to the ambient.

createdspeakerib9.jpg

Set the correct Key/Values

The following key/values have to be set:

s_shader      <Name of the sound shader to be played>
s_looping     1
s_global      1
s_omni        1
s_volume      -5

In the Entity Inspector it should look like this:

entityinspectoreo1.jpg

A short explanation what these values do:

  • s_shader is the name of the sound shader being played. Nothing special here, just beware of typos.
  • s_looping should be set if you want to repeat your sound over and over. If this is set to 0, your sound will stop after one playback.
  • s_global this the key that makes the sound ambient, so it can be heard everywhere. There is no need for s_min or s_max as the sound plays with the same volume everywhere.
  • s_omni this makes the sound play from every direction, as it is supposed to do for an ambient.
  • s_volume negative values to be subtracted from the volume of your sound 0(max) to -60(silent.) Note that the right volume heavily depends on the loudness of the actual ogg file and the nature of the ambient being played. Typical values might be -2 or --6, -8 etc. whereas -20 is barely heard. Just experiment a bit with the value until you're satisfied...

Save the Map and test it

This is all there is to say, I believe. If you have problems with hearing your chosen ambient, be sure to check for typos in both the entity keys as well as in the sound shaders.

Localized Ambient Sounds in one Area (with Speakers)

added by demagogue

To localize an ambient sound in a particular area, one method is to place the speaker in the area where you want the sound. (As explained at the top of this tutorial, an alternative method is a trigger approach, described at Ambient Sounds, a zone approach. Also see the top of that tutorial for pros and cons between using speakers and using triggers. The following only discusses the speaker method)

Set up a speaker just as described above, with a few important property changes.

  • First, change

s_global 0

  • Second, place the speaker in the center of where you want your sound to be localized.
  • Third, now you need to add a radius in which the sound will play. Add the following two properties to the speaker: s_maxdistance and

s_mindistance.

Set s_maxdistance with a value to fill the area you want to hear it. This is the radius at which the volume tapers to zero. Set s_mindistance with a value only slightly smaller. This is the radius inside of which the volume is at its maximum (defined by s_volume). Between the max and min distance, the volume will increase from zero to s_volume with a nice fade in, or fade out if you go in the opposite direction.

To visually see the radius in Dark Radiant, there is an icon at the top of the Dark Radiant window that looks like a speaker with an X over it. Press it and you can see the maxdistance and mindistance radius. Adjust the placement of the speaker and max and min distances so that it fills the space you want covered by the ambient. Because of the "omni"/1 property, it still sounds like the ambient is coming from all directions (not the speaker), but there is still the nice fade in/fade out effect between the max and mindistances.

You should check for intrusion of the radius into other areas where they are not wanted, and you can control that to some extent with falloff at visportals and doors.

It is possible to have ambient speakers with overlapping radiuses (radii?). If the sound is the same, e.g., if the area requires more than one speaker to fill out, then the sound will be duplicated, but if you watch placement and radius, and pay attention to how the ambient sound works, it won't be too noticable. (Note: if you're having problems with either intrusion into other areas or don't like how the speaker-overlap is working to fill an area, consider using the alternative trigger method mentioned above.)

It is also possible to have ambient speakers with different sounds with slightly overlapping radiuses, and in fact that is often a good thing. As the old ambient fades out, the new one fades in, making for a nice transition.

And that's it. Once the speaker is placed, it turns itself on and off by itself when you are in the radius. Very simple. Save, dmap and run the map, then walk in and out of the area to test how the ambient works in-game.

See also