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: -
++ 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: -const context = new AudioContext(); function playSound() { @@ -397,7 +397,7 @@ function playSound() { source.connect(context.destination); source.start(0); } -
++ Modular routing also permits the output of {{AudioNode}}s to be routed to an @@ -509,7 +509,7 @@ input signal. -let context; let compressor; let reverb; @@ -491,7 +491,7 @@ function setupRoutingGraph () { source2.start(0); source3.start(0); } -
++function setupRoutingGraph() { const context = new AudioContext(); @@ -532,7 +532,7 @@ function setupRoutingGraph() { hfo.start(0); lfo.start(0); } -
"suspended"
`null` and a private slot [[render quantum
size]] that is an unsigned integer.
-
+
enum AudioContextState {
"suspended",
"running",
"closed",
"interrupted"
};
-
+
@@ -761,12 +761,12 @@ enum AudioContextState {
-
+
enum AudioContextRenderSizeCategory {
"default",
"hardware"
};
-
+
@@ -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"
};
-
+
@@ -1460,11 +1460,11 @@ enum AudioContextLatencyCategory {
-
+
enum AudioSinkType {
"none"
};
-
+
@@ -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;
}
-
+
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";
};
-
+
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;
};
-
+
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;
};
-
+
Attributes
@@ -2430,12 +2430,12 @@ Attributes
{{AudioTimestamp}}
-
+
dictionary AudioTimestamp {
double contextTime;
DOMHighResTimeStamp performanceTime;
};
-
+
Dictionary {{AudioTimestamp}} Members
@@ -2558,13 +2558,13 @@ Constructors
The OfflineAudioContext is constructed as if
-
+
new OfflineAudioContext({
numberOfChannels: numberOfChannels,
length: length,
sampleRate: sampleRate
})
-
+
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";
};
-
+
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;
};
-
+
Attributes
@@ -2843,11 +2843,11 @@ Attributes
{{OfflineAudioCompletionEventInit}}
-
+
dictionary OfflineAudioCompletionEventInit : EventInit {
required AudioBuffer renderedBuffer;
};
-
+
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);
};
-
+
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;
};
-
+
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;
};
-
+
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"
};
-
+
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"
};
-
+
@@ -3641,16 +3641,16 @@ Methods
For example:
-
+
nodeA.connect(nodeB);
nodeA.connect(nodeB);
-
+
will have the same effect as
-
+
nodeA.connect(nodeB);
-
+
This method returns destination
@@ -3703,16 +3703,16 @@ Methods
For example:
-
+
nodeA.connect(param);
nodeA.connect(param);
-
+
will have the same effect as
-
+
nodeA.connect(param);
-
+
@@ -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;
};
-
+
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"
};
-
+
@@ -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<float> values,
+ AudioParam setValueCurveAtTime (sequence values,
double startTime,
double duration);
AudioParam cancelScheduledValues (double cancelTime);
AudioParam cancelAndHoldAtTime (double cancelTime);
};
-
+
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}
$$
-
+
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}
$$
-
+
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)}
$$
-
+
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
$$
-
+
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 &= \left\lfloor \frac{N - 1}{T_D}(t-T_0) \right\rfloor \\
\end{align*}
$$
-
+
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);
-
+
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 < 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);
-
+
-
+
$$
\begin{align*}
A &= 10^{\frac{G}{40}} \\
@@ -6757,14 +6757,14 @@ their computation, based on the computedValue of the
\alpha_S &= \frac{\sin\omega_0}{2}\sqrt{\left(A+\frac{1}{A}\right)\left(\frac{1}{S}-1\right)+2}
\end{align*}
$$
-
+
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 &= \frac{1 - \cos\omega_0}{2} \\
@@ -6775,11 +6775,11 @@ filter type, are:
a_2 &= 1 - \alpha_{Q_{dB}}
\end{align*}
$$
-
+
: "{{highpass}}"
::
-
+
$$
\begin{align*}
b_0 &= \frac{1 + \cos\omega_0}{2} \\
@@ -6790,11 +6790,11 @@ filter type, are:
a_2 &= 1 - \alpha_{Q_{dB}}
\end{align*}
$$
-
+
: "{{bandpass}}"
::
-
+
$$
\begin{align*}
b_0 &= \alpha_Q \\
@@ -6805,11 +6805,11 @@ filter type, are:
a_2 &= 1 - \alpha_Q
\end{align*}
$$
-
+
: "{{notch}}"
::
-
+
$$
\begin{align*}
b_0 &= 1 \\
@@ -6820,11 +6820,11 @@ filter type, are:
a_2 &= 1 - \alpha_Q
\end{align*}
$$
-
+
: "{{allpass}}"
::
-
+
$$
\begin{align*}
b_0 &= 1 - \alpha_Q \\
@@ -6835,11 +6835,11 @@ filter type, are:
a_2 &= 1 - \alpha_Q
\end{align*}
$$
-
+
: "{{peaking}}"
::
-
+
$$
\begin{align*}
b_0 &= 1 + \alpha_Q\, A \\
@@ -6850,11 +6850,11 @@ filter type, are:
a_2 &= 1 - \frac{\alpha_Q}{A}
\end{align*}
$$
-
+
: "{{lowshelf}}"
::
-
+
$$
\begin{align*}
b_0 &= A \left[ (A+1) - (A-1) \cos\omega_0 + 2 \alpha_S \sqrt{A})\right] \\
@@ -6865,11 +6865,11 @@ filter type, are:
a_2 &= (A+1) + (A-1) \cos\omega_0 - 2 \alpha_S \sqrt{A})
\end{align*}
$$
-
+
: "{{highshelf}}"
::
-
+
$$
\begin{align*}
b_0 &= A\left[ (A+1) + (A-1)\cos\omega_0 + 2\alpha_S\sqrt{A} )\right] \\
@@ -6880,7 +6880,7 @@ filter type, are:
a_2 &= (A+1) - (A-1)\cos\omega_0 - 2\alpha_S\sqrt{A}
\end{align*}
$$
-
+