AudioCompressor

显示已弃用

*此内容使用人工智能(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

之间的 Wire 和其他实例之间的 AudioCompressor

instance: Instance

连接到 Wire 通过的另一个实例。