An {{InvalidStateError}}
must be thrown if the rate is changed to
@@ -7886,6 +7887,27 @@ macros:
tail-time-notes: This node has a tail-time such that this node continues to output non-silent audio with zero input due to the look-ahead delay.
+
+enum MakeupGainOptions {
+ "automatic"
+};
+
+
+
+
+ {{MakeupGainOptions}} Enumeration description
+
+
+ | Enum Value | Description |
+
+
+ |
+ "automatic"
+ |
+ Set the makeup gain as described in [=Computing the makeup gain=].
+ |
+
+
[Exposed=Window]
interface DynamicsCompressorNode : AudioNode {
@@ -7897,6 +7919,7 @@ interface DynamicsCompressorNode : AudioNode {
readonly attribute float reduction;
readonly attribute AudioParam attack;
readonly attribute AudioParam release;
+ readonly attribute AudioParam makeupGain;
};
@@ -7907,13 +7930,26 @@ Constructors
: DynamicsCompressorNode(context, options)
::
+ Let [[internal reduction]]
+ be a private slot on this, that holds a floating point number, in
+ decibels. Set {{[[internal reduction]]}} to 0.0.
+
+ Let [[automatic
+ makeup gain]] be a private slot on this, that
+ holds a boolean. Set {{[[automatic makeup gain]]}} to `true`
+ if the {{DynamicsCompressorOptions/makeupGain}} option is
+ "{{MakeupGainOptions/automatic}}" or unspecified, otherwise set
+ it to `false`.
+
path: audionode-init.include
- Let [[internal reduction]]
- be a private slot on this, that holds a floating point number, in
- decibels. Set {{[[internal reduction]]}} to 0.0.
+ If {{[[automatic makeup gain]]}} is `true`, set the internal slot
+ {{AudioParam/[[current value]]}} of
+ {{DynamicsCompressorNode/makeupGain}} to the return value of
+ computing the makeup gain, converted to decibel.
context: The {{BaseAudioContext}} this new {{DynamicsCompressorNode}} will be associated with.
@@ -7954,6 +7990,29 @@ Attributes
rate-notes: Has [=automation rate constraints=]
+ : makeupGain
+ ::
+ The decibel value of the makeup gain applied to the signal. If
+ {{[[automatic makeup gain]]}} is `true`, this {{AudioParam}}
+ cannot be modified; an
+ {{InvalidStateError}} MUST be thrown if its
+ {{AudioParam/value}} attribute is set, if any [=automation
+ method=], {{AudioParam/cancelScheduledValues()}}, or
+ {{AudioParam/cancelAndHoldAtTime()}} is called on it, or if an
+ {{AudioNode}} is connected to it.
+
+
+ path: audioparam.include
+ macros:
+ default: 0
+ min: most-negative-single-float
+ min-notes: Approximately -3.4028235e38
+ max: \(\approx 771\)
+ max-notes: This value is approximately \(20\ \log_{10} \mathrm{FLT\_MAX}\) where FLT_MAX is the largest {{float}} value.
+ rate: "{{AutomationRate/k-rate}}"
+ rate-notes: Has [=automation rate constraints=]
+
+
: ratio
::
The amount of dB change in input for a 1 dB change in output.
@@ -8017,6 +8076,7 @@ constructing the node.
dictionary DynamicsCompressorOptions : AudioNodeOptions {
float attack = 0.003;
float knee = 30;
+ (float or MakeupGainOptions) makeupGain = "automatic";
float ratio = 12;
float release = 0.25;
float threshold = -24;
@@ -8028,19 +8088,25 @@ Dictionary {{DynamicsCompressorOptions}} Members
: attack
- :: The initial value for the {{DynamicsCompressorNode/attack}} AudioParam.
+ :: The initial value for the {{DynamicsCompressorNode/attack}} {{AudioParam}}.
: knee
- :: The initial value for the {{DynamicsCompressorNode/knee}} AudioParam.
+ :: The initial value for the {{DynamicsCompressorNode/knee}} {{AudioParam}}.
+
+ : makeupGain
+ :: The initial value for the {{DynamicsCompressorNode/makeupGain}}
+ {{AudioParam}}. If set to "{{MakeupGainOptions/automatic}}", the
+ makeup gain will be calculated as described in [=Computing the
+ makeup gain=].
: ratio
- :: The initial value for the {{DynamicsCompressorNode/ratio}} AudioParam.
+ :: The initial value for the {{DynamicsCompressorNode/ratio}} {{AudioParam}}.
: release
- :: The initial value for the {{DynamicsCompressorNode/release}} AudioParam.
+ :: The initial value for the {{DynamicsCompressorNode/release}} {{AudioParam}}.
: threshold
- :: The initial value for the {{DynamicsCompressorNode/threshold}} AudioParam.
+ :: The initial value for the {{DynamicsCompressorNode/threshold}} {{AudioParam}}.
@@ -8142,6 +8208,13 @@ values. Those values persist accros invocation of this algorithm.
sample-rate of the {{BaseAudioContext}} this
{{DynamicsCompressorNode}} is associated with.
+ 1. Let makeup gain be the return value of computing
+ the makeup gain if {{[[automatic makeup gain]]}} is `true`.
+ Otherwise, let makeup gain have the value of
+ {{DynamicsCompressorNode/makeupGain}}, [=decibels to linear gain
+ unit|converted to linear units=] and sampled at the time of
+ processing (as a k-rate parameter).
+
1. Let detector average be the value of the slot {{[[detector average]]}}.
1. Let compressor gain be the value of the slot {{[[compressor gain]]}}.
@@ -8183,8 +8256,7 @@ values. Those values persist accros invocation of this algorithm.
to compressor gain.
9. Compute reduction gain to be compressor
- gain multiplied by the return value of computing the
- makeup gain.
+ gain multiplied by makeup gain.
10. Compute metering gain to be reduction gain, converted to
decibel.
@@ -8200,6 +8272,12 @@ values. Those values persist accros invocation of this algorithm.
Note: This step makes the metering gain update once per block, at the
end of the block processing.
+
+ 1. If {{[[automatic makeup gain]]}} is `true`, atomically set
+ the internal slot {{AudioParam/[[current value]]}} of
+ {{DynamicsCompressorNode/makeupGain}} to the value of
+ makeup gain, converted to
+ decibel.
The makeup gain is a fixed gain stage that only depends on ratio,