Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 91 additions & 13 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3480,7 +3480,7 @@ is called on.
factory method).

1. If <var>k</var> is the name of an {{AudioParam}} on this
interface, set the {{AudioParam/value}}
interface, then if <var>v</var> is of a [=numeric type=], set the {{AudioParam/value}}
attribute of this {{AudioParam}} to <var>v</var>.

2. Else if <var>k</var> is the name of an attribute on this
Expand Down Expand Up @@ -4248,8 +4248,9 @@ Attributes</h4>
{{DynamicsCompressorNode/threshold}},
{{DynamicsCompressorNode/knee}},
{{DynamicsCompressorNode/ratio}},
{{DynamicsCompressorNode/attack}}, and
{{DynamicsCompressorNode/release}}
{{DynamicsCompressorNode/attack}},
{{DynamicsCompressorNode/release}}, and
{{DynamicsCompressorNode/makeupGain}}
MUST be "{{AutomationRate/k-rate}}". <span
class="synchronous">An {{InvalidStateError}}
must be thrown if the rate is changed to
Expand Down Expand Up @@ -7886,6 +7887,27 @@ macros:
tail-time-notes: This node has a <a>tail-time</a> such that this node continues to output non-silent audio with zero input due to the look-ahead delay.
</pre>

<xmp class="idl">
enum MakeupGainOptions {
"automatic"
};
</xmp>

<div class="enum-description">
<table class="simple" dfn-type=enum-value dfn-for="MakeupGainOptions">
<caption>{{MakeupGainOptions}} Enumeration description</caption>
<thead>
<tr>
<th>Enum Value</th><th>Description</th>
<tbody>
<tr>
<td>
"<dfn>automatic</dfn>"
<td>
Set the makeup gain as described in [=Computing the makeup gain=].
</table>
</div>

<xmp class="idl">
[Exposed=Window]
interface DynamicsCompressorNode : AudioNode {
Expand All @@ -7897,6 +7919,7 @@ interface DynamicsCompressorNode : AudioNode {
readonly attribute float reduction;
readonly attribute AudioParam attack;
readonly attribute AudioParam release;
readonly attribute AudioParam makeupGain;
};
</xmp>

Expand All @@ -7907,13 +7930,26 @@ Constructors</h4>
: <dfn>DynamicsCompressorNode(context, options)</dfn>
::

Let <dfn attribute for="DynamicsCompressorNode">[[internal reduction]]</dfn>
be a private slot on <var>this</var>, that holds a floating point number, in
decibels. Set {{[[internal reduction]]}} to 0.0.

Let <dfn attribute for="DynamicsCompressorNode">[[automatic
makeup gain]]</dfn> be a private slot on <var>this</var>, 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`.

<pre class=include>
path: audionode-init.include
</pre>

Let <dfn attribute for="DynamicsCompressorNode">[[internal reduction]]</dfn>
be a private slot on <var>this</var>, 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
<a>computing the makeup gain</a>, <a
href="#linear-to-decibel">converted to decibel</a>.

<pre class=argumentdef for="DynamicsCompressorNode/constructor()">
context: The {{BaseAudioContext}} this new {{DynamicsCompressorNode}} will be <a href="#associated">associated</a> with.
Expand Down Expand Up @@ -7954,6 +7990,29 @@ Attributes</h4>
rate-notes: Has [=automation rate constraints=]
</pre>

: <dfn>makeupGain</dfn>
::
The decibel value of the makeup gain applied to the signal. If
{{[[automatic makeup gain]]}} is `true`, this {{AudioParam}}
cannot be modified; <span class="synchronous">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</span>.

<pre class=include>
path: audioparam.include
macros:
default: 0
min: <a>most-negative-single-float</a>
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=]
</pre>

: <dfn>ratio</dfn>
::
The amount of dB change in input for a 1 dB change in output.
Expand Down Expand Up @@ -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;
Expand All @@ -8028,19 +8088,25 @@ Dictionary {{DynamicsCompressorOptions}} Members</h5>

<dl dfn-type=dict-member dfn-for="DynamicsCompressorOptions">
: <dfn>attack</dfn>
:: The initial value for the {{DynamicsCompressorNode/attack}} AudioParam.
:: The initial value for the {{DynamicsCompressorNode/attack}} {{AudioParam}}.

: <dfn>knee</dfn>
:: The initial value for the {{DynamicsCompressorNode/knee}} AudioParam.
:: The initial value for the {{DynamicsCompressorNode/knee}} {{AudioParam}}.

: <dfn>makeupGain</dfn>
:: 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=].

: <dfn>ratio</dfn>
:: The initial value for the {{DynamicsCompressorNode/ratio}} AudioParam.
:: The initial value for the {{DynamicsCompressorNode/ratio}} {{AudioParam}}.

: <dfn>release</dfn>
:: The initial value for the {{DynamicsCompressorNode/release}} AudioParam.
:: The initial value for the {{DynamicsCompressorNode/release}} {{AudioParam}}.

: <dfn>threshold</dfn>
:: The initial value for the {{DynamicsCompressorNode/threshold}} AudioParam.
:: The initial value for the {{DynamicsCompressorNode/threshold}} {{AudioParam}}.
</dl>

<h4 id="DynamicsCompressorOptions-processing">
Expand Down Expand Up @@ -8142,6 +8208,13 @@ values. Those values persist accros invocation of this algorithm.
sample-rate of the {{BaseAudioContext}} this
{{DynamicsCompressorNode}} is <a href="#associated">associated</a> with.

1. Let <var>makeup gain</var> be the return value of <a>computing
the makeup gain</a> if {{[[automatic makeup gain]]}} is `true`.
Otherwise, let <var>makeup gain</var> have the value of
{{DynamicsCompressorNode/makeupGain}}, [=decibels to linear gain
unit|converted to linear units=] and sampled at the time of
processing (as a <a>k-rate</a> parameter).

1. Let <var>detector average</var> be the value of the slot {{[[detector average]]}}.

1. Let <var>compressor gain</var> be the value of the slot {{[[compressor gain]]}}.
Expand Down Expand Up @@ -8183,8 +8256,7 @@ values. Those values persist accros invocation of this algorithm.
to <var>compressor gain</var>.

9. Compute <var>reduction gain</var> to be <var>compressor
gain</var> multiplied by the return value of <a>computing the
makeup gain</a>.
gain</var> multiplied by <var>makeup gain</var>.

10. Compute <var>metering gain</var> to be <var>reduction gain</var>, <a href="#linear-to-decibel">converted to
decibel</a>.
Expand All @@ -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`, <a>atomically</a> set
the internal slot {{AudioParam/[[current value]]}} of
{{DynamicsCompressorNode/makeupGain}} to the value of
<var>makeup gain</var>, <a href="#linear-to-decibel">converted to
decibel</a>.
</div>

The makeup gain is a fixed gain stage that only depends on ratio,
Expand Down
Loading