Unity3D基础教程3-6:音频文件(Audio Files)

2014-08-12 19:13:43|?次阅读|上传:huigezrx【已有?条评论】发表评论

关键词:Unity3D, 游戏, 虚拟现实|来源:唯设编程网

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.

如果您要创建一个web玩家游戏,你应该压缩尽可能多的你的音频。 这将帮助你实现最小的webplayer下载文件的大小。如果你修改的压缩量,在音质的差异不会明显。

Using 3D Audio 使用3D音频

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.

如果音频剪辑被标记为一个3D音效 然后将播放模拟其在游戏世界的三维空间位置。三维模拟的声音衰减量和跨者平移距离和声音的位置。Unity支持3D音效,任何剪辑立体声或单声道,可在三维空间中播放。不过,单声道立体声音是最常见的。

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 enabled

解压缩在装载 启用

Decompress 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.

总之,在加载时尽可能启用解压缩,并明确所有短的剪辑。挑选实时解压的长的剪辑像音乐曲目。 所有的Ogg Vorbis剪辑使用实时解压会增加CPU使用率。它可以使用大量的CPU数量一次解压缩多个剪辑,所以你应该避免在播放超过2个立即实时解压剪辑。

发表评论0条 】
Unity3D基础教程3-6:音频文件(Audio Files)