From 9841eb9131ef5512fcf637ee21b56dd9917b36cb Mon Sep 17 00:00:00 2001 From: Michael Wilson Date: Fri, 15 Aug 2025 15:55:46 -0700 Subject: [PATCH 1/3] Specify DynamicsCompressorNode makeup gain control --- index.bs | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index 87303693d..1a8d2a10e 100644 --- a/index.bs +++ b/index.bs @@ -7885,6 +7885,28 @@ 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. + +<xmp class="idl"> +enum MakeupGainOptions { + "automatic" +}; + + +
+ + + + + + + +
{{MakeupGainOptions}} Enumeration description
Enum ValueDescription
+ "automatic" + + Set the makeup gain as described in [=Computing the makeup gain=]. +
+
+ [Exposed=Window] interface DynamicsCompressorNode : AudioNode { @@ -7896,6 +7918,7 @@ interface DynamicsCompressorNode : AudioNode { readonly attribute float reduction; readonly attribute AudioParam attack; readonly attribute AudioParam release; + readonly attribute AudioParam makeupGain; }; @@ -7914,6 +7937,12 @@ Constructors 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 makeupGain option is {{MakeupGainOptions/automatic}} or + unspeficied, otherwise set it to `false`. +
             context: The {{BaseAudioContext}} this new {{DynamicsCompressorNode}} will be associated with.
             options: Optional initial parameter value for this {{DynamicsCompressorNode}}.
@@ -8002,6 +8031,25 @@ Attributes
             rate: "{{AutomationRate/k-rate}}"
             rate-notes: Has [=automation rate constraints=]
         
+ + : makeupGain + :: + The decibel value of the makeup gain applied to the signal. If + this attribute is written to or any automation events are + scheduled on it, set {{[[automatic makeup gain]]}} to `false`. + +
+        path: audioparam.include
+        macros:
+            default: 0
+            default-notes: Will be reset during object creation
+            min: most-negative-single-float
+            min-notes: Approximately -3.4028235e38
+            max: \(\approx 1541\)
+            max-notes: This value is approximately \(40\ \log_{10} \mathrm{FLT\_MAX}\) where FLT_MAX is the largest {{float}} value.
+            rate: "{{AutomationRate/k-rate}}"
+            rate-notes: Has [=automation rate constraints=]
+        

@@ -8019,6 +8067,7 @@ dictionary DynamicsCompressorOptions : AudioNodeOptions { float ratio = 12; float release = 0.25; float threshold = -24; + (float or MakeupGainOptions) makeupGain = "automatic"; }; @@ -8040,6 +8089,12 @@ Dictionary {{DynamicsCompressorOptions}} Members

: threshold :: The initial value for the {{DynamicsCompressorNode/threshold}} 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=].

@@ -8181,9 +8236,12 @@ values. Those values persist accros invocation of this algorithm. increment by envelope rate, and add the result to compressor gain. - 9. Compute reduction gain to be compressor - gain multiplied by the return value of computing the - makeup gain. + 9. If {{[[automatic makeup gain]]}} is true, set + {{DynamicsCompressorNode/makeupGain}} to the return value + of computing the makeup gain + + 10. Compute reduction gain to be compressor + gain multiplied by {{DynamicsCompressorNode/makeupGain}}. 10. Compute metering gain to be reduction gain, converted to decibel. From d04b63725013450d5777221f8c132bff0f006fbf Mon Sep 17 00:00:00 2001 From: Michael Wilson Date: Fri, 15 Aug 2025 16:02:53 -0700 Subject: [PATCH 2/3] Fix indentation --- index.bs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index 1a8d2a10e..694baa5ae 100644 --- a/index.bs +++ b/index.bs @@ -8092,9 +8092,9 @@ Dictionary {{DynamicsCompressorOptions}} Members

: 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=]. + AudioParam. If set to {{MakeupGainOptions/automatic}}, the + makeup gain will be calculated as described in [=Computing the + makeup gain=].

From 7c8429d7798a6557e0c7a120432b785292a0c07c Mon Sep 17 00:00:00 2001 From: Michael Wilson Date: Sun, 25 Oct 2026 04:29:28 -0700 Subject: [PATCH 3/3] Revise based on notes --- index.bs | 114 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 47 deletions(-) diff --git a/index.bs b/index.bs index 694baa5ae..978cf4698 100644 --- a/index.bs +++ b/index.bs @@ -3479,7 +3479,7 @@ is called on. factory method). 1. If k is the name of an {{AudioParam}} on this - interface, set the {{AudioParam/value}} + interface, then if v is of a [=numeric type=], set the {{AudioParam/value}} attribute of this {{AudioParam}} to v. 2. Else if k is the name of an attribute on this @@ -4247,8 +4247,9 @@ Attributes

{{DynamicsCompressorNode/threshold}}, {{DynamicsCompressorNode/knee}}, {{DynamicsCompressorNode/ratio}}, - {{DynamicsCompressorNode/attack}}, and - {{DynamicsCompressorNode/release}} + {{DynamicsCompressorNode/attack}}, + {{DynamicsCompressorNode/release}}, and + {{DynamicsCompressorNode/makeupGain}} MUST be "{{AutomationRate/k-rate}}". An {{InvalidStateError}} must be thrown if the rate is changed to @@ -7885,7 +7886,6 @@ 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. - <xmp class="idl"> enum MakeupGainOptions { "automatic" @@ -7929,10 +7929,6 @@ Constructors</h4> : <dfn>DynamicsCompressorNode(context, options)</dfn> :: - <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. @@ -7940,8 +7936,19 @@ Constructors</h4> 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 makeupGain option is {{MakeupGainOptions/automatic}} or - unspeficied, otherwise set it to `false`. + if the {{DynamicsCompressorOptions/makeupGain}} option is + "{{MakeupGainOptions/automatic}}" or unspecified, otherwise set + it to `false`. + + <pre class=include> + path: audionode-init.include + </pre> + + 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. @@ -7982,6 +7989,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. @@ -8031,25 +8061,6 @@ Attributes</h4> rate: "{{AutomationRate/k-rate}}" rate-notes: Has [=automation rate constraints=] </pre> - - : <dfn>makeupGain</dfn> - :: - The decibel value of the makeup gain applied to the signal. If - this attribute is written to or any automation events are - scheduled on it, set {{[[automatic makeup gain]]}} to `false`. - - <pre class=include> - path: audioparam.include - macros: - default: 0 - default-notes: Will be reset during object creation - min: <a>most-negative-single-float</a> - min-notes: Approximately -3.4028235e38 - max: \(\approx 1541\) - max-notes: This value is approximately \(40\ \log_{10} \mathrm{FLT\_MAX}\) where FLT_MAX is the largest {{float}} value. - rate: "{{AutomationRate/k-rate}}" - rate-notes: Has [=automation rate constraints=] - </pre> </dl> <h4 dictionary id="DynamicsCompressorOptions"> @@ -8064,10 +8075,10 @@ 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; - (float or MakeupGainOptions) makeupGain = "automatic"; }; @@ -8076,25 +8087,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. - - : 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=]. + :: The initial value for the {{DynamicsCompressorNode/threshold}} {{AudioParam}}.

@@ -8196,6 +8207,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]]}}. @@ -8236,12 +8254,8 @@ values. Those values persist accros invocation of this algorithm. increment by envelope rate, and add the result to compressor gain. - 9. If {{[[automatic makeup gain]]}} is true, set - {{DynamicsCompressorNode/makeupGain}} to the return value - of computing the makeup gain - - 10. Compute reduction gain to be compressor - gain multiplied by {{DynamicsCompressorNode/makeupGain}}. + 9. Compute reduction gain to be compressor + gain multiplied by makeup gain. 10. Compute metering gain to be reduction gain, converted to decibel. @@ -8257,6 +8271,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,