Audio Source 音频源

Date:2011-08-07

The Audio Source plays back an Audio Clip in the scene. If the Audio Clip is a 3D clip, the source is played back at a given position and will attenuate over distance. The audio can be spread out between speakers (stereo to 7.1) (Spread) and morphed between 3D and 2D (PanLevel). This can be controlled over distance with falloff curves. Also, if the listener is within 1 or multiple Reverb Zones, reverberations is applied to the source. (PRO only) Individual filters can be applied to each audio source for an even richer audio experience. See Audio Effects for more details.

音频源(Audio Source)在场景中播放音频剪辑(Audio Clip)。如果音频剪辑(Audio Clip)是一个3D剪辑,音频源是在一个给定的位置,并会随距离衰减这样的方式进行播放。音频可以在扬声器之间传播(立体声至7.1)(扩散Spread)和可以在3D和2D(平衡调整级别PanLevel)之间进行转换。这是可以控制的随距离衰减曲线。此外,如果侦听器是在1个或多个混响区中,回响将会应用到音频源。 (只专业版可用)单独的过滤器可以应用到每个音频源,可以得到更丰富的音频体验。更多细节请参阅音频效果(Audio Effects)。

音频源 Audio Source
The Audio Source gizmo in the Scene View and its settings in the inspector.
音频源在场景视图中gizmo 和 它在检视面板中的设置

Properties 属性

  • Audio Clip 音频剪辑
    Reference to the sound clip file that will be played.
    将被播放的声音剪辑文件
  • Mute 静音
    If enabled the sound will be playing but muted.
    如果启用,声音将被播放,但没有声音(静音)
  • Bypass Effects 直通效果
    This Is to quickly "by-pass" filter effects applied to the audio source. An easy way to turn all effects on/off.
    应用到音频源的快速"直通"过滤效果。一个简单的方法来打开/关闭所有特效。
  • Play On Awake
    唤醒时播放
    If enabled, the sound will start playing the moment the scene launches. If disabled, you need to start it using the Play() command from scripting.
    如果启用,则声音会在场景启动的时候开始播放。如果禁用,则需要从脚本中使用的play()命令来启动它。
  • Loop 循环
    Enable this to make the Audio Clip loop when it reaches the end.
    启用这个属性使音频剪辑(Audio Clip)在播放结束后循环 。
  • Priority
    优先权
    Determines the priority of this audio source among all the ones that coexist in the scene. (Priority: 0 = most important. 256 = least important. Default = 128.). Use 0 for music tracks to avoid it getting occasionally swapped out.
    确定场景所有并存的音频源之间的优先权。(0=最重要的优先权。256 =最不重要。默认为128。)。使用0的音乐曲目,以避免偶尔换出。
  • Volume 音量
    How loud the sound is at a distance of 1 world unit (1 meter) from the Audio Listener.
    声音从距离音频监听器(Audio Listener)1个世界单位(1米)处有多响?
  • Pitch 音调
    Amount of change in pitch due to slowdown/speed up of the Audio Clip. Value 1 is normal playback speed.
    改变音调(Pitch)值,可以减速/加速音频剪辑的播放。1是正常播放速度。
  • 3D Sound Settings
    3D声音设置
    Settings that are applied to the audio source if the is a 3D Sound.
    如果是一个三维的声音,应用到音频源的设置
  • Pan Level
    平衡调整级别
    Sets how much the 3d engine has an effect on the audio source.
    设置多少,3D引擎在音频源上有效果。
  • Spread 扩散
    Sets the spread angle to 3d stereo or multichannel sound in speaker space.
    设置3D立体声或者多声道音响在扬声器空间的传播角度。
  • Doppler Level
    多普勒级别
    Determines how much doppler effect will be applied to this audio source (if is set to 0, then no effect is applied).
    决定了多少多普勒效应将被应用到这个音频信号源(如果设置为0,就是无效果)。
  • Min Distance
    最小距离
    Within the MinDistance, the sound will stay at loudest possible. Outside MinDistance it will begin to attenuate. Increase the MinDistance of a sound to make it 'louder' in a 3d world, and decrease it to make it 'quieter' in a 3d world.
    在最小距离(MinDistance)之内,声音会保持最响亮。 在最小距离(MinDistance)之外,声音就会开始衰减。增加声音的最小距离(MinDistance),可以使声音在3D世界"更响亮",减少最小距离(MinDistance)可使声音在一个三维世界"安静"。
  • Max Distance
    最大距离
    The distance where the sound stops attenuating at. Beyond this point it will stay at the volume it would be at MaxDistance units from the listener and will not attenuate any more.
    声音停止衰减距离。超过这一点,它将在距离侦听器最大距离(MaxDistance)单位,保持音量,并不会作任何衰减。
  • Rolloff Mode
    衰减模式
    How fast the sound fades. The higher the value, the closer the Listener has to be before hearing the sound.(This is determined by a Graph).
    声音淡出的速度有多快。该值越高,越接近侦听器最先听到声音(这是由图形决定)。
  •     Logarithmic Rolloff
        对数衰减
    The sound is loud when you are close to the audio source, but when you get away from the object it decreases significantly fast.
    当你接近的音频源,声音响亮,但是当你远离对象,声音下降显着快。
  •     Linear Rolloff
        线性衰减
    The more far away from the audio source you go, the less you can hear it.
    越是远离音频源的,你可以听到的声音越小。
  •     Custom Rolloff
        自定义衰减
    The sound from the audio source behaves accordingly to how you set the graph of roll offs.
    根据你设置的衰减图形,来自音频源的声音行为。
  • 2D Sound Settings
    2D声音设置
    Settings that are applied to the audio source if the is a 3D Sound.
    如果是一个二维的声音,应用到音频源的设置
  • Pan 2D
    2D平衡调整
    Sets how much the engine has an effect on the audio source.
    设置多少,引擎在音频源上有效果。

Types of Rolloff 衰减类型

There are three Rolloff modes: Logarithmic, Linear and Custom Rolloff. The Custom Rolloff can be modified by modifying the volume distance curve as described below. If you try to modify the volume distance function when it is set to Logarithmic or Linear, the type will automatically change to Custom Rolloff.

衰减模式有三种:对数,线性和自定义衰减。自定义衰减可以修改通过修改音量的距离曲线,如下所述。当它被设置为对数或线性类型时,如果你修改音量距离函数,类型将自动更改为自定义衰减。

Types of Rolloff 衰减类型
Rolloff Modes that an audio source can have. 音频源的衰减模式

Distance Functions 距离函数

There are several properties of the audio that can be modified as a function of the distance between the audio source and the audio listener.

有音频的几个的属性,作为 音频源和音频侦听器之间的距离的函数,可以被修改。

Volume: Amplitude(0.0 - 1.0) over distance. 音量:幅度(0.0-1.0)随距离
Pan: Left(-1.0) to Right(1.0) over distance. 平衡调整: 左(-1.0)到右(1.0)随距离
Spread: Angle (degrees 0.0 - 360.0) over distance. 扩散:角度(0.0到360.0度)随距离
Low-Pass (only if LowPassFilter is attached to the AudioSource): Cutoff Frequency (22000.0-10.0) over distance.
低通(只有当低通滤波器(LowPassFilter)贴到音频源(AudioSource)上): 低通截止频率(10.0~22000.0hz)随距离。

Distance Functions 距离函数
Distance functions for Volume, Pan, Spread and Low-Pass audio filter. The current distance to the Audio Listener is marked in the graph.

音量,平衡调整,扩散和低通音频滤波器的距离函数。当前到音频监侦听器的距离在图中标记。

To modify the distance functions, you can edit the curves directly. For more information, see the guide to Editing Curves.

要修改的距离函数,您可以直接编辑曲线。想了解更多信息,请参阅编辑曲线(Editing Curves)的指南。

Creating Audio Sources 创建音频源

Audio Sources don't do anything without an assigned Audio Clip. The Clip is the actual sound file that will be played back. The Source is like a controller for starting and stopping playback of that clip, and modifying other audio properties.

没有分配音频剪辑的音频源不会播放任何东西。剪辑是实际的声音文件,该文件将被播放。音频源就像是一个控制器,用于启动和停止播放该剪辑,并修改其他的音频属性。

To create a new Audio Source 创建一个新的音频源:

  1. Import your audio files into your Unity Project. These are now Audio Clips.
    导入你的音频文件到Unity项目。这些都是现在的音频剪辑。
  2. Go to GameObject->Create Empty from the menubar.
    从菜单栏选择 GameObject->Create Empty
  3. With the new GameObject selected, select Component->Audio->Audio Source.
    随着新的游戏对象(GameObject) 被选择,选择 Component->Audio->Audio Source
  4. Assign the Audio Clip property of the Audio Source Component in the Inspector.
    在检视面板中分配音频源 (Audio Source)组件的音频剪辑属性。

Note: If you want to create an audio source just for one Audio Clip that you have in the Assets folder, you can drag and drop that Audio Clip to the scene view and an Audio Source game object will be created automatically for it.

注意:如果你想创建一个音频源,只需有一个音频剪辑(Audio Clip)在你的资源文件夹,你可以拖拽音频剪辑(Audio Clip)到场景视图,那么带有音频源(Audio Source)的游戏对象将自动创建。

Platform specific details 平台的具体细节

iOS

On mobile platforms compressed audio is encoded as MP3 for speedier decompression. Beware that this compression can remove samples at the end of the clip and potentially break a "perfect-looping" clip. Make sure the clip is right on a specific MP3 sample boundary to avoid sample clipping (Tools to perform this is widely available). For performance reasons audio clips can be played back using the Apple hardware codec. To enable this check the "Use Hardware" checkbox in the import settings. See the Audio Clip documentation for more details.

在移动平台上的压缩音频以MP3格式编码为了能快捷解压。要注意,这种压缩是可以删除剪辑结尾的样品,并可能打破一个"完美循环"的剪辑。确保剪辑是正确的在一个特定的MP3样品边界,避免样品剪裁(这是执行它广泛被使用的工具)。出于性能方面的原因,音频剪辑可以使用苹果的硬件编解码器进行播放。若要启用它,选上在导入设置(import settings)的"使用硬件(Use Hardware)"复选框。有关详细信息,请参阅音频剪辑(Audio Clip)文件。

Android

On mobile platforms compressed audio is encoded as MP3 for speedier decompression. Beware that this compression can remove samples at the end of the clip and potentially break a "perfect-looping" clip. Make sure the clip is right on a specific MP3 sample boundary to avoid sample clipping (Tools to perform this is widely available).

在移动平台上的压缩音频以MP3格式编码为了能快捷解压。要注意,这种压缩是可以删除剪辑结尾的样品,并可能打破一个"完美循环"的剪辑。确保剪辑是正确的在一个特定的MP3样品边界,避免样品剪裁(这是执行它广泛被使用的工具)。

页面最后更新: 2010-09-10

分类:Components|评论: 0|浏览: 176 翻译: 肥耀
评论
暂无评论
发表评论
用户名:

评论审核后才会显示!