From 18f99355e95f5a13aad3cb70376a0eb607340bdd Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 16 Jan 2026 17:09:50 +0100 Subject: [PATCH] Use for examples This is more comfortable to write e.g. comparisons (< instead of `&lt;` in the code). This fixes #2429. --- index.bs | 666 +++++++++++++++++++++++++++---------------------------- 1 file changed, 333 insertions(+), 333 deletions(-) diff --git a/index.bs b/index.bs index 9da6cb2c0..8fd78ba8d 100644 --- a/index.bs +++ b/index.bs @@ -388,7 +388,7 @@ containing a single {{AudioDestinationNode}}: Illustrating this simple routing, here's a simple example playing a single sound: -<pre class="example" highlight="js"> +<xmp class="example" highlight="js"> const context = new AudioContext(); function playSound() { @@ -397,7 +397,7 @@ function playSound() { source.connect(context.destination); source.start(0); } -</pre> + Here's a more complex example with three sources and a convolution reverb send with a dynamics compressor at the final output stage: @@ -409,7 +409,7 @@ reverb send with a dynamics compressor at the final output stage: -
+
 let context;
 let compressor;
 let reverb;
@@ -491,7 +491,7 @@ function setupRoutingGraph () {
     source2.start(0);
     source3.start(0);
 }
-</pre>
+
 
 Modular routing also permits the output of
 {{AudioNode}}s to be routed to an
@@ -509,7 +509,7 @@ input signal.
     
 
 
-
+
 function setupRoutingGraph() {
     const context = new AudioContext();
 
@@ -532,7 +532,7 @@ function setupRoutingGraph() {
     hfo.start(0);
     lfo.start(0);
 }
-</pre>
+
 
 

API Overview

@@ -719,14 +719,14 @@ from {{AudioContextState}}, and that are both initially set to "suspended" `null` and a private slot [[render quantum size]] that is an unsigned integer. -
+
 enum AudioContextState {
     "suspended",
     "running",
     "closed",
     "interrupted"
 };
-</pre>
+
 
 
@@ -761,12 +761,12 @@ enum AudioContextState {
-
+
  enum AudioContextRenderSizeCategory {
     "default",
     "hardware"
 };
-</pre>
+
 
 
@@ -1425,13 +1425,13 @@ output device that produces a signal directed at the user. In most use cases, only a single {{AudioContext}} is used per document. -
+
 enum AudioContextLatencyCategory {
         "balanced",
         "interactive",
         "playback"
 };
-</pre>
+
 
 
@@ -1460,11 +1460,11 @@ enum AudioContextLatencyCategory {
-
+
 enum AudioSinkType {
     "none"
 };
-</pre>
+
 
 
@@ -1954,13 +1954,13 @@ Methods method can be used to get performance time estimation for the slightly later context's time value: -
+            
                 function outputPerformanceTime(contextTime) {
                     const timestamp = context.getOutputTimestamp();
                     const elapsedTime = contextTime - timestamp.contextTime;
                     return timestamp.performanceTime + elapsedTime * 1000;
                 }
-            </pre>
+            
 
             In the above example the accuracy of the estimation depends on
             how close the argument value is to the current output audio
@@ -2333,14 +2333,14 @@ This algorithm is used to validate the information provided to modify
 The {{AudioContextOptions}} dictionary is used to
 specify user-specified options for an {{AudioContext}}.
 
-
+
     dictionary AudioContextOptions {
         (AudioContextLatencyCategory or double) latencyHint = "interactive";
         float sampleRate;
         (DOMString or AudioSinkOptions) sinkId;
         (AudioContextRenderSizeCategory or unsigned long) renderSizeHint = "default";
     };
-</pre>
+
 
 
Dictionary {{AudioContextOptions}} Members
@@ -2390,11 +2390,11 @@ Dictionary {{AudioContextOptions}} Members The {{AudioSinkOptions}} dictionary is used to specify options for {{AudioContext/sinkId}}. -
+
 dictionary AudioSinkOptions {
     required AudioSinkType type;
 };
-</pre>
+
 
 
Dictionary {{AudioSinkOptions}} Members
@@ -2411,12 +2411,12 @@ Dictionary {{AudioSinkOptions}} Members The {{AudioSinkInfo}} interface is used to get information on the current audio output device via {{AudioContext/sinkId}}. -
+
 [Exposed=Window]
 interface AudioSinkInfo {
     readonly attribute AudioSinkType type;
 };
-</pre>
+
 
 
Attributes
@@ -2430,12 +2430,12 @@ Attributes

{{AudioTimestamp}}

-
+
 dictionary AudioTimestamp {
     double contextTime;
     DOMHighResTimeStamp performanceTime;
 };
-</pre>
+
 
 
Dictionary {{AudioTimestamp}} Members
@@ -2558,13 +2558,13 @@ Constructors The OfflineAudioContext is constructed as if -
+        
             new OfflineAudioContext({
                     numberOfChannels: numberOfChannels,
                     length: length,
                     sampleRate: sampleRate
             })
-        </pre>
+        
 
         were called instead.
 
@@ -2785,14 +2785,14 @@ Methods
 This specifies the options to use in constructing an
 {{OfflineAudioContext}}.
 
-
+
 dictionary OfflineAudioContextOptions {
     unsigned long numberOfChannels = 1;
     required unsigned long length;
     required float sampleRate;
     (AudioContextRenderSizeCategory or unsigned long) renderSizeHint = "default";
 };
-</pre>
+
 
 
Dictionary {{OfflineAudioContextOptions}} Members
@@ -2823,13 +2823,13 @@ The {{OfflineAudioCompletionEvent}} Interface This is an {{Event}} object which is dispatched to {{OfflineAudioContext}} for legacy reasons. -
+
 [Exposed=Window]
 interface OfflineAudioCompletionEvent : Event {
     constructor (DOMString type, OfflineAudioCompletionEventInit eventInitDict);
     readonly attribute AudioBuffer renderedBuffer;
 };
-</pre>
+
 
 
Attributes
@@ -2843,11 +2843,11 @@ Attributes
{{OfflineAudioCompletionEventInit}}
-
+
 dictionary OfflineAudioCompletionEventInit : EventInit {
     required AudioBuffer renderedBuffer;
 };
-</pre>
+
 
 
Dictionary {{OfflineAudioCompletionEventInit}} Members
@@ -2906,7 +2906,7 @@ An {{AudioBuffer}} may be used by one or more A [=data block=] holding the audio sample data. -
+
 [Exposed=Window]
 interface AudioBuffer {
     constructor (AudioBufferOptions options);
@@ -2922,7 +2922,7 @@ interface AudioBuffer {
                              unsigned long channelNumber,
                              optional unsigned long bufferOffset = 0);
 };
-</pre>
+
 
 

Constructors

@@ -3134,13 +3134,13 @@ This specifies the options to use in constructing an {{AudioBuffer}}. The {{AudioBufferOptions/length}} and {{AudioBufferOptions/sampleRate}} members are required. -
+
 dictionary AudioBufferOptions {
     unsigned long numberOfChannels = 1;
     required unsigned long length;
     required float sampleRate;
 };
-</pre>
+
 
 
Dictionary {{AudioBufferOptions}} Members
@@ -3215,7 +3215,7 @@ The processing of inputs and the internal operations of an connected outputs, and regardless of whether these outputs ultimately reach an {{AudioContext}}'s {{AudioDestinationNode}}. -
+
 [Exposed=Window]
 interface AudioNode : EventTarget {
     AudioNode connect (AudioNode destinationNode,
@@ -3238,7 +3238,7 @@ interface AudioNode : EventTarget {
     attribute ChannelCountMode channelCountMode;
     attribute ChannelInterpretation channelInterpretation;
 };
-</pre>
+
 
 

AudioNode Creation

@@ -3315,13 +3315,13 @@ This means that it is possible to dispatch events to {{AudioNode}}s the same way that other {{EventTarget}}s accept events. -
+
 enum ChannelCountMode {
     "max",
     "clamped-max",
     "explicit"
 };
-</pre>
+
 
 The {{ChannelCountMode}}, in conjuction with the node's
 {{AudioNode/channelCount}} and {{AudioNode/channelInterpretation}} values, is used to determine
@@ -3357,12 +3357,12 @@ mixing is to be done.
 
-
+
 enum ChannelInterpretation {
     "speakers",
     "discrete"
 };
-</pre>
+
 
 
@@ -3641,16 +3641,16 @@ Methods
For example: -
+            
                 nodeA.connect(nodeB);
                 nodeA.connect(nodeB);
-            </pre>
+            
 
             will have the same effect as
 
-            
+            
                 nodeA.connect(nodeB);
-            </pre>
+            
         
This method returns destination @@ -3703,16 +3703,16 @@ Methods
For example: -
+            
                 nodeA.connect(param);
                 nodeA.connect(param);
-            </pre>
+            
 
             will have the same effect as
 
-            
+            
                 nodeA.connect(param);
-            </pre>
+            
         
@@ -3836,13 +3836,13 @@ This specifies the options that can be used in constructing all
 {{AudioNode}}s. All members are optional. However, the specific
 values used for each node depends on the actual node.
 
-
+
 dictionary AudioNodeOptions {
     unsigned long channelCount;
     ChannelCountMode channelCountMode;
     ChannelInterpretation channelInterpretation;
 };
-</pre>
+
 
 
Dictionary {{AudioNodeOptions}} Members
@@ -3978,12 +3978,12 @@ The automation rate of an {{AudioParam}} can be selected setting the values. However, some {{AudioParam}}s have constraints on whether the automation rate can be changed. -
+
 enum AutomationRate {
     "a-rate",
     "k-rate"
 };
-</pre>
+
 
 
@@ -4016,7 +4016,7 @@ enum AutomationRate { Each {{AudioParam}} has an internal slot [[current value]], initially set to the {{AudioParam}}'s {{AudioParam/defaultValue}}. -
+
 [Exposed=Window]
 interface AudioParam {
     attribute float value;
@@ -4028,13 +4028,13 @@ interface AudioParam {
     AudioParam linearRampToValueAtTime (float value, double endTime);
     AudioParam exponentialRampToValueAtTime (float value, double endTime);
     AudioParam setTargetAtTime (float target, double startTime, float timeConstant);
-    AudioParam setValueCurveAtTime (sequence&lt;float> values,
+    AudioParam setValueCurveAtTime (sequence<float> values,
                                     double startTime,
                                     double duration);
     AudioParam cancelScheduledValues (double cancelTime);
     AudioParam cancelAndHoldAtTime (double cancelTime);
 };
-</pre>
+
 
 

Attributes

@@ -4247,11 +4247,11 @@ Methods the {{AudioParam/exponentialRampToValueAtTime()/endTime!!argument}} parameter passed into this method) will be calculated as: -
+        
         $$
             v(t) = V_0 \left(\frac{V_1}{V_0}\right)^\frac{t - T_0}{T_1 - T_0}
         $$
-        </pre>
+        
 
         where \(V_0\) is the value at the time \(T_0\) and \(V_1\) is
         the {{AudioParam/exponentialRampToValueAtTime()/value!!argument}} parameter passed into this method. If
@@ -4304,11 +4304,11 @@ Methods
         the {{AudioParam/linearRampToValueAtTime()/endTime!!argument}} parameter passed into this method)
         will be calculated as:
 
-        
+        
         $$
             v(t) = V_0 + (V_1 - V_0) \frac{t - T_0}{T_1 - T_0}
         $$
-        </pre>
+        
 
         where \(V_0\) is the value at the time \(T_0\) and \(V_1\) is
         the {{AudioParam/linearRampToValueAtTime()/value!!argument}} parameter passed into this method.
@@ -4357,11 +4357,11 @@ Methods
         During the time interval: \(T_0 \leq t\), where \(T_0\) is the
         {{AudioParam/setTargetAtTime()/startTime!!argument}} parameter:
 
-        
+        
         $$
             v(t) = V_1 + (V_0 - V_1)\, e^{-\left(\frac{t - T_0}{\tau}\right)}
         $$
-        </pre>
+        
 
         where \(V_0\) is the initial value (the {{[[current value]]}}
         attribute) at \(T_0\) (the {{AudioParam/setTargetAtTime()/startTime!!argument}} parameter),
@@ -4400,11 +4400,11 @@ Methods
         LinearRampToValue or ExponentialRampToValue,
         then, for \(T_0 \leq t < T_1\):
 
-        
+        
         $$
             v(t) = V
         $$
-        </pre>
+        
 
         In other words, the value will remain constant during this time
         interval, allowing the creation of "step" functions.
@@ -4435,12 +4435,12 @@ Methods
         and \(N\) be the length of the {{AudioParam/setValueCurveAtTime()/values!!argument}} array. Then,
         during the time interval: \(T_0 \le t < T_0 + T_D\), let
 
-        
+        
         $$
             \begin{align*} k &amp;= \left\lfloor \frac{N - 1}{T_D}(t-T_0) \right\rfloor \\
             \end{align*}
         $$
-        </pre>
+        
 
         Then \(v(t)\) is computed by linearly interpolating between
         \(V[k]\) and \(V[k+1]\),
@@ -4533,11 +4533,11 @@ the clamping done as specified above.
     For example, consider a node \(N\) has an AudioParam \(p\) with a
     nominal range of \([0, 1]\), and following automation sequence
 
-    
+    
         N.p.setValueAtTime(0, 0);
         N.p.linearRampToValueAtTime(4, 1);
         N.p.linearRampToValueAtTime(0, 2);
-    </pre>
+    
 
     The initial slope of the curve is 4, until it reaches the maximum
     value of 1, at which time, the output is held constant. Finally,
@@ -4569,10 +4569,10 @@ http://googlechrome.github.io/web-audio-samples/samples/audio/timeline.html -->
         An example of parameter automation.
     
 
-
+
     const curveLength = 44100;
     const curve = new Float32Array(curveLength);
-    for (const i = 0; i &lt; curveLength; ++i)
+    for (const i = 0; i < curveLength; ++i)
         curve[i] = Math.sin(Math.PI * i / curveLength);
 
     const t0 = 0;
@@ -4601,7 +4601,7 @@ http://googlechrome.github.io/web-audio-samples/samples/audio/timeline.html -->
     param.exponentialRampToValueAtTime(0.75, t6);
     param.exponentialRampToValueAtTime(0.05, t7);
     param.setValueCurveAtTime(curve, t7, t8 - t7);
-</pre>
+
 
 
 
-    
+    
     $$
     \begin{align*}
         A &amp;= 10^{\frac{G}{40}} \\
@@ -6757,14 +6757,14 @@ their computation, based on the <a>computedValue</a> of the
         \alpha_S &amp;= \frac{\sin\omega_0}{2}\sqrt{\left(A+\frac{1}{A}\right)\left(\frac{1}{S}-1\right)+2}
     \end{align*}
     $$
-    </pre>
+    
 
 The six coefficients (\(b_0, b_1, b_2, a_0, a_1, a_2\)) for each
 filter type, are:
 
 : "{{lowpass}}"
 ::
-    
+    
     $$
         \begin{align*}
             b_0 &amp;= \frac{1 - \cos\omega_0}{2} \\
@@ -6775,11 +6775,11 @@ filter type, are:
             a_2 &amp;= 1 - \alpha_{Q_{dB}}
         \end{align*}
     $$
-    </pre>
+    
 
 : "{{highpass}}"
 ::
-    
+    
     $$
         \begin{align*}
             b_0 &amp;= \frac{1 + \cos\omega_0}{2} \\
@@ -6790,11 +6790,11 @@ filter type, are:
             a_2 &amp;= 1 - \alpha_{Q_{dB}}
         \end{align*}
     $$
-    </pre>
+    
 
 : "{{bandpass}}"
 ::
-    
+    
     $$
         \begin{align*}
             b_0 &amp;= \alpha_Q \\
@@ -6805,11 +6805,11 @@ filter type, are:
             a_2 &amp;= 1 - \alpha_Q
         \end{align*}
     $$
-    </pre>
+    
 
 : "{{notch}}"
 ::
-    
+    
     $$
         \begin{align*}
             b_0 &amp;= 1 \\
@@ -6820,11 +6820,11 @@ filter type, are:
             a_2 &amp;= 1 - \alpha_Q
         \end{align*}
     $$
-    </pre>
+    
 
 : "{{allpass}}"
 ::
-    
+    
     $$
         \begin{align*}
             b_0 &amp;= 1 - \alpha_Q \\
@@ -6835,11 +6835,11 @@ filter type, are:
             a_2 &amp;= 1 - \alpha_Q
         \end{align*}
     $$
-    </pre>
+    
 
 : "{{peaking}}"
 ::
-    
+    
     $$
         \begin{align*}
             b_0 &amp;= 1 + \alpha_Q\, A \\
@@ -6850,11 +6850,11 @@ filter type, are:
             a_2 &amp;= 1 - \frac{\alpha_Q}{A}
         \end{align*}
     $$
-    </pre>
+    
 
 : "{{lowshelf}}"
 ::
-    
+    
     $$
         \begin{align*}
             b_0 &amp;= A \left[ (A+1) - (A-1) \cos\omega_0 + 2 \alpha_S \sqrt{A})\right] \\
@@ -6865,11 +6865,11 @@ filter type, are:
             a_2 &amp;= (A+1) + (A-1) \cos\omega_0 - 2 \alpha_S \sqrt{A})
         \end{align*}
     $$
-    </pre>
+    
 
 : "{{highshelf}}"
 ::
-    
+    
     $$
         \begin{align*}
             b_0 &amp;= A\left[ (A+1) + (A-1)\cos\omega_0 + 2\alpha_S\sqrt{A} )\right] \\
@@ -6880,7 +6880,7 @@ filter type, are:
             a_2 &amp;= (A+1) - (A-1)\cos\omega_0 - 2\alpha_S\sqrt{A}
         \end{align*}
     $$
-    </pre>
+