An ambient sound is a looping background sequence, such as wind or birdsong, that maps play with PlayAmbientSounds. Each one is an MSEQ file in audio/mseq/, and its AMBIENT_ constant is named after the file, so spooky.xml becomes AMBIENT_SPOOKY.
Editing an ambient sequence
To change how one of the game's ambient sounds plays, edit its MSEQ file. AMBIENT_SPOOKY plays audio/mseq/spooky.xml.
An MSEQ file has a header and a list of commands:
<Mseq code="501" firstVoice="13">
<TrackRamps/>
<Commands>
<SetInstrument track="1" wav="crow"/>
<SetVolume track="1" volume="7F"/>
<PlaySound track="1" pitch="176" volume="6D"/>
<Delay duration="10"/>
<StopSound track="1" pitch="176"/>
</Commands>
</Mseq>SetInstrumentpicks a sample by name for a track. The sample must be in an always-loaded bank, unless the sequence is one of the radio's stations.PlaySoundandStopSoundstart and stop a note.Delaywaits fordurationticks.StartLoopandEndLooprepeat the commands between them. AnEndLoopwithcount="0"repeats forever, and the loop must contain aDelay.SetVolume,SetPan, andSetReverbset values for a track.volumeis in hexadecimal.
The game's files in audio/mseq/ show every command. Copy the one closest to what you want.
Adding a new ambient sound
In the Filesystem, copy one of the game's MSEQ files in
audio/mseq, paste it into the same folder, and rename the copy after your sound, such asrain.xml.Edit the copy. Set its
codeto a label of one to four characters, such asRN1.Play the sound from a map's EVT script:
Call(PlayAmbientSounds, AMBIENT_RAIN)
The radio
audio/mseq/radio_0.xml to radio_3.xml aren't ambient sounds of their own. They're the four stations of AMBIENT_RADIO. All four must play samples from the same bank, through their SetInstrument commands.
While the radio plays, the game loads its stations' bank, as it does for a song's banks, so the stations don't need an always-loaded bank. The game's stations play samples from SPC3. A bank that the radio loads isn't always loaded, so other ambient sounds and sound effects can't play its samples.