Note:This will not cover audio scripting--please refer to the "Sound" section under "Programming".
- General Manual on Sound in Unity
- Manual on Handling Audio Files in Unity
- Manual on Integrating Audio Trackers (i.e. FMOD) in Unity
Note: For the definition of 3D Sound, head over to Importing Sounds.
You'll find that Unity 3 has a lot to offer in terms of 3D sound. There's a wealth of properties and settings to tweak:
- Pan - This slider controls how much the 3D sound feature will affect the panning of the sound. 1 meaning that the 3D sound feature will take full advantage of its panning capabilities (i.e. if the audio listener is facing away from the object, the sound will distribute itself accordingly, attenuate when the listener moves away, etc.) whereas 0 will cause the feature to ignore panning altogether.
- Spread - This slider controls how much the sound is distributed among the speakers at any given time. It's best to think of this concept in terms of a surround sound system. If a sound is playing from the front speaker and only the front speaker and the value of the sound's spread is at zero, then the sound will only play from the front speaker and will remain to be very directional as 3D sound affects it--it will sound as if the sound file is being played from a very minute point. However, if the spread is increased to 90, then the sound will affect a full 90 degree angle and will take up more real estate in the surround sound system. As the audio listener turns and 3D sound kicks in, the sound will only move around the listener while consistently covering 90 degrees of space in the surround sound system. Putting the spread at its maximum setting, 360, would mean that all panning of any kind will be gone and the sound will constantly play from all angles.
- Doppler Level - This slider controls the doppler effect on a 3D sound. Turning it up to its maximum setting of 5 will mean that the drop and rise in pitch will be noticeably more dramatic than a setting of 0.5, where the change in pitch will be more gradual.
- Min Distance - The minimum distance the audio listener has to be from the audio source to have the sound play at its fullest volume (the fullest volume being determined by the volume slider above the 3D Sound Settings tab). Once the audio listener begins moving away from the source, the sound will begin to get softer.
- Max Distance - The maximum distance the audio listener can be from the source and still be able to hear the sound. If the audio listener is beyond this point then the sound will either not be playing or it will be playing at its lowest possible volume--depending on the sound's rolloff settings. At the same time, the max distance will most likely be the point at which the sound will be at its softest, depending on the sound's Rolloff Mode.
- Rolloff Mode - This contains a subset of modes that determine how sounds will be affected (i.e. volume, spread, pan, etc.) based on how far the audio listener is from the audio source. There are three different flavors of rolloff that come with Unity: Logarithmic, Linear, and Custom. Each rolloff mode is also represented in a graph with the intensity of a given parameter vs. distance (see Fig. 1). File:RolloffModes.jpg
- Logarithmic - This is the most natural setting, as an audio source will be attenuated much like it would in real life.
- Linear - As the name implies, the attenuation of an audio source will move 1:1 with the increase of distance.
- Custom - You can determine your own style of rolloff here by utilizing the graph located just below Rolloff Mode. To add more nodes to a parameter, double click anywhere on the parameter's line and a new node will appear. Drag these nodes to determine your own rolloff for a given parameter (see Fig. 2). File:RolloffGraph.jpg
- Note: More parameters can be placed into the rolloff graph by adding more effects onto the sound.