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

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

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

Unity Manual > User Guide > Working with Assets > Audio Files

Unity手册-> 用户指南 ->与资产合作-> 音频文件

Just like when using Meshes or Textures, the workflow for Audio File assets is designed to make things work for you quickly and easily. You can make your Audio Files with any format you like, and Unity can import them and play them back, but there's some specific information you should know for working with Audio Files.

就像当使用网格或纹理时,工作流程 音频文件 资产的目的是有计划的使事情为你快速及轻松地工作。你可以用你喜欢的任何格式的音频文件,Unity可以导入和播放发挥它们,但是有一些具体的信息,你应该知道与音频文件工作。

The supported audio formats for Unity executables are Ogg Vorbis and uncompressed audio. You can choose to convert any Audio File to Ogg Vorbis from inside the Editor. You can create your audio files in any format you like, and Unity will automatically convert them to Ogg Vorbis. If you don't, then your audio files will remain uncompressed, and will be much larger in size. Having uncompressed audio is okay for short sounds, like up to several seconds. Longer sounds and especially music will have huge file sizes when uncompressed, and will increase the overall size of the executable.

Unity支持的可执行音频格式是 Ogg Vorbis的 和未压缩音频。你可以选择从编辑器内部转换任何音频文件为Ogg Vorbis格式。你可以创建你喜欢的任何格式音频文件,Unity将自动将其转换成Ogg Vorbis。如果你没有,那么你的音频文件将保留未压缩,而大小将非常巨大。经压缩的音频是好的短的声音,像几秒钟。特别是较长的声音和音乐有很大的文件当未压缩时,并会增加可执行文件的总体规模。

With this in mind, the general rules of thumb are: 考虑到这一点,一般的经验规则是:

◆ Convert music and long sounds to Ogg Vorbis from inside the Editor. The audio data will be small, but will cost CPU cycles to decode at play time. For best sound quality supply your own Ogg Vorbis files, or use uncompressed audio files (converting an MP3 file to Ogg loses some quality).

在编辑器内部转换的音乐和长期的声音到Ogg Vorbis。音频数据将变小,但将花费CPU周期去解码在播放时。为了达到最佳的声音质量提供自己的Ogg Vorbis文件,或使用压缩的音频文件(转换 MP3文件为Ogg失去一些质量)。

◆ Use uncompressed audio for short sound effects. The audio data will be larger, but sounds won't need to be decoded at play time.

◆ 短声音效果使用未压缩音频。音频数据将变大,但声音不会需要在播放时解码。

Any Audio File imported into Unity is called as an Audio Clip. Audio Clips work in conjunction with Audio Sources and an Audio Listener. Think of Clips as audio data only. When you attach your Clip to an object in the game, it becomes an Audio Source and it now has Volume, Pitch, and other properties like Loop. While a Source is playing, an Audio Listener can "hear" all Sources that are close enough, and those are the sounds you will hear through your speakers. There can be only one Audio Listener in your scene, and this is usually attached to the Main Camera. In most cases you will work with Audio Sources more than Clips or Listeners.

任何音频文件引入到Unity里被称作为音频剪辑。音频剪辑工作与音频源音频监听协作。考虑剪辑仅作为音频数据,当你将你的剪辑附加到一个游戏中的对象时,它成为一个音频源,并拥有一个音量,间距及其它属性像循环。当一个源正在播放时,一个音频监听器可以“听”到足够接近所有来源的,这些都是你会听到声音通过扬声器。只能有一个音频监听在你的场景中,这通常是附加到 主相机。在大多数情况下,你将与音频源一起工作,超过剪辑或监听程序。

See the Sound chapter in the Creating Gameplay section of this manual for more information on using sound in Unity.

在本手册的创建游戏里看声音章,获得更多使用声音信息在Unity里。

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.

音频剪辑 通过音频源的使用表现音频资产引入到Unity里。Unity同时支持单声道和立体声音频资产。Unity支持导入以下音频文件格式:.aif, .wav, .mp3, 及 .ogg

Unity3D基础教程3-6:音频文件(Audio Files)
The Audio Clip Inspector 音频剪辑在检视器里

Properties 属性

Audio Format

音频格式

The specific format that will be used for the sound at runtime.

具体格式将声音在运行时使用。

Native

原态

Larger file size, higher quality. Best for very short sound effects.

较大的文件大小,质量更高。最好用于很短的音响效果。

Compressed

压缩的

Smaller file size, lower/variable quality. Best for medium length sound effects and music.

较小的文件尺寸,降低/可变质量。最好用于中等长度的音效和音乐的媒体。

3D Sound

3D声音

If enabled, the sound will play back in 3D space. In Unity 2.6, both Mono and Stereo sounds can be played in 3D

如果启用,声音将播放在三维空间中。在Unity2.6里,单声道和立体声都可以被播放

在3D里

Force to mono

强制单声道

If enabled, the stereo audio clip will be condensed to a single channel mono sound.

如果启用,立体声音频剪辑将简化为单一通道单声道。

Decompress On Load
解压装载

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

如果启用,该剪辑将被加载到内存中当现场包含它同时被加载。建议你保留这个启用,否则,你的游戏可能减少性能当声音是在运行时解压缩实。

Compression

压缩

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

压缩量将适用于压缩 剪辑。统计有关文件的大小可以看到下面的滑块。它建议拖动滑块到一个地方,离开播放“足够好”,但仍在一个足够小的尺寸以满足你的文件大小/分配的需要。

 

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