朱峰社區(qū)首頁(yè) 朱峰社區(qū)

搜索資源 注冊(cè)|登陸

等待

返回 展開菜單
按功能 按軟件

unity3d視頻教程

unity3d視頻教程

包含11節(jié)視頻教程

從零基礎(chǔ)學(xué)習(xí)unity3d游戲引擎,簡(jiǎn)單易學(xué)的視頻教程,讓你快速掌握unity3d,并喜歡上游戲開發(fā)的樂趣。

關(guān)閉

Unity組件:Audio Source 音頻源

關(guān)注:4753 留言:0 樓主:xiaoxiaoxinxi 發(fā)帖時(shí)間:15年11月16日

xiaoxiaoxinxi

普通會(huì)員

xiaoxiaoxinxi

社區(qū)鼻祖:9級(jí)

關(guān)注4555人

  • 積分

    1137

  • 登陸

    1

  • 發(fā)帖

    6

  • 作品

    1

間隔線

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)在場(chǎng)景中播放音頻剪輯(Audio Clip)。如果音頻剪輯(Audio Clip)是一個(gè)3D剪輯,音頻源是在一個(gè)給定的位置,并會(huì)隨距離衰減這樣的方式進(jìn)行播放。音頻可以在揚(yáng)聲器之間傳播(立體聲至7.1)(擴(kuò)散Spread)和可以在3D和2D(平衡調(diào)整級(jí)別PanLevel)之間進(jìn)行轉(zhuǎn)換。這是可以控制的隨距離衰減曲線。此外,如果偵聽器是在1個(gè)或多個(gè)混響區(qū)中,回響將會(huì)應(yīng)用到音頻源。 (只專業(yè)版可用)單獨(dú)的過濾器可以應(yīng)用到每個(gè)音頻源,可以得到更豐富的音頻體驗(yàn)。更多細(xì)節(jié)請(qǐng)參閱音頻效果(Audio Effects)。

音頻源 Audio Source
The Audio Source gizmo in the Scene View and its settings in the inspector.
音頻源在場(chǎng)景視圖中g(shù)izmo 和 它在檢視面板中的設(shè)置

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.
    應(yīng)用到音頻源的快速"直通"過濾效果。一個(gè)簡(jiǎn)單的方法來打開/關(guān)閉所有特效。
  • Play On Awake
    喚醒時(shí)播放
    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.
    如果啟用,則聲音會(huì)在場(chǎng)景啟動(dòng)的時(shí)候開始播放。如果禁用,則需要從腳本中使用的play()命令來啟動(dòng)它。
  • Loop 循環(huán)
    Enable this to make the Audio Clip loop when it reaches the end.
    啟用這個(gè)屬性使音頻剪輯(Audio Clip)在播放結(jié)束后循環(huán) 。
  • Priority
    優(yōu)先權(quán)
    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.
    確定場(chǎng)景所有并存的音頻源之間的優(yōu)先權(quán)。(0=最重要的優(yōu)先權(quán)。256 =最不重要。默認(rèn)為128。)。使用0的音樂曲目,以避免偶爾換出。
  • Volume 音量
    How loud the sound is at a distance of 1 world unit (1 meter) from the Audio Listener.
    聲音從距離音頻監(jiān)聽器(Audio Listener)1個(gè)世界單位(1米)處有多響?
  • Pitch 音調(diào)
    Amount of change in pitch due to slowdown/speed up of the Audio Clip. Value 1 is normal playback speed.
    改變音調(diào)(Pitch)值,可以減速/加速音頻剪輯的播放。1是正常播放速度。
  • 3D Sound Settings
    3D聲音設(shè)置
    Settings that are applied to the audio source if the is a 3D Sound.
    如果是一個(gè)三維的聲音,應(yīng)用到音頻源的設(shè)置
  • Pan Level
    平衡調(diào)整級(jí)別
    Sets how much the 3d engine has an effect on the audio source.
    設(shè)置多少,3D引擎在音頻源上有效果。
  • Spread 擴(kuò)散
    Sets the spread angle to 3d stereo or multichannel sound in speaker space.
    設(shè)置3D立體聲或者多聲道音響在揚(yáng)聲器空間的傳播角度。
  • Doppler Level
    多普勒級(jí)別
    Determines how much doppler effect will be applied to this audio source (if is set to 0, then no effect is applied).
    決定了多少多普勒效應(yīng)將被應(yīng)用到這個(gè)音頻信號(hào)源(如果設(shè)置為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)之內(nèi),聲音會(huì)保持最響亮。 在最小距離(MinDistance)之外,聲音就會(huì)開始衰減。增加聲音的最小距離(MinDistance),可以使聲音在3D世界"更響亮",減少最小距離(MinDistance)可使聲音在一個(gè)三維世界"安靜"。
  • 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.
    聲音停止衰減距離。超過這一點(diǎn),它將在距離偵聽器最大距離(MaxDistance)單位,保持音量,并不會(huì)作任何衰減。
  • 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
        對(duì)數(shù)衰減
    The sound is loud when you are close to the audio source, but when you get away from the object it decreases significantly fast.
    當(dāng)你接近的音頻源,聲音響亮,但是當(dāng)你遠(yuǎn)離對(duì)象,聲音下降顯著快。
  •     Linear Rolloff
        線性衰減
    The more far away from the audio source you go, the less you can hear it.
    越是遠(yuǎn)離音頻源的,你可以聽到的聲音越小。
  •     Custom Rolloff
        自定義衰減
    The sound from the audio source behaves accordingly to how you set the graph of roll offs.
    根據(jù)你設(shè)置的衰減圖形,來自音頻源的聲音行為。
  • 2D Sound Settings
    2D聲音設(shè)置
    Settings that are applied to the audio source if the is a 3D Sound.
    如果是一個(gè)二維的聲音,應(yīng)用到音頻源的設(shè)置
  • Pan 2D
    2D平衡調(diào)整
    Sets how much the engine has an effect on the audio source.
    設(shè)置多少,引擎在音頻源上有效果。
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.

衰減模式有三種:對(duì)數(shù),線性和自定義衰減。自定義衰減可以修改通過修改音量的距離曲線,如下所述。當(dāng)它被設(shè)置為對(duì)數(shù)或線性類型時(shí),如果你修改音量距離函數(shù),類型將自動(dòng)更改為自定義衰減。

Types of Rolloff 衰減類型
Rolloff Modes that an audio source can have. 音頻源的衰減模式

Distance Functions 距離函數(shù)

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.

有音頻的幾個(gè)的屬性,作為 音頻源和音頻偵聽器之間的距離的函數(shù),可以被修改。

Volume: Amplitude(0.0 - 1.0) over distance. 音量:幅度(0.0-1.0)隨距離
Pan: Left(-1.0) to Right(1.0) over distance. 平衡調(diào)整: 左(-1.0)到右(1.0)隨距離
Spread: Angle (degrees 0.0 - 360.0) over distance. 擴(kuò)散:角度(0.0到360.0度)隨距離
Low-Pass (only if LowPassFilter is attached to the AudioSource): Cutoff Frequency (22000.0-10.0) over distance.
低通(只有當(dāng)?shù)屯V波器(LowPassFilter)貼到音頻源(AudioSource)上): 低通截止頻率(10.0~22000.0hz)隨距離。

Distance Functions 距離函數(shù)
Distance functions for Volume, Pan, Spread and Low-Pass audio filter. The current distance to the Audio Listener is marked in the graph.

音量,平衡調(diào)整,擴(kuò)散和低通音頻濾波器的距離函數(shù)。當(dāng)前到音頻監(jiān)偵聽器的距離在圖中標(biāo)記。

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

要修改的距離函數(shù),您可以直接編輯曲線。想了解更多信息,請(qǐng)參閱編輯曲線(Editing Curves)的指南。

Creating Audio Sources 創(chuàng)建音頻源

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.

沒有分配音頻剪輯的音頻源不會(huì)播放任何東西。剪輯是實(shí)際的聲音文件,該文件將被播放。音頻源就像是一個(gè)控制器,用于啟動(dòng)和停止播放該剪輯,并修改其他的音頻屬性。

To create a new Audio Source 創(chuàng)建一個(gè)新的音頻源:

  1. Import your audio files into your Unity Project. These are now Audio Clips.
    導(dǎo)入你的音頻文件到Unity項(xiàng)目。這些都是現(xiàn)在的音頻剪輯。
  2. Go to GameObject->Create Empty from the menubar.
    從菜單欄選擇 GameObject->Create Empty
  3. With the new GameObject selected, select Component->Audio->Audio Source.
    隨著新的游戲?qū)ο?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.

注意:如果你想創(chuàng)建一個(gè)音頻源,只需有一個(gè)音頻剪輯(Audio Clip)在你的資源文件夾,你可以拖拽音頻剪輯(Audio Clip)到場(chǎng)景視圖,那么帶有音頻源(Audio Source)的游戲?qū)ο髮⒆詣?dòng)創(chuàng)建。

Platform specific details 平臺(tái)的具體細(xì)節(jié)
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.

在移動(dòng)平臺(tái)上的壓縮音頻以MP3格式編碼為了能快捷解壓。要注意,這種壓縮是可以刪除剪輯結(jié)尾的樣品,并可能打破一個(gè)"完美循環(huán)"的剪輯。確保剪輯是正確的在一個(gè)特定的MP3樣品邊界,避免樣品剪裁(這是執(zhí)行它廣泛被使用的工具)。出于性能方面的原因,音頻剪輯可以使用蘋果的硬件編解碼器進(jìn)行播放。若要啟用它,選上在導(dǎo)入設(shè)置(import settings)的"使用硬件(Use Hardware)"復(fù)選框。有關(guān)詳細(xì)信息,請(qǐng)參閱音頻剪輯(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).

在移動(dòng)平臺(tái)上的壓縮音頻以MP3格式編碼為了能快捷解壓。要注意,這種壓縮是可以刪除剪輯結(jié)尾的樣品,并可能打破一個(gè)"完美循環(huán)"的剪輯。確保剪輯是正確的在一個(gè)特定的MP3樣品邊界,避免樣品剪裁(這是執(zhí)行它廣泛被使用的工具)。

贊0 踩0

未知用戶

2005-2025 朱峰社區(qū) 版權(quán)所有 遼ICP備2021001865號(hào)-1
2005-2025 ZhuFeng Community All Rights Reserved

VIP

朱峰社區(qū)微信公眾號(hào)

回頂部

1.復(fù)制文本發(fā)給您的QQ好友或群、微信等;好友點(diǎn)擊鏈接以后,轉(zhuǎn)發(fā)就成功了。 2.如朋友點(diǎn)擊您的鏈接,您需要需刷新一下才行;同一個(gè)好友僅能點(diǎn)擊一次。
購(gòu)買VIP,觀看所有收費(fèi)教程!!