Creating, Importing and Implementing Sound Effects and Music
File Creation and Compression
Generally, the existing game uses two file types for sound effects. .ogg (also known as Ogg Vorbis), often at a 128 (or even lower) rate, and IMA ADPCM .wav (not Microsoft ADPCM) often at a very compressed resolution, as low as 4bit 8Khz.
The OGRE engine, unlike some engines (and all modern console engines), has no DSP effect features. This means that if you want an effect which only exists in dungeons to have thick, heavy reverb, you need to bake it into the file itself. Of course, in an open exterior location, this effect could seem odd or just bad.
My process for file creation, once the high resolution content is ready, typically goes:
- Check for interior pops and tonalities that could grate on repetition.
- Make sure levels are appropriate for context. This is especially important when making a set, in terms of relative volumes matching.
- Check for a zero value at the start and end of the file, while trying to preserve any kind of reverb/echo tail intended.
- Determine the file type wanted. Typically, if it is under 500 ms, wav, if over a second, ogg. It is NEVER ogg if it is repeated frequently or with a threat to "stack" onto itself in playback, and almost never wav for a very long sound.
- Determine the level of compression. Ogg is usually 128 or 96, depending on if it needs slightly better resolution, wav can range anywhere from 4 bit 8Khz to 8 bit 44Khz, depending on the context and presence of >4khz (high pitched) elements.
- Check for headers, markers and any other information attached to the file beyond audio information. This is important - intrafile markers and headers can CRASH THE GAME.
- Determine the naming convention. Generally, wordier and more specific is better in almost every case, as long as things stay under thirty or so characters. Creating attack1.wav and assuming that the subdirectory location serves as a proxy name is bad, in my opinion. Slimedemonattack1 is better.
File Directory Placement
Our audio directory structure is somewhat intuitive, if a little flawed - we have at least one superfluous layer (in Ambient) and a few different places where an in-game event could go. But if you want to explore our content or share your mod, it helps to have a sense of where things belong. Here's a quick guide to the world of Sounds/:
- Ambient/Background - This directory contains our very long ambient background sound loops, weather effects, and our "birdcall" sounds, distant sounds that randomly fire off to enhance the background ambience.
- Character - This directory contains monsters. It does NOT contain material in English, i.e., material potentially needing localization.
- English - This contains NPC monologues, player character chatter and player character exerts/grunts.
- Event - This contains scripted, animated events in the game.
- Impact - This directory (which contains one stray subdirectory with one small set of six files to my chagrin) is home to our impact sounds, the sounds that beef up content with thuds, splats, etc.
- Item - This is the messiest of these directories, and contains four categories (which are somewhat duplicative of other ones):
- Item/Loop - these are loops to be attached to in-game items such as fires or squeaky lanterns
- Item/Drop - these are the sounds usable player items make when dropped
- Item/Event - these probably SHOULD all be in the other Event directory. In any case, they are in-game events with an emphasis on breakables, traps, and the such
- Item/Special - this is the island of lost comedy files. Proceed with caution.
- Skill - Special skill sounds and the magic effects associated with them are here.
- Surface - Mostly footsteps, but also a few body falls and other surface-friction noises are here
- Swoosh - Mostly weapon swings and shots
- UI - The beeps and bloops associated with UI-related events, no words allowed (those are confined to English)
Making a Soundbank
With almost no exceptions, a sound doesn't exist in the world of "Torchlight II" unless it is assigned a soundbank. Soundbanks don't just contain anywhere from one to an infinite number of sounds in a set. They also contain a variety of settings related to the sound playback.
To open the soundbank editor, which allows you to make a new soundbank or edit a current one:
- go to data editors at the top menu
- select sound banks
Let's walk through the four panels in the sound banks editing window.
These categories generally, but not exactly, mirror the grouping of sounds in the sound/ directory structure.
Unlike that directory structure, where sounds can't always be played back in every media player due to compression styles, you should always be able to preview sounds in the banks, and familiarize yourself with the contents in that way.
The [+] and [-] buttons allow you to create and delete existing categories, but, unlike the other two panel sections we'll discuss, I really don't encourage messing with this too much. The existing categories should handle almost any new content, and animations may seriously dislike having entire categories of banks ripped out!
The [+] and [-] buttons are the only controls associated with this panel. When you are comfortable with the category you are in, hit the [+] button to make a new bank. An important note of caution here - the editor does not like empty banks, and will sometimes insist an empty bank exists, even after it has been [-] deleted, preventing you from saving your work. I strongly recommend filling the banks with the appropriate content as you go, and not creating a group of empty banks with a plan to fill them with files later.
This section in the upper right of the page is where you will see the files you have placed in the bank. Hit the [+] button, and find the directory where your sound is. If you don't see it, don't panic - there is a drop down in the bottom right corner which lets you select different file types. It only views one file type at a time, and defaults to wav. After you have added the file, play sound lets you preview the selected file, while play bank gives you a taste of the set when randomized. When making any set with variants, I strongly recommend hitting play bank many times repeatedly, it gives you a good sense of what works in the context of a set and material that might be an awkward fit with the rest of the set.
- category tells you what category the bank is in (which you should know already)
- frequency variation - a value from .01 to 1 which determines the range of random pitch variation for the bank. .5 means the range extends from half of the frequency to double the frequency. I never used it and safely ignore it, leaving it at default.
- loops true/false can be ignored unless you're working with a sound that is designed to loop, like a torch, waterfall, or longer ambient tone, in which case it should be set to True.
- name tells you the name of the bank, which you already knew
- playchance is the setting which determines whether the sound has a random chance of not playing. -1 is the default, which means the sound always plays. However, there are many moments in sound design where a somewhat random event which is not directly attached to an animation event will not be called every time. Playchance uses a value from 01 to 99 which represents a percentage likelihood that the sound will be called.
- radius is the Joker in the deck. If you forget to set a radius value, you will find your in-game sound does not seem to play at all. This value represents the distance a sound projects in the game by meters. When set as low as two or three, it can be only heard right next to the broadcasting unit, if set as high as 30 it can be heard well over a screen away. The default being left alone will result in silence. This is the one value you cannot forget to check and set. 15 is a good default for it.
- volume is a value from .01 to full volume at 1. It is very useful as a means of mixing. If you find a sound seems much too loud in the context of the game try setting it at .3 or .4.
- volume variation, much like frequency variation, is a value from .01 to 1 with .5 representing the possibility that the volume could range from being halved to doubled. Also, like frequency variation, I never used it. The default can safely be left as is.
Advanced Tips and Design Concepts
I would like to recommend a familiarization with the console command 'sounddebug'. Enable the console in Settings, and enter it as one word to turn it on, then again, to turn it off. The files can fly by at a totally unreadable rate in the case of combat, so there may be moments where you wish to turn it off and scroll upwards through the messages to review the sounds being played. If you wish to review player associated sounds without the files flying by too quickly, you may wish to avoid combat and dismiss your pet.
This tool is invaluable for reviewing your own work in context, as well as in analyzing the components that might comprise a component in a composite effect, for example, two sets of sounds which are both fired off when a skill occurs. Sounddebug lets you see the actual files involved.
Randomization is a very important principle in sound design, and is utilized in most of the action sound effects in the game. Sound effects should be thought of as 'families' in many cases, where all bear some resemblance to the other, but are also distinctive enough to offer variety. In most cases, the goal is to come reasonably close to the sound a repeated action might make in reality (only a little more exciting, of course). The editor offers many opportunities to use randomization in design. The most obvious and important one is by randomly choosing a file from a set, which can include as many files and variants as desired (though, as always, clogging memory with too many files can be problematic). Additionally, the pitch of the sound may be randomly adjusted within a user-defined range (a feature we rarely used) and the likelihood of the sound to be played can be assigned with a percentage value (which is frequently used).
The blacksmith as example
For an illustration of the above, go to the Estherian Enclave, turn on sounddebug, mute the music, set the sound to maximum volume and move your character as close as possible to the blacksmith in the northeast corner of the level without activating the interruption of his strike animation loop. Aside from the town ambience (hopefully it isn't raining), you will hear three sets of sounds being randomly called - a large set (around a dozen) of anvil strikes, a medium sized set of quiet whistling melodies, and a small set of 'cool' sounds for when the water meets the hot sword.
Some tips regarding sound and animation
Our tutorial on animation should cover aspects of attaching markers which trigger sound to animations. However, I wanted to emphasize a subtle point. When attaching these sounds, you will have the option of either directly calling a sound bank, or calling a category of sounds whose content is determined by the unit editor. Ultimately, this is a design decision, but it is an option you should be aware of.
One last point in terms of working with animation: modularity is a goal. Don't make a long single sound to attach to a long animation if there is a good chance that this animation could be interrupted for whatever reason. On a similar note, do not assume that an animation will always play back at this speed it does in the animation editor. Monsters can, in certain contexts, play their animations back more slowly and quickly went under the effects of skills, etc.
Creating music tracks
Music tracks can be placed in the game by having a file in .wav, .mp3 or .ogg format. In almost every case, mp3 or ogg are suggested because of memory considerations. Mono can also be used instead of stereo, but, generally, a stereo mp3/ogg track at a rate between 150 and 200 should be an optimal balance, and was used in every current track.
If stylistic consistency with the pre-existing music tracks in the game is a concern, a relatively slow fade-in and fade-out of at least 5 seconds is recommended. Mastering levels for the music are typically lower than contemporary limiting practices in rock and dance music, but much more compressed than the hyper-dynamic mastering often found in classical recordings. Typically, each track reaches peak normalization a few times, and "Town" cues are more dynamic and less limited than "Action" tracks.
Implementing in-game music tracks using new file names
Implementing your own tracks with new file names is done as follows:
- add the new track to the /media/music/ directory
- open the editor
- select 'Data editors' from the menu at the top
- select 'Level Rule Sets' from the list
- select a /media/layouts/* file from the box in the leftmost third of the screen
- select a music track from the list in the top right corner
- use the adjacent play and stop buttons to preview
- save the layout using the save function in the top left corner
Implementing music tracks using swap-in names
The hardest part of this method might be mastering your tracks into the ogg format!
If you can do that, the rest is easy. Simply give the track the same name as the target file, and it should play in the appropriate spot. To my knowledge, this the only way to change the content of tracks like the character select screen (which uses Title.ogg) and the options screens.
MU, L.A. Oct 12 '12