AudioCompressor
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
AudioCompressor オーディオストリームの動的範囲を調整します。任意の音量の一時的なバーストは、コンプレッサーのプロパティに従って抑えられます。
AudioCompressor は、 入力 および サイドチェーン ピンを提供し、Wire.TargetName にターゲットにでき、 出力 ピンを Wire.SourceName に使用できます。
コードサンプル
By using Sidechain compression, the background ambience can be ducked around an explosion
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()
プロパティ
Editor
Ratio
入力ボリューム対出力ボリュームの比率、Threshold を超えると適用されます。たとえば、2 の値は、入力ストリームがそうするたびに、入力ストリームが境界を半分超える量を削減します。1から50までの範囲。
Threshold
コンプレッサーが入力ストリームを変更開始する値を、デシベルで、範囲 -60 から 0 まで獲得する入力ストリームのボリュームが Threshold を超えると、コンプレッサーが起動するまでに Attack 秒かかります。入力ストリームのボリュームが Threshold 以下に減少すると、コンプレッサーは動作を停止するまで Release 秒かかります。
任意の Wires がコンプレッサーの サイドチェーン ピンに接続されている場合、この境界値は、 入力 ストリームではなく、それらのストリームを分析します;これを使用すると、他のストリームに応答して1つのストリームのボリュームをダックできます。
方法
イベント
WiringChanged
Wire が接続または切断された後に発生するイベント、および Wire が現在または以前に AudioCompressor および他のワイヤー可能なインスタンスのピンに接続されているか、接続されていました。