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.

Unity同时支持压缩和非压缩音频。任何类型文件除了MP3将首先为未压缩引入,MP3和压缩音频文件必须由CPU解压缩在游戏运行时,但它们是小的文件尺寸。原生格式有益于高保真而没有增加CPU的课税,但是建立更大的文件。

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.

解压缩并加载剪辑到RAM里当播放器装载时。

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.

在装载时解压缩是最常用的选项,实在不应被禁用,除非你有特殊情况。这意味着,各级包含剪辑将需要更长的时间来加载最初的,它会使用更多的最终用户的内存。实时解压不加载到内存在装载时。相反,它需要CPU来实时解压缩声音。这意味着它是更多的CPU加强而非内存加强。

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个立即实时解压剪辑。

<12>
发表评论0条 】
网友评论(共?条评论)..
Unity3D基础教程3-6:音频文件(Audio Files)