Skip to content

Ambient sounds

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>
  • SetInstrument picks 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.
  • PlaySound and StopSound start and stop a note. Delay waits for duration ticks.
  • StartLoop and EndLoop repeat the commands between them. An EndLoop with count="0" repeats forever, and the loop must contain a Delay.
  • SetVolume, SetPan, and SetReverb set values for a track. volume is 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

  1. 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 as rain.xml.

  2. Edit the copy. Set its code to a label of one to four characters, such as RN1.

  3. 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.