Ambient sounds are pretty much any sound that isn't played directly from a weapon. They can be played either from a specific point on the landscape, or they can be played from the different objects in a landscape placement group. Sounds can either be played after a set range of time or they can be looped continuously.
Ambient sound files are typically referenced from within a texture file by adding the following:
<ambientsounds> <ambientsound>data/landscapes/ambientsound*.xml</ambientsound> <ambientsound>data/landscapes/ambientsound*.xml</ambientsound> </ambientsounds>
However, as of v41, ambient sounds can also be constructed within a landscape include file as well.
The ambient sound files should typically be located under your game installation's (or mod's) /data/landscapes folder, although you can put them anywhere you wish. They are usually named ambientsoundmyfilename.xml, where myfilename is the name of the ambient sound or group of sounds, but again, its at your discretion whether or not to follow convention.
The basic layout of each ambient sound file will look like this:
<sound> <position type="..."> An ambient sound position type ... </position> <timing type="..."> An ambient sound timing type ... </timing> <sound type="file"> The sound file and its properties ... </sound> </sound> <sound> ... </sound>
Each sound will have it's own <sound></sound> tags and all the necessary info for each sound such as its position and timing are contained within those tags. More detail on what each sound will contain can be found in the following section.
Each <sound> tag can contains a position type. The position type determines where the sound is played from in the world. The current types of positiong available are: group, absolute, set, water and ambient. Descriptions are in yellow.
This group type can play sounds from all objects in a placement group contained in a placements file.
<position type='group'> <name>groupname</name> Name of the placement group containing the objects that the sound should come from <falloff>#</falloff> Controls the rate at which the volume decreases as you get further from the sound higher value = sound travels less far lower value = sound travels farther </position>
This position type plays the sounds from a specific point on the landscape.
<position type='absolute'> <position> Coordinates to play the sound from <A>#</A> North/South value, 0 = south edge <B>#</B> East/West value, 0 = west edge <C>#</C> Altitude, 0 = seafloor level </position> </position>
I think its similar to group but sets sounds to keep playing from a specific member of that group? Not sure
<position type='set'> <maxsounds>3</maxsounds> Maximum number of simulataneous sounds <name>boids-f16</name> Name of the group to bind this sound definition to </position>
Plays sounds from the water near the camera?
<position type='water'> <falloff>#</falloff> Controls the rate at which the volume decreases as you get further from the sound </position>
I believe it plays the sound from a set position relative to the camera at all times. So instead of fading in and out as the player moves around, it will sound the same from any position.
In addition to a position type, each <sound> tag has a timing type as well. The timing type determines when and how often these sounds will be played. The types available currently are repeat and looped.
<timing type='repeat'> Sound will be repeated after a specified amount of time passes each time. <min>60</min> Minimum amount of time before the sound is played each time <max>120</max> Maximum amount of time before the sound is played each time </timing>
<timing type='looped'></timing> Sound is played over and over in a continuous loop.
The sound tag specifies which sound to play and it's settings.
Once you've setup where the sound plays from and how often it plays, its time to set what sound(s) to play. Currently WAV and OGG files are supported.
<sound type='file'> <file>data/wav/misc/citysounds.wav</file> The location and name of the sound file to play The sound can be a WAV or OGG file <gain>1.0</gain> (optional) Amount to increase/decrease the sound by (2.0 = 200%) <rolloff>#</rolloff> (optional) Affects distance the sound travels (default = 1.0) Higher value means the sound won't travel as far Setting to 0 means the sound never gets quieter <referencedistance>#</referencedistance> (optional) Used to calibrate the sound rolloff (default = 75.0) Distance at which the sound's volume will drop by half </sound>
Ambient sound definitions are not terribly complex, but when used properly they can add a nice bit of realism to any landscape setup. They are especially powerful when used in conjunction with many of the other landscape files.