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
This section explains how to import sounds into Unity and what options users will have right off the bat in the Inspector window (see Fig. 1). File:AudioImporter.png
- Drag and drop sound files into the Project window. Making a special folder for audio is recommended for organization sake. Note: Unity will accept a large variety of audio files such as mp1, mp2, mp3, ogg vorbis, wav, and aiff along with audio tracker files such as mod files, IT, S3M, XM, and FMOD files.
- After importing sounds, clicking on any of them will bring up an Audio Importer on the Inspector window. In the Inspector window, the first choice will be Audio Format, where you can choose to either compress the sound file or leave it as it is. Generally, it's a good idea to have longer files, such as dialog, be compressed and have the shorter files be uncompressed.
- You will also be able to choose whether to apply 3D Sound to the file. If you enable it, the sound will become "spatialized", meaning that if player gets closer to the sound, it'll get louder, the sound will pan left and right relative to the listener's "head", it will react to doppler effects, etc. Note: The sound will not be able to "pan" above or below--3D sound is not capable of this. Unchecking the box will render the sound as a 2D sound, meaning it can only be panned left to right.
- Force to Mono does exactly what it sounds like--if a sound file is in stereo, Unity will render the file to mono.
- Decompress On Load also does exactly what it sounds like--if this box is checked, then compressed files will get decompressed when they play, allowing them to be heard with higher fidelity. Again, to save memory, it's a good idea to do this for shorter sound files.
- Hardware Decoding is a feature needed for handling codec issues between different operating systems, such as iOS or Android. Check the box for hardware decoding if issues arise.
- Lastly, you'll have access to a Compression slider to control the bit rate of a compressed file. The lower the bit rate of a file is, the smaller the dynamic range and general fidelity will be. On the up side, though, lowering the bit rate does make for more memory to use.