音頻源(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為你順暢處理這個問題磷仰。