Sound effects

From Open Surge Wiki
Jump to: navigation, search

Overview

Adding or changing sound effects in Open Surge is pretty simple and straightforward. They are stored in the samples/ folder. If you're not an audio expert, you may consider using free programs like sfxr to automatically generate sound effects for your game.

When hacking the engine, please make sure to follow these guidelines:

Format

.OGG or .WAV should be fine, for .WAV files there is only one rule of thumb: don't go over 16 bit (as in 44100Hz 16bit), or your sample will not play. If you are unfamiliar with WAV formats, nowadays any free audio editor, like Audacity, is able to provide you with options to control the sampling frequency and bit depth of your sound effects. Still confused?

Sampling Frequency

Suppose you're watching a road, and every 5 seconds you had to register if there were cars passing, or if nothing passed. That would probably make you lose track of most of the cars, so if you increased the FREQUENCY of your annotation, you'd get closer to how many cars pass by in reality.

In audio, frequency is expressed in Hertz (Hz). One Hertz is the same as "once per second". A sampling frequency of 44.1KHz would mean 44100 times per second. That's why recordings with higher Hertz rates sound better, because the human ear takes less guesses to fill in the gaps.

Bit Depth

A common question when mentioning 16-bit audio is "Is that the equivalent to audio from a 16-bit console?" The answer is "no". Bit depth in audio specifies how many volume bits the wave can use.

A 1-bit wave would translate into "Sound" (1) or "No sound" (0), Background noise would either become silence, or part of the full sound, since there are no intermediates.

A sound with higher bit depth enables more volume levels. A 16-bit sound has up to 65636 levels of volume, but costs more disk space.

Recommended formats

For WAV formats:

Average quality vs Low disk space

22050 Hz 8bit
16000 Hz 8bit

Good quality vs A bit more space

32000 Hz 8bit
22050 Hz 16bit

Maximum quality vs Maximum space usage

44100 Hz 16bit

.OGG seems to compress such formats pretty well, so if you prefer .OGG samples, these formats can be kept with minimal space usage.

Word of advice: If you worry about older machines, using low quality samples reduces CPU usage, resulting in smoother gameplay.