AudioCompressor

顯示已棄用項目

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

AudioCompressor 調整音頻流的動態範圍。任何瞬間爆炸的音量將根據壓縮機的特性進行限制。

AudioCompressor 提供 輸入側鏈 彈簧,可以被 Wire.TargetName 瞄準,以及 輸出 彈簧,可以被 Wire.SourceName 使用。

範例程式碼

By using Sidechain compression, the background ambience can be ducked around an explosion

Sidechain Compression

local deviceOutput: AudioDeviceOutput = Instance.new("AudioDeviceOutput")
deviceOutput.Parent = workspace
local explosionPlayer: AudioPlayer = Instance.new("AudioPlayer")
explosionPlayer.Parent = workspace
explosionPlayer.AssetId = "rbxassetid://1835333184"
local ambiencePlayer = Instance.new("AudioPlayer")
ambiencePlayer.AssetId = "rbxassetid://9112854440"
local compressor = Instance.new("AudioCompressor")
local wireToCompressor = Instance.new("Wire")
local wireToSidechain = Instance.new("Wire")
local wireToOutput = Instance.new("Wire")
ambiencePlayer.Parent = workspace
compressor.Parent = workspace
wireToCompressor.Parent = workspace
wireToSidechain.Parent = workspace
wireToOutput.Parent = workspace
wireToCompressor.SourceInstance = ambiencePlayer
wireToCompressor.TargetInstance = compressor
wireToSidechain.SourceInstance = explosionPlayer
wireToSidechain.TargetInstance = compressor
wireToSidechain.TargetName = "Sidechain"
wireToOutput.SourceInstance = compressor
wireToOutput.TargetInstance = deviceOutput
ambiencePlayer:Play()

概要

屬性

活動

屬性

Attack

平行讀取

時間,以秒為單位,表示壓縮機在超過 Threshold 後對音量的緊縮速度。範圍為 0.001 到 0.5。

Bypass

平行讀取

如果 true,音頻流將無受此效果影響地通過。

Editor

未複製
Roblox 指令碼安全性
平行讀取

MakeupGain

平行讀取

在壓縮後獲得應用值,以十分贝計算。限制動態範圍之後,結果的流可能很靜,此屬性可用於補償。範圍為 -30 到 30。

Ratio

平行讀取

輸入音量到輸出音量的比率,在超過 Threshold 時應用。例如,值 2 會在輸入流做出時,將輸入流超過閾值的數量減半,每次輸入流這麼做。範圍為 1 到 50。

Release

平行讀取

時間,以秒為單位,表示壓縮機在其傳輸量跌至 Threshold 以下之後的緩解速度。範圍為 0.01 到 0.5。

Threshold

平行讀取

在壓縮機開始修改輸入串流的值,以十分贝計,範圍為 -60 到 0。當輸入串流的音量超過 Threshold 時,壓縮機需要 Attack 秒才能開始運作。當輸入串流的音量退至 Threshold 以下時,壓縮機會花費 Release 秒停止作用。

如果任何 連接到壓縮機的 Sidechain 引腳,此閾值會分析這些流而不是輸入流;這可以用來在回應另一個流之後減少一個流的音量。

方法

GetConnectedWires

Instances

返回與指定頂置頂連接的 Wires 數組。 AudioCompressor 有一個「輸入」置頂、一個「側鏈」置頂和一個「輸出」頂置頂。

參數

pin: string
預設值:""

返回

Instances

GetInputPins


返回

GetOutputPins


返回

活動

WiringChanged

Wire 連接或解除連接後發生的事件,該 Wire 現在或之前已連接到 AudioCompressor 上的某個彈片或其他可連接的個體、實例。

參數

connected: boolean

是否連接或解除連接實例。

pin: string

AudioCompressor 上的彈簧,用於 Wire 目標。

wire: Wire

之間的 WireAudioCompressor 和其他實個體、實例之間。

instance: Instance

通過 Wire 連接的另一個實例,或是已連接的實例。