Audio Clip
Manual     Reference     Scripting   
Reference Manual > Components > Asset Components > Audio Clip

このドキュメントは有志により翻訳されたもので、オフィシャルではありません。オリジナルのページはこちら
This document is unofficially translated by users.Please see the original document here.

翻訳に関する修正など、ご連絡はこちらまで。
Please send e-mail to here, when you have any question about the translation.

Audio Clip

Audio Clips are used by Audio Sources to represent the audio asset imported into Unity. Unity supports both Mono and Stereo audio assets. Unity supports importing the following audio file formats: .aif, .wav, .mp3, and .ogg.


The Audio Clip Inspector

Properties

Audio FormatThe specific format that will be used for the sound at runtime.
NativeLarger file size, higher quality. Best for very short sound effects.
CompressedSmaller file size, lower/variable quality. Best for medium length sound effects and music.
3D SoundIf enabled, the sound will play back in 3D space. In Unity 2.6, both Mono and Stereo sounds can be played in 3D
Force to monoIf enabled, the stereo audio clip will be condensed to a single channel mono sound.
Decompress On LoadIf enabled, this clip will be loaded into memory as soon as the scene containing it is loaded. It is suggested that you leave this on, otherwise your game may have reduced performance as the sound is decompressed real-time at runtime.
CompressionAmount of Compression to be applied to a Compressed clip. Statistics about file size can be seen beneath the slider. It is suggested to drag the slider to a place that leaves the playback "good enough" but still at a small enough size to meet your file size/distribution needs.

Importing Audio Assets

Unity supports both Compressed and Uncompressed Audio. Any type of file except .mp3 will be initially imported as Uncompressed. MP3 and Compressed audio files must be decompressed by the CPU while the game is running, but are smaller in file size. Native formats have the benefit of being higher fidelity without increasing CPU taxation, but create much larger files.

As a general rule of thumb, Compressed audio is best for long files like background music or dialog, and uncompressed is better for short sound effects that are under two seconds. However...

If you are creating a web player game, you should Compress as much of your audio as possible. This will help you attain the smallest file size for webplayer downloads. If you tweak the amount of Compression, the difference in sound quality won't be noticeable.

Using 3D Audio

If an audio clip is marked as a 3D Sound then it will be played back to simulate its position in the game world's 3D space. 3D sounds simulate distance and location of sounds by fading volume and panning across speakers. Unity supports 3D audio, and any stereo or mono clip can be played back in 3D space. However, mono 3D sounds are the most common.

Loading Compressed Audio

Compressed audio files have an option to choose when the Clip will be decompressed. The option is set in the Import Settings:

Decompress On Load enabledDecompress and load the Clip into RAM when the player is loading.
Decompress On Load disabled (Live decompression)Decompress and play the Clip real-time when the Clip is triggered to start.

Decompressing on load is the most commonly used option, and shouldn't really be disabled unless you have a special case. It means that the levels containing the Clip will take longer to load initially, and it will use up more of the end-user's RAM. Live decompression does not load the Clip data into RAM at level load. Instead, it requires the CPU to decompress the sound real-time. This means it is more CPU intensive rather than RAM intensive.

To summarize, enable decompression on load as much as possible, and definitely for all short Clips. Pick live decompression for longer Clips like music tracks. All Ogg Vorbis Clips using live decompression will increase CPU usage. It can use a substantial amount of CPU to live decompress multiple Clips at once, so you should avoid playing more than 2 live decompression Clips at once.