-
Notifications
You must be signed in to change notification settings - Fork 10
Creating a sound
This guide will tell you how to create a sound tag using invader-sound.
Contents:
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 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.
Note: Pitch ranges are used for sounds that may be played at different pitches depending on a state. This is good for things like engine or charging sound effects, which may dynamically increase or decrease in pitch depending on the status of the vehicle or weapon, respectively.
Note: Using FLACs instead of WAVs is recommended to keep the size of your data directory down.
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.
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).
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.
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 |
FLAC (-l 0.8 ) |
~875 kbps (on average) | Lossless; FLAC 8 (best) |
FLAC (-l 0.5 ) |
~900 kbps (on average) | Lossless; FLAC 5 (faster) |
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.
Xbox ADPCM does not compress as efficiently as Ogg Vorbis, but it decodes faster. In fact, on Xbox, it's more-or-less loaded directly. Even so, we don't recommend you use this for anything in newer assets unless you intend to support the Xbox version of the game.
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. FLAC, on the other hand, is compressed and supports up to 32-bit integer PCM samples. This makes it more flexible and better in bitrate. However, the actual compression ratio you get will vary sound-to-sound.
While 16-bit PCM works in the Halo engine, it requires a mod to do so. FLAC does not work on the Halo engine, and invader-build will not allow you to make maps for the original Halo engine that use it.
This is simple:
- If you intend to support unmodified Halo PC, use Ogg Vorbis (
-F ogg-vorbis
). - If you intend to support Halo PC and are okay with a mod requirement and high bitrate, use 16-bit PCM (
-F 16-bit-pcm
). - If you intend to support the Xbox version of Halo, use Xbox ADPCM (
-F xbox-adpcm
).
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
).
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
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.