AudioSource And Audio Clip

音頻源(Audio Source)在場景中播放音頻剪輯(Audio Clip)驮配。

我還是從權威來看:https://docs.unity3d.com/ScriptReference/AudioSource-clip.html

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 循環(huán)

Enable this to make the Audio Clip loop when it reaches the end.
啟用這個屬性使音頻剪輯(Audio Clip)在播放結束后循環(huán) 兑宇。

Priority
優(yōu)先權

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.
確定場景所有并存的音頻源之間的優(yōu)先權。(0=最重要的優(yōu)先權粱坤。256 =最不重要隶糕。默認為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個世界單位(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聲音設置

Settings that are applied to the audio source if the is a 3D Sound.
如果是一個三維的聲音锉矢,應用到音頻源的設置

Pan Level
平衡調(diào)整級別

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)之內(nèi)绵估,聲音會保持最響亮炎疆。 在最小距離(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
對數(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.
當你接近的音頻源英妓,聲音響亮挽放,但是當你遠離對象,聲音下降顯著快蔓纠。

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.
根據(jù)你設置的衰減圖形腿倚,來自音頻源的聲音行為纯出。

2D Sound Settings
2D聲音設置

Settings that are applied to the audio source if the is a 3D Sound.
如果是一個二維的聲音,應用到音頻源的設置
Pan 2D

2D平衡調(diào)整

Sets how much the engine has an effect on the audio source.
設置多少敷燎,引擎在音頻源上有效果暂筝。

#######注意:如果你想創(chuàng)建一個音頻源,只需有一個音頻剪輯(Audio Clip)在你的資源文件夾硬贯,你可以拖拽音頻剪輯(Audio Clip)到場景視圖焕襟,那么帶有音頻源(Audio Source)的游戲對象將自動創(chuàng)建。

注意:

沒有分配音頻剪輯的音頻源不會播放任何東西饭豹。剪輯是實際的聲音文件鸵赖,該文件將被播放。音頻源就像是一個控制器拄衰,用于啟動和停止播放該剪輯它褪,并修改其他的音頻屬性。

問:那么什么是 Audio Clip 音頻剪輯肾砂?

Audio Clip 音頻剪輯:

被音源所使用來表現(xiàn)被導入到Unity的音頻資產(chǎn)列赎。Unity同時支持單聲道和立體聲音頻資產(chǎn)。Unity支持導入以下音頻文件格式:.aif, .wav, .mp3, 和 .ogg镐确,和以下音軌模塊:.xm, .mod, .it, 和 .s3m包吝。在Unity音軌模塊資源和其他音頻資源一樣,除了無波形預覽渲染到資源導入檢視面板源葫。

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.
較大文件尺寸,較高質(zhì)量息堂。最適用于很短的音效嚷狞。

Compressed 壓縮的:

Smaller file size, lower/variable quality. Best for medium length sound effects and music.
較小文件尺寸,較低/不穩(wěn)定質(zhì)量荣堰。最適用于中等長度音效與音樂床未。

3D Sound 三維聲音:

If enabled, the sound will play back in 3D space. Both Mono and Stereo sounds can be played in 3D.
如果啟用,音樂將在3D空間中播放振坚。在Unity2.6中薇搁,單聲道和立體聲都可以在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.
加載后解壓縮聲音屎鳍。使用于較小的壓縮聲音宏娄,以避免運行時解壓縮的性能開銷。要注意加載時解壓縮聲音將使用比在它們在內(nèi)存中壓縮的多10倍或更多內(nèi)存逮壁,因此不要使用這個到大文件孵坚。

Compressed in memory
在內(nèi)存中壓縮

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.
保持聲音在內(nèi)存中是壓縮的并在播放時解壓縮。這有輕微的性能開銷(尤其是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.
直接從磁盤流音頻數(shù)據(jù)。這只使用了原始聲音占內(nèi)存大小的很小一部分祖乳。使用這個用于很長的音樂逗堵。取決于硬件,一般建議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.
壓縮量應用于壓縮的剪輯蜒秤。有關文件大小的統(tǒng)計可以在之后的滑動條看到⊙钦可以拖動滑條來調(diào)整來調(diào)整大小作媚,播放聲音來判斷音質(zhì),但保持在一個足夠小的尺寸帅刊,以滿足您的文件大小/分配需要纸泡。

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
無縫循環(huán)

(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)當壓縮一個完美的循環(huán)音頻源文件(在一個非壓縮的PCM格式)保持循環(huán)時女揭,使用這個蚤假。標準的MPEG編碼器插入silence循環(huán)點,播放時有小的"click" 或 "pop"(可能是短暫停頓的意思)吧兔。Unity為你順暢處理這個問題磷仰。

最后編輯于
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市境蔼,隨后出現(xiàn)的幾起案子灶平,更是在濱河造成了極大的恐慌,老刑警劉巖箍土,帶你破解...
    沈念sama閱讀 219,188評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件逢享,死亡現(xiàn)場離奇詭異,居然都是意外死亡吴藻,警方通過查閱死者的電腦和手機瞒爬,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,464評論 3 395
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來调缨,“玉大人疮鲫,你說我怎么就攤上這事∠乙叮” “怎么了俊犯?”我有些...
    開封第一講書人閱讀 165,562評論 0 356
  • 文/不壞的土叔 我叫張陵,是天一觀的道長伤哺。 經(jīng)常有香客問我燕侠,道長,這世上最難降的妖魔是什么立莉? 我笑而不...
    開封第一講書人閱讀 58,893評論 1 295
  • 正文 為了忘掉前任绢彤,我火速辦了婚禮,結果婚禮上蜓耻,老公的妹妹穿的比我還像新娘茫舶。我一直安慰自己,他們只是感情好刹淌,可當我...
    茶點故事閱讀 67,917評論 6 392
  • 文/花漫 我一把揭開白布饶氏。 她就那樣靜靜地躺著,像睡著了一般有勾。 火紅的嫁衣襯著肌膚如雪疹启。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,708評論 1 305
  • 那天蔼卡,我揣著相機與錄音喊崖,去河邊找鬼。 笑死,一個胖子當著我的面吹牛荤懂,可吹牛的內(nèi)容都是我干的茁裙。 我是一名探鬼主播,決...
    沈念sama閱讀 40,430評論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼势誊,長吁一口氣:“原來是場噩夢啊……” “哼呜达!你這毒婦竟也來了谣蠢?” 一聲冷哼從身側響起粟耻,我...
    開封第一講書人閱讀 39,342評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎眉踱,沒想到半個月后挤忙,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,801評論 1 317
  • 正文 獨居荒郊野嶺守林人離奇死亡谈喳,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,976評論 3 337
  • 正文 我和宋清朗相戀三年册烈,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片婿禽。...
    茶點故事閱讀 40,115評論 1 351
  • 序言:一個原本活蹦亂跳的男人離奇死亡赏僧,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出扭倾,到底是詐尸還是另有隱情淀零,我是刑警寧澤,帶...
    沈念sama閱讀 35,804評論 5 346
  • 正文 年R本政府宣布膛壹,位于F島的核電站驾中,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏模聋。R本人自食惡果不足惜肩民,卻給世界環(huán)境...
    茶點故事閱讀 41,458評論 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望链方。 院中可真熱鬧持痰,春花似錦、人聲如沸祟蚀。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,008評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽暂题。三九已至移剪,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間薪者,已是汗流浹背纵苛。 一陣腳步聲響...
    開封第一講書人閱讀 33,135評論 1 272
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人攻人。 一個月前我還...
    沈念sama閱讀 48,365評論 3 373
  • 正文 我出身青樓取试,卻偏偏與公主長得像,于是被迫代替她去往敵國和親怀吻。 傳聞我的和親對象是個殘疾皇子瞬浓,可洞房花燭夜當晚...
    茶點故事閱讀 45,055評論 2 355

推薦閱讀更多精彩內(nèi)容