Skip to content

Creating a sound

Snowy edited this page May 11, 2021 · 14 revisions

This guide will tell you how to create a sound tag using invader-sound.

Contents:

Setting up your sound tag data folder

Navigate to your data directory and create a directory where your sound tag will be relative to your tags directory. So, if you want your sound tag to be at characters/dog/sounds/whine.sound, you would create a directory called whine in data/characters/dog/sounds.

If you do not intend on using pitch ranges, simply place your WAVs or FLACs in the main directory.

If you do intend on using pitch ranges, create a directory for each pitch range. Place your WAVs or FLACs in the directories. Do not put WAVs or FLACs in the main directory in this case. See Setting up pitch ranges for information on how to set up pitch ranges after you've created your sound tag.

Note: Using FLACs instead of WAVs is recommended to keep the size of your data directory down.

Creating the sound tag

When creating a new sound tag, you can either create it using a tag editor such as invader-edit-qt or with invader-sound. Each time you create a sound tag, you will need to supply a format and, if applicable, you will want to supply a compression level, too. However, you will only need to supply a sound class if the sound tag doesn't exist.

Sound class

If the sound tag does not exist, you will need to choose the sound class. The sound class affects how the sound is played in the engine as well as whether or not to generate mouth data.

Sound class Notes
ambient_computers
ambient_machinery
ambient_nature
device_computers
device_door
device_force_field
device_machinery
device_nature
first_person_damage
game_event
music Only one music sound can play at a time
object_impacts
particle_impacts
projectile_impact
projectile_detonation
scripted_dialog_force_unspatialized Generates mouth data
scripted_dialog_other Generates mouth data
scripted_dialog_player Generates mouth data
scripted_effect
slow_particle_impacts
unit_dialog Generates mouth data
unit_footsteps
vehicle_collision
vehicle_engine
weapon_charge
weapon_empty
weapon_fire
weapon_idle
weapon_overheat
weapon_ready
weapon_reload

You only need to input a class if you are creating a new sound tag or you want to change the class of an existing sound tag. If you are creating the sound with invader-sound, you can provide a class with the -c argument (e.g. `-c projectile_impact).

Split permutations

If you are creating a sound tag that's longer than a second, you may want to split the permutations. You only have to specify this once in invader-sound (-s) or you can set it in the tag editor. You cannot, however, split dialogue.

Playback issues may occur if you do not split the permutations. Common issues include the sound ending or restarting abruptly.

Audio formats

These are the different audio formats that invader-sound supports, assuming a 16-bit, 44.1 kHz stereo input.

Format Bitrate (44100 Hz stereo) Type
16-bit PCM 1411.2 kbps Lossless
Ogg Vorbis (-l 1) ~500 kbps (on average) Lossy; Max quality
Ogg Vorbis (-l 0.5) ~160 kbps (on average) Lossy; Transparent quality
Ogg Vorbis (-l 0.3) ~112 kbps (on average) Lossy; Oggenc default
Xbox ADPCM ~390.8 kbps Lossy

Ogg Vorbis provides a good tradeoff in terms of bitrate and quality. Using 0.5 is considered "transparent" (unnoticeable quality loss) provided you use a lossless audio input (if not, then you may need to use a higher quality value), and this also gives you lower bitrate and better quality than Xbox ADPCM. However, Halo PC does not cache it very well, and it is slow to decode. Xbox ADPCM, on the other hand, does not compress as efficiently as Ogg Vorbis, but it decodes faster, and on Xbox, it's more-or-less loaded directly.

Using 16-bit PCM requires little to no processing, making it the fastest format to decode since it more-or-less gets loaded directly, but it does have a very high bitrate. This can make sounds become massive really quickly. You will need a mod (e.g. Chimera) to enable support, as while it is supported by the Halo engine, it is disabled.

Which audio format should I use?

This is simple:

  • If you are creating a sound for the Xbox version of the game, use Xbox ADPCM (-F xbox_adpcm).
  • If you are creating a sound for the PC version of the game:
    • Use 16-bit PCM if you are okay with a mod requirement and high bitrate (-F 16-bit_pcm)
    • Use Ogg Vorbis if you are creating a lengthy sound that isn't played very often such as music and dialogue (-F ogg_vorbis)
    • Use Xbox ADPCM if you are creating a sound that is played frequently and you want to support unmodified Halo PC (-F xbox_adpcm)

Resampling and remixing

Halo PC only supports 22.05 kHz and 44.1 kHz. If your sound tag is not one of these, invader-sound will resample your sound. If your sound is less than 22.05 kHz, it will be resampled to 22.05 kHz. if your sound is greater than 22.05 kHz (but not equal to 44.1 kHz), it will be resampled to 44.1 kHz. This is done automatically, but there are some cases where you may want to control it.

Halo PC and Xbox also have a couple caveats:

  • If playing stereo, 3D sound does not work, and sound will play the same volume regardless of distance
  • 44.1 kHz mono does not work

So, if you intend to support the original Halo PC and Xbox games, then if your input is 44.1 kHz mono, you may want to have Invader mix it to stereo (-C stereo). If, however, you need the sound to be mono, you can force the sample rate to 22.05 kHz (-r 22050). Or, if your input sound is in stereo and you intend to use it as something that may benefit from 3D audio effects such as an explosion sound, you can have Invader mix it to 22.05 kHz mono (-r 22050 -C mono).

Generating the sound tag

Now that you've decided on what format, class, and sampling settings, you can create the sound tag. For example, if your sound tag is characters/dog/sounds/whine and you want it to be Ogg Vorbis with 0.6 compression, you can use this command to generate the sound tag:

invader-sound characters/dog/sounds/whine -F ogg_vorbis -l 0.6 -c unit_dialog

Previewing the sound tag

You should preview your sound to make sure everything looks correct.

In invader-edit-qt, you can navigate to your sound. Alternatively, you can quickly open your sound tag in invader-edit-qt from the command line like this:

invader-edit-qt characters/dog/sounds/whine.sound

Once you've opened your sound tag, click "Preview sound" at the top of the window and you will be able to play back your sounds.

Setting up pitch ranges

Pitch ranges are used for sound effects that play at variable pitches. For example, a vehicle engine may increase in pitch as the vehicle gets faster. When a sound becomes too high in pitch, it may sound distorted, so you may want to play a different sound, instead.

Once you have made a sound tag, you can edit pitch ranges. You can edit your pitch ranges by opening your tag in a tag editor such as invader-edit-qt.

You will find there are three values in pitch ranges:

  • Natural pitch ("bend" in which this sound plays normally)
  • Bend bounds (minimum and maximum "bend" to play this sound)
  • Actual permutation count (you can't edit this; it's the number of "real" permutations versus split permutations)

So, if you set the bend bounds to 2 - 3 and set the natural pitch to 2.5, then the pitch range will be used when the sound gets a bend of 2 to 3. At 2, it will play at 80% speed, then at 2.5, it will play at 100% speed, and lastly, at 3, it will play at 120% speed.