Audio Clip 音频剪辑

优质
小牛编辑
125浏览
2023-12-01

Audio Clips are audio data used by Audio Sources. Unity supports mono, stereo and multi (up to 8) channels audio assets. Unity supports importing the following audio file formats: .aif, .wav, .mp3, and .ogg, and the following tracker module file formats: .xm, .mod, .it, and .s3m. The tracker module assets works the same way as any other audio assets in Unity except no waveform preview can be rendered to the asset import inspector.

音频剪辑(Audio Clips)是被音频源(Audio Sources)使用的音频数据。Unity支持单声道,立体声和多通道(最多8个)音频资源。Unity支持导入以下音频文件格式:.aif, .wav, .mp3, .ogg 和下面的跟踪器模块(tracker module)文件格式:.xm, .mod, .it, and .s3m。跟踪器模块资源与任何其他音频资源在Unity中以相同的方式工作(用法一样),除了在资源导入检视面板没有波形预览显示。

The Audio Clip Inspector 音频剪辑检视面板
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. Both Mono and Stereo sounds can be played in 3D.
    如果启用,声音会在三维空间中播放。单声道和​​立体声的声音可以在3D播放
  • Force to mono 强制单声道 If enabled, the audio clip will be down-mixed to a single channel sound.
    如果启用,音频剪辑将向下混合成一个单声道的声音。
  • Load Type 加载类型 The way Unity load audio assets runtime.
    Unity在运行时加载音频资源的方式
  •     Decompress on load
        加载时解压 Decompress sounds upon load. Use this for smaller compressed sounds to avoid the performance overhead of decompressing on the fly. Beware that decompressing sounds on load will use ~10x more memory than keeping them compressed in memory, so don't use this for large files.
    加载时解压声音。这用在较小的压缩的声音,以避免即时解压缩的性能开销。注意,加载时解压声音,比起保持它们在内存中要多使用10倍以上内存,所以不要将它用在大文件上。
  •     Compressed in memory
        在内存压缩 Keep sounds compressed in memory and decompress while playing. This have a slight performance overhead (esp. for Ogg/Vorbis compressed files) so only use this for bigger files.
    保持声音在内存中压缩,并在播放时解压缩。这有轻微的性能开销(尤其是对Ogg / Vorbis格式的压缩文件),所以这个只能用在更大的文件上。
  •     Stream from disc
        从磁盘流 Stream audio data directly from disc. This uses a fraction of the original sounds size of memory. Use this for your music or very long tracks. Depending on the hardware, a general advice is to keep this down to 1-2 simultaneously streams.
    直接从光盘来的音频数据流。这使用原始声音内存大小的一小部分。这用在你的音乐或很长的轨道。根据硬件,一般建议是同时保持1-2流。
  • 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.
    用于压缩剪辑的压缩量。有关文件大小的统计数据可以在滑条下面看到。建议拖动滑块到一个地方,离开"足够好"的播放,但仍然在一个足够小的尺寸,以满足您的文件大小/分配需要。
  • Hardware Decoding
    硬件解码 (iOS ONLY) Available for compressed audio on iOS devices. Uses Apple's hardware decoder for less CPU intensive decompression. Check out Platform Specific details for more info.
    IOS)为iOS设备上的音频压缩。使用较少的CPU密集型减压苹果的硬件解码器。查看更多信息平台的具体细节。
  • Gapless looping
    无缝循环 (Android/iOS ONLY) Use this when compressing a perfect looping audio source file (in a non-compressed PCM format) to preserve the loop. Standard MPEG encoders introduce silence around the loop point, which will play as little "click" or "pop". Unity handles this smoothly for you.
    Android的/ IOS)时,使用此压缩一个完美的循环音频源文件(非压缩的PCM格式),以维持循环。标准的MPEG编码器引入各地的循环点,这将发挥小的"点击"或"流行"的沉默。统一处理此为您顺利。

Importing Audio Assets 导入音频资源

Unity supports both Compressed and Native Audio. Any type of file (except MP3/Ogg Vorbis) will be initially imported as Native. Compressed audio files must be decompressed by the CPU while the game is running, but are smaller in file size. If Stream is checked the audio is decompressed on the fly, or else the audio is decompressed entirely upon load. Native PCM formats (WAV, AIFF) have the benefit of being higher fidelity without increasing CPU taxation, but create much larger files. Module files (.mod,.it,.s3m..xm) can deliver very high quality with an extremely low footprint.

Unity同时支持压缩和原生音频。任何类型的文件(MP3/Ogg Vorbis的除外),最初都以原生音频导入(Native即不经任何处理的音频本身)。游戏运行时,压缩音频文件必须由CPU解压缩,但文件大小较小。流(Stream )被选上 音频在运行时解压缩,或者音频在加载时完全解缩。原生脉冲编码调制(PCM)格式(WAV,AIFF)有在不增加CPU资源同时有更高的保真度的好处,但创造更大的文件。模块文件(.MOD,.S3M,. XM)可以提供非常高的质量与极低的占用空间。

As a general rule of thumb, Compressed audio(or modules) are best for long files like background music or dialog, and uncompressed is better for short sound effects. Tweak the amount of Compression with the compression slider to just before the difference in sound quality is noticeable.

一般的经验是,压缩音频(或模块)最好是长文件,如背景音乐或对话,和未经压缩的短声音效果更好。用压缩滑动条(Compression)来调整压缩量,前后音质的差异是明显的。

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 emulate distance and location of sounds by attenuating volume and panning across speakers. Both mono and multiple channel sounds can be positioned in 3D. For multiple channel audio, use the spread option on the Audio Source to spread and split out the discrete channels in speaker space. Unity offers a variety of options to control and fine-tune the audio behavior in 3D space. Take a look at Audio Source.

如果音频剪辑标记为3D音效(3D Sound),它会模拟在游戏世界三维空间中的位置播放。 3D音效以衰减音量和扬声器之间平衡调整模拟声音的距离和位置。单声道和​​多声道声音都可以放置在三维空间。对于多声道音频,使用的音频源(Audio Source)中的扩散(spread )选项来扩散并在扬声器空间分离出离散通道。Unity提供了多个选项,来控制和微调三维空间中音频的行为。看看音频源(Audio Source)。

Platform specific details 平台的具体细节

iOS

On mobile platforms compressed audio is encoded as MP3 for less CPU intensive decompression.

在移动平台上的压缩音频以MP3格式编码,以在解压缩时占用更少的CPU资源。

For performance reasons audio clips can be played back using the Apple hardware codec. To enable this check the "Hardware Decoding" checkbox in the Audio Importer. Note that only one hardware audio stream can be decompressed at a time, including the background iPod audio.

出于性能方面的原因音频剪辑可以使用苹果的硬件编解码器进行播放。要启用它,把音频导入器(Audio Importer)下的"硬件解码(Hardware Decoding)"复选框勾选上。请注意,同一时间只能有一个硬件音频流解压缩,包括背景的iPod音频。

If the hardware decoder is not available, the decompression will fall back on the software decoder (on iPhone 3GS or newer Apple's software decoder is used over Unity's(FMOD) own decoder).

如果硬件解码器不可用,解压的任务将落在软件解码器上(iPhone 3GS或较新的苹果软件解码器是通过Unity(FMOD)自带的解码器使用)。

Android

On mobile platforms compressed audio is encoded as MP3 for less CPU intensive decompression.

在移动平台上的压缩音频以MP3格式编码,以在解压缩时占用更少的CPU资源。

页面最后更新: 2011-05-30