User Tools

Site Tools


Sidebar

hpl3:engine:sound

Sound

FMOD

HPL3 uses FMOD to handle all sound playback. See fmod.org for more details, documentation and help. When working with sounds it is mainly the FMOD Designer tool that will be of interest, the easiest way to learn how it works is to check the tutorials in FMOD's YouTube channel.

General

It is important to plan and think through how to split up your sounds into different projects. The game will load sounds based on this, it will help you find your sounds, it will ease preloading if you need to use that and so on.

Project

Create a project for large chunks of sound types, for example a project for each character, level or for physics. Each project can contain many groups of sound events, preferably a hierarchy of 1-2 sub-groups will make it organized and easy to work with when for example optimizing(see script functions for preloading a project or a specific group!). More details about this is found under FMOD Designer Events. Some type of sounds need to follow a special structure and naming convention! See the sections below, for example physics and footsteps.

Banks

A bank stores all the sounds for a project, you can have many banks but you should normally only need two. One bank for sounds that you load into memory to play and one bank that streams sounds from the harddrive and plays them. Special cases where you need to have more banks would be if you have sounds that are localized to different languages, where you have one bank for each language.

Sounds to be streamed are usually longer sounds, such as a looping ambient track or voices. Be cautious with using streamed sounds, streams depend on the speed of the harddrive, so what works well for you might not be so for another user. Try to keep the number of simultaneous streams to something low, perhaps max 6 streams. Remember that music and dialog streams, so could easily be 3 streams if you have a cross-fade of music going when a voice is played.

FMOD Designer Sound Defs

A sound def is the settings for a sound (or set of sounds for variation) that you can use in your Multi-track events. There is nothing specific to keep in mind for these, do as suitable and follow the FMOD documentation.

FMOD Designer Events

The Events are what you actually use when playing sounds in the game. The events are what replaces our old system of playing a SNT file, which essentially worked in the same way as Simple Events. When working with events that are a few things to keep in mind, mainly to organize events into easy to navigate groups and to use categories to send the events to be processed (or not processed) by the proper global effects.

Simple Event

Nothing in particular to keep in mind beyond the basic usage as specified by the FMOD documentation. Just check our general important notes for events and performance concerns for info on why you should use simple events and any minor specific setting you might need to set. You right-click in the playlist to add sounds to an event, that is not very clear…

Multi-track Event

These events allow for parameters to affect the sound in a detailed manner, for example changing the sound of an impact depending on the speed of the object or much more advanced mixes. Make sure to view Performance concerns for Events to not overdo it. These events replace what previously was set with a lot of parameters in the snt editor, model editor and level editor for sounds. The move to FMOD makes it possible for a sound designer to do much more without any engine specific knowledge or assistance from a programer/scripter.

Important notes for Events
  • Make sure that all events that should be looped are set to “Oneshot” false. If not, there might be all sort of strangeness in the sound playback.
  • Use unique names for all projects, as the .fev file it creates with the same name, must be unique for it to work correctly.
  • For looping (non “Oneshot”) sounds that are to be in the environment, like fire from a torch, always use “just fail if quietest” max playback behavior. This will make sure that if there are many sounds of the same type around the player, it will be the loudest once that are heard. Other options are possible, but using any of the “steal” ones are almost always a bad choice.
Performance concerns for Events
  • Use simple events as much as possible, they are faster than multi-track events.
  • Keep Max Playbacks to as few as possible, often the default 1 should suffice.
  • Do not add lots of effects to all events, it takes CPU. In particular never use reverb or similar, those should only be global and amount used by setting the dry/wet mix values (or use envelopes for dry/wet).
Groups

Groups are almost only for organizing your project. However it is useful to think it through how to group and sub-group your events, as you can use a script function to preload group(s). Preloading is useful if you for example notice that you want to play many sounds at the same time and the game stutters from this. By preloading the sounds the engine have the sounds ready in memory for usage.

Categories

All sounds must be in one of two categories. The categories you have to create.

  • World - All sounds that should be affected by global effects, such as a reverb. For example if the player goes below surface then all the sounds around him should change.
  • Gui - All sounds that should not be affected by global effects. Simply no matter where the player is or what he does, these sounds are always the same. For example button clicking sounds for the menu.

Physics sound

The physics system now lets the sound system handle any mixing/effects for the sounds played. This is done by sending one or more parameters to the played sound. These are as follows:

Scrape
The event must have ONE param, name does not matter. The physics sends the linear speed to this param. Normal values 0 - 10. Is looping.

Roll
The event must have ONE param, name does not matter. The physics sends the angular speed (based on axes chosen in material) to this param. Normal values 0 - 10.Is looping.

Impact
The event must have two params named “mass” and “speed”. “Speed” is sent the speed of impact (normal values 0 - 20). “Mass” is sent mass of the colliding object (normal values 0 - 200, but rarely over ~30) Note that mass is 0 for any static object no matter their size.

Joint
Move and Impact must have ONE param, where the speed is sent. Normal values are 0 - 5.

SNT (old sound system)

The old system of .snt files (see HPL2) is still in there and can be used, it is not further developed and support might be dropped at anytime.

Supported audio file formats

You can use wav, mp3 or ogg audio files. OGG is what we used for Penumbra and Amnesia and should be considered the best choice due to its small size and is license free to use (unlike mp3).

SntEditor.exe

Use this tool to create and edit .snt files. After you have run the tool the first time and selected Options → Register Application, you will get an option in the right-click menu if you click on a sound file in Windows Explorer. You can select one or many sounds when using the “Create Sound Entity file”-option and the editor will create several .snt files for each sound. If sounds are named the same, but with different numbers appended to the name, the editor will create a single .snt file for the group of sounds and the sounds will be added to the pool of sounds it randomly plays. While the editor has input for Start and Stop sound these are actually not supported or working in HPL3.

Editor Settings
General
Main Sound List the sound(s) that is played each time the .snt file is called by the game.
Properties
Loop If the .snt should loop.
Use 3D When active a sound has a position in the world and moves around as the player moves around. If not set the sound is played at a static position, for example user interface sounds.
Stream If stream, a sound will be streamed and played instantly. If not streaming, then it will first be loaded to memory and then played. Long sounds should use stream and short sounds should not. Do not use too many Streams, as they will crack and drop out if there are too many (at most 6 channels, that is 6 mono sounds).
Blockable If an object is set to be blockable, the volume a sound located behind it will be lower when Blockable is active.
Volume Volume of the sound, 0 to 1.
Min Distance While the player is within this distance in meters from the sound source the volume will remain a the defined Volume, 0 to inf.
Max Distance When the player is this far away in meters from the sound source the volume will be 0, 0 to inf.
Block Volume Multiplier for the Volume. Block Volume * Volume = the sound volume when blocked by an object, if Blockable is active.
Priority If the game runs out of sound channels, then lower priority sounds will be dropped in favor of higher priority sounds. A dialog should have high priority, but physics should have low priority.
hpl3/engine/sound.1335284488.txt.gz · Last modified: 2012/04/24 16:21 by jens