-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
789 lines (744 loc) · 54.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
<!doctype html><html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
<title>WebRTC Audio Worklet</title>
<meta content="UD" name="w3c-status">
<link href="https://www.w3.org/StyleSheets/TR/2016/W3C-UD" rel="stylesheet">
<link href="https://www.w3.org/2008/site/images/favicon.ico" rel="icon">
<meta content="Bikeshed version 1e757f3ee68e638e030f32dc3e8d2e3234d3aed5" name="generator">
<link href="https://alvestrand.github.io/audio-worklet/" rel="canonical">
<style>/* style-md-lists */
/* This is a weird hack for me not yet following the commonmark spec
regarding paragraph and lists. */
[data-md] > :first-child {
margin-top: 0;
}
[data-md] > :last-child {
margin-bottom: 0;
}</style>
<style>/* style-selflinks */
.heading, .issue, .note, .example, li, dt {
position: relative;
}
a.self-link {
position: absolute;
top: 0;
left: calc(-1 * (3.5rem - 26px));
width: calc(3.5rem - 26px);
height: 2em;
text-align: center;
border: none;
transition: opacity .2s;
opacity: .5;
}
a.self-link:hover {
opacity: 1;
}
.heading > a.self-link {
font-size: 83%;
}
li > a.self-link {
left: calc(-1 * (3.5rem - 26px) - 2em);
}
dfn > a.self-link {
top: auto;
left: auto;
opacity: 0;
width: 1.5em;
height: 1.5em;
background: gray;
color: white;
font-style: normal;
transition: opacity .2s, background-color .2s, color .2s;
}
dfn:hover > a.self-link {
opacity: 1;
}
dfn > a.self-link:hover {
color: black;
}
a.self-link::before { content: "¶"; }
.heading > a.self-link::before { content: "§"; }
dfn > a.self-link::before { content: "#"; }</style>
<style>/* style-counters */
body {
counter-reset: example figure issue;
}
.issue {
counter-increment: issue;
}
.issue:not(.no-marker)::before {
content: "Issue " counter(issue);
}
.example {
counter-increment: example;
}
.example:not(.no-marker)::before {
content: "Example " counter(example);
}
.invalid.example:not(.no-marker)::before,
.illegal.example:not(.no-marker)::before {
content: "Invalid Example" counter(example);
}
figcaption {
counter-increment: figure;
}
figcaption:not(.no-marker)::before {
content: "Figure " counter(figure) " ";
}</style>
<style>/* style-autolinks */
.css.css, .property.property, .descriptor.descriptor {
color: #005a9c;
font-size: inherit;
font-family: inherit;
}
.css::before, .property::before, .descriptor::before {
content: "‘";
}
.css::after, .property::after, .descriptor::after {
content: "’";
}
.property, .descriptor {
/* Don't wrap property and descriptor names */
white-space: nowrap;
}
.type { /* CSS value <type> */
font-style: italic;
}
pre .property::before, pre .property::after {
content: "";
}
[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {
content: "‘";
}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {
content: "’";
}
[data-link-type].production::before,
[data-link-type].production::after,
.prod [data-link-type]::before,
.prod [data-link-type]::after {
content: "";
}
[data-link-type=element],
[data-link-type=element-attr] {
font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
font-size: .9em;
}
[data-link-type=element]::before { content: "<" }
[data-link-type=element]::after { content: ">" }
[data-link-type=biblio] {
white-space: pre;
}</style>
<style>/* style-dfn-panel */
.dfn-panel {
position: absolute;
z-index: 35;
height: auto;
width: -webkit-fit-content;
width: fit-content;
max-width: 300px;
max-height: 500px;
overflow: auto;
padding: 0.5em 0.75em;
font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
background: #DDDDDD;
color: black;
border: outset 0.2em;
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: black; }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
display: inline-block;
position: fixed;
left: .5em;
bottom: 2em;
margin: 0 auto;
max-width: calc(100vw - 1.5em - .4em - .5em);
max-height: 30vh;
}
.dfn-paneled { cursor: pointer; }
</style>
<style>/* style-syntax-highlighting */
pre.idl.highlight { color: #708090; }
.highlight:not(.idl) { background: hsl(24, 20%, 95%); }
code.highlight { padding: .1em; border-radius: .3em; }
pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; }
c-[a] { color: #990055 } /* Keyword.Declaration */
c-[b] { color: #990055 } /* Keyword.Type */
c-[c] { color: #708090 } /* Comment */
c-[d] { color: #708090 } /* Comment.Multiline */
c-[e] { color: #0077aa } /* Name.Attribute */
c-[f] { color: #669900 } /* Name.Tag */
c-[g] { color: #222222 } /* Name.Variable */
c-[k] { color: #990055 } /* Keyword */
c-[l] { color: #000000 } /* Literal */
c-[m] { color: #000000 } /* Literal.Number */
c-[n] { color: #0077aa } /* Name */
c-[o] { color: #999999 } /* Operator */
c-[p] { color: #999999 } /* Punctuation */
c-[s] { color: #a67f59 } /* Literal.String */
c-[t] { color: #a67f59 } /* Literal.String.Single */
c-[u] { color: #a67f59 } /* Literal.String.Double */
c-[cp] { color: #708090 } /* Comment.Preproc */
c-[c1] { color: #708090 } /* Comment.Single */
c-[cs] { color: #708090 } /* Comment.Special */
c-[kc] { color: #990055 } /* Keyword.Constant */
c-[kn] { color: #990055 } /* Keyword.Namespace */
c-[kp] { color: #990055 } /* Keyword.Pseudo */
c-[kr] { color: #990055 } /* Keyword.Reserved */
c-[ld] { color: #000000 } /* Literal.Date */
c-[nc] { color: #0077aa } /* Name.Class */
c-[no] { color: #0077aa } /* Name.Constant */
c-[nd] { color: #0077aa } /* Name.Decorator */
c-[ni] { color: #0077aa } /* Name.Entity */
c-[ne] { color: #0077aa } /* Name.Exception */
c-[nf] { color: #0077aa } /* Name.Function */
c-[nl] { color: #0077aa } /* Name.Label */
c-[nn] { color: #0077aa } /* Name.Namespace */
c-[py] { color: #0077aa } /* Name.Property */
c-[ow] { color: #999999 } /* Operator.Word */
c-[mb] { color: #000000 } /* Literal.Number.Bin */
c-[mf] { color: #000000 } /* Literal.Number.Float */
c-[mh] { color: #000000 } /* Literal.Number.Hex */
c-[mi] { color: #000000 } /* Literal.Number.Integer */
c-[mo] { color: #000000 } /* Literal.Number.Oct */
c-[sb] { color: #a67f59 } /* Literal.String.Backtick */
c-[sc] { color: #a67f59 } /* Literal.String.Char */
c-[sd] { color: #a67f59 } /* Literal.String.Doc */
c-[se] { color: #a67f59 } /* Literal.String.Escape */
c-[sh] { color: #a67f59 } /* Literal.String.Heredoc */
c-[si] { color: #a67f59 } /* Literal.String.Interpol */
c-[sx] { color: #a67f59 } /* Literal.String.Other */
c-[sr] { color: #a67f59 } /* Literal.String.Regex */
c-[ss] { color: #a67f59 } /* Literal.String.Symbol */
c-[vc] { color: #0077aa } /* Name.Variable.Class */
c-[vg] { color: #0077aa } /* Name.Variable.Global */
c-[vi] { color: #0077aa } /* Name.Variable.Instance */
c-[il] { color: #000000 } /* Literal.Number.Integer.Long */
</style>
<body class="h-entry">
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">WebRTC Audio Worklet</h1>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Unofficial Proposal Draft, <time class="dt-updated" datetime="2018-10-10">10 October 2018</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
<dd><a class="u-url" href="https://alvestrand.github.io/audio-worklet/">https://alvestrand.github.io/audio-worklet/</a>
<dt>Feedback:
<dd><span><a href="mailto:public-webrtc@w3.org?subject=%5Bmediacapture-audio-worklet%5D%20YOUR%20TOPIC%20HERE">public-webrtc@w3.org</a> with subject line “<kbd>[mediacapture-audio-worklet] <i data-lt>… message topic …</i></kbd>” (<a href="https://lists.w3.org/Archives/Public/public-webrtc/" rel="discussion">archives</a>)</span>
<dt>Issue Tracking:
<dd><a href="https://github.com/alvestrand/audio-worklet/issues/">GitHub</a>
<dt class="editor">Editor:
<dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:hta@google.com">Harald Alvestrand</a> (<a class="p-org org" href="https://google.com">Google</a>)
</dl>
</div>
<div data-fill-with="warning"></div>
<p class="copyright" data-fill-with="copyright"><a href="https://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2018 <a href="https://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="https://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="https://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="https://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply. </p>
<hr title="Separator for header">
</div>
<div class="p-summary" data-fill-with="abstract">
<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<p>This API defines a worklet for handling the samples in an
audio stream using worklets.</p>
</div>
<h2 class="no-num no-toc no-ref heading settled" id="sotd"><span class="content">Status of this document</span></h2>
<div data-fill-with="status">
<p></p>
</div>
<div data-fill-with="at-risk"></div>
<nav data-fill-with="table-of-contents" id="toc">
<h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
<ol class="toc" role="directory">
<li><a href="#intro"><span class="secno">1</span> <span class="content">Introduction</span></a>
<li><a href="#model"><span class="secno">2</span> <span class="content">Processing model</span></a>
<li><a href="#interface"><span class="secno">3</span> <span class="content">Interface definition</span></a>
<li><a href="#remaining-choices"><span class="secno">4</span> <span class="content">Design choices</span></a>
<li><a href="#prototype"><span class="secno">5</span> <span class="content">Emulating MediaTrackProcessor on top of WebAudio AudioWorkletNode</span></a>
<li><a href="#conformance"><span class="secno"></span> <span class="content"> Conformance</span></a>
<li>
<a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
<ol class="toc">
<li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
<li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
</ol>
<li>
<a href="#references"><span class="secno"></span> <span class="content">References</span></a>
<ol class="toc">
<li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
<li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
</ol>
<li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a>
</ol>
</nav>
<main>
<p>This will be introduced.</p>
<p>API specification: WebRTC Audio Worklet</p>
<h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content">Introduction</span><a class="self-link" href="#intro"></a></h2>
<p>This document constitutes an extension to “Media Capture and Streams”. It specifies an API that allows convenient access to raw audio data for processing purposes.</p>
<p>The aim of the specification, unlike <a data-link-type="biblio" href="#biblio-webaudio">[WebAudio]</a>, is to provide a special purpose API for the efficient processing of audio data, with minimal overhead imposed over what can be achieved by embedding the processing inside the browser.</p>
<p>The target for this API is functions that need to be implemented efficiently, with minimum additional overhead and minimal required conversions. Thus, the format for audio here is deliberately not constrained to a single format; the platform is free to choose over a wide range of capabilities, and the applications are expected to adapt to this.</p>
<h2 class="heading settled" data-level="2" id="model"><span class="secno">2. </span><span class="content">Processing model</span><a class="self-link" href="#model"></a></h2>
<p>This API adopts the “worklet” model: The application loads a Javascript module, which is loaded into a context separate from the main Javascript application. In this context, a specific function is called for each buffer of audio data.
The buffer contains enough information to ascertain the format of the audio data, and the audio data itself. There exists an API for writing audio data (in the same format as the incoming data), but the processing model allows applications that do not use this API.</p>
<h2 class="heading settled" data-level="3" id="interface"><span class="secno">3. </span><span class="content">Interface definition</span><a class="self-link" href="#interface"></a></h2>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed"><c- g>Exposed</c-></a>=<c- n>Window</c->, <a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#SecureContext" id="ref-for-SecureContext"><c- g>SecureContext</c-></a>]
<c- b>interface</c-> <dfn class="idl-code" data-dfn-type="interface" data-export id="audiomediatrackworklet"><code><c- g>AudioMediaTrackWorklet</c-></code><a class="self-link" href="#audiomediatrackworklet"></a></dfn>: <a class="n" data-link-type="idl-name" href="https://drafts.css-houdini.org/worklets/#worklet" id="ref-for-worklet"><c- n>Worklet</c-></a> {
};
// This object is created by the application in order to instantiate
// a worklet containing the AudioMediaTrackProcessor.
[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed①"><c- g>Exposed</c-></a>=<c- n>Window</c->, <a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#SecureContext" id="ref-for-SecureContext①"><c- g>SecureContext</c-></a>,
<dfn class="idl-code" data-dfn-for="AudioMediaTrackNode" data-dfn-type="constructor" data-export data-lt="AudioMediaTrackNode(inputTrack, options)" id="dom-audiomediatracknode-audiomediatracknode"><code><c- g>Constructor</c-></code><a class="self-link" href="#dom-audiomediatracknode-audiomediatracknode"></a></dfn>(<a class="n" data-link-type="idl-name"><c- n>MediaStreamTrack</c-></a> <dfn class="idl-code" data-dfn-for="AudioMediaTrackNode/AudioMediaTrackNode(inputTrack, options)" data-dfn-type="argument" data-export id="dom-audiomediatracknode-audiomediatracknode-inputtrack-options-inputtrack"><code><c- g>inputTrack</c-></code><a class="self-link" href="#dom-audiomediatracknode-audiomediatracknode-inputtrack-options-inputtrack"></a></dfn>, <a class="n" data-link-type="idl-name" href="#mediatracknodeoptions" id="ref-for-mediatracknodeoptions"><c- n>MediaTrackNodeOptions</c-></a> <dfn class="idl-code" data-dfn-for="AudioMediaTrackNode/AudioMediaTrackNode(inputTrack, options)" data-dfn-type="argument" data-export id="dom-audiomediatracknode-audiomediatracknode-inputtrack-options-options"><code><c- g>options</c-></code><a class="self-link" href="#dom-audiomediatracknode-audiomediatracknode-inputtrack-options-options"></a></dfn>)]
<c- b>interface</c-> <dfn class="idl-code" data-dfn-type="interface" data-export id="audiomediatracknode"><code><c- g>AudioMediaTrackNode</c-></code><a class="self-link" href="#audiomediatracknode"></a></dfn> {
<c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name"><c- n>MediaStreamTrack</c-></a>? <dfn class="idl-code" data-dfn-for="AudioMediaTrackNode" data-dfn-type="attribute" data-export data-readonly data-type="MediaStreamTrack?" id="dom-audiomediatracknode-outputtrack"><code><c- g>outputTrack</c-></code><a class="self-link" href="#dom-audiomediatracknode-outputtrack"></a></dfn>;
};
// These parameters characterize a particular call to process().
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="parameters"><code><c- g>Parameters</c-></code></dfn> {
<c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <dfn class="idl-code" data-dfn-for="Parameters" data-dfn-type="attribute" data-export data-readonly data-type="unsigned long long" id="dom-parameters-currentsample"><code><c- g>currentSample</c-></code><a class="self-link" href="#dom-parameters-currentsample"></a></dfn>;
<c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-double" id="ref-for-idl-double"><c- b>double</c-></a> <dfn class="idl-code" data-dfn-for="Parameters" data-dfn-type="attribute" data-export data-readonly data-type="double" id="dom-parameters-currenttime"><code><c- g>currentTime</c-></code><a class="self-link" href="#dom-parameters-currenttime"></a></dfn>;
<c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long" id="ref-for-idl-unsigned-long"><c- b>unsigned</c-> <c- b>long</c-></a> <dfn class="idl-code" data-dfn-for="Parameters" data-dfn-type="attribute" data-export data-readonly data-type="unsigned long" id="dom-parameters-samplecount"><code><c- g>sampleCount</c-></code><a class="self-link" href="#dom-parameters-samplecount"></a></dfn>;
};
// Format of samples. TODO: Figure out if there’s a common practice
// that we should refer to rather than defining our own enum.
<c- b>enum</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="enum" data-export id="enumdef-sampleformat"><code><c- g>SampleFormat</c-></code></dfn> {
<dfn class="idl-code" data-dfn-for="SampleFormat" data-dfn-type="enum-value" data-export id="dom-sampleformat-float32"><code><c- s>"float32"</c-></code><a class="self-link" href="#dom-sampleformat-float32"></a></dfn>,
<dfn class="idl-code" data-dfn-for="SampleFormat" data-dfn-type="enum-value" data-export id="dom-sampleformat-int32"><code><c- s>"int32"</c-></code><a class="self-link" href="#dom-sampleformat-int32"></a></dfn>,
};
// these options are given by the platform and cannot be changed by the user
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="mediatrackplatformoptions"><code><c- g>MediaTrackPlatformOptions</c-></code></dfn> {
<c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="#enumdef-sampleformat" id="ref-for-enumdef-sampleformat"><c- n>SampleFormat</c-></a> <dfn class="idl-code" data-dfn-for="MediaTrackPlatformOptions" data-dfn-type="attribute" data-export data-readonly data-type="SampleFormat" id="dom-mediatrackplatformoptions-sampleformat"><code><c- g>sampleFormat</c-></code><a class="self-link" href="#dom-mediatrackplatformoptions-sampleformat"></a></dfn>;
<c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long" id="ref-for-idl-unsigned-long①"><c- b>unsigned</c-> <c- b>long</c-></a> <dfn class="idl-code" data-dfn-for="MediaTrackPlatformOptions" data-dfn-type="attribute" data-export data-readonly data-type="unsigned long" id="dom-mediatrackplatformoptions-channelcount"><code><c- g>channelCount</c-></code><a class="self-link" href="#dom-mediatrackplatformoptions-channelcount"></a></dfn>;
<c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-float" id="ref-for-idl-float"><c- b>float</c-></a> <dfn class="idl-code" data-dfn-for="MediaTrackPlatformOptions" data-dfn-type="attribute" data-export data-readonly data-type="float" id="dom-mediatrackplatformoptions-samplerate"><code><c- g>sampleRate</c-></code><a class="self-link" href="#dom-mediatrackplatformoptions-samplerate"></a></dfn>;
};
// These are specified by the instantiator at node creation time
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="mediatracknodeoptions"><code><c- g>MediaTrackNodeOptions</c-></code></dfn> {
<c- b>attribute</c-> <a class="n" data-link-type="idl-name"><c- n>bool</c-></a> <dfn class="idl-code" data-dfn-for="MediaTrackNodeOptions" data-dfn-type="attribute" data-export data-type="bool" id="dom-mediatracknodeoptions-producesoutput"><code><c- g>producesOutput</c-></code><a class="self-link" href="#dom-mediatracknodeoptions-producesoutput"></a></dfn>;
};
// The processor object is created by the platform when creating
// an AudioMediaTrackNode
[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed②"><c- g>Exposed</c-></a>=<c- n>AudioMediaTrackWorklet</c->,
<dfn class="idl-code" data-dfn-for="AudioMediaTrackProcessor" data-dfn-type="constructor" data-export data-lt="AudioMediaTrackProcessor(platformOptions, userOptions)|AudioMediaTrackProcessor(platformOptions)" id="dom-audiomediatrackprocessor-audiomediatrackprocessor"><code><c- g>Constructor</c-></code><a class="self-link" href="#dom-audiomediatrackprocessor-audiomediatrackprocessor"></a></dfn> (<a class="n" data-link-type="idl-name" href="#mediatrackplatformoptions" id="ref-for-mediatrackplatformoptions"><c- n>MediaTrackPlatformOptions</c-></a> <dfn class="idl-code" data-dfn-for="AudioMediaTrackProcessor/AudioMediaTrackProcessor(platformOptions, userOptions)" data-dfn-type="argument" data-export id="dom-audiomediatrackprocessor-audiomediatrackprocessor-platformoptions-useroptions-platformoptions"><code><c- g>platformOptions</c-></code><a class="self-link" href="#dom-audiomediatrackprocessor-audiomediatrackprocessor-platformoptions-useroptions-platformoptions"></a></dfn>,
<c- b>optional</c-> <a class="n" data-link-type="idl-name" href="#mediatracknodeoptions" id="ref-for-mediatracknodeoptions①"><c- n>MediaTrackNodeOptions</c-></a> <dfn class="idl-code" data-dfn-for="AudioMediaTrackProcessor/AudioMediaTrackProcessor(platformOptions, userOptions)" data-dfn-type="argument" data-export id="dom-audiomediatrackprocessor-audiomediatrackprocessor-platformoptions-useroptions-useroptions"><code><c- g>userOptions</c-></code><a class="self-link" href="#dom-audiomediatrackprocessor-audiomediatrackprocessor-platformoptions-useroptions-useroptions"></a></dfn>)]
<c- b>interface</c-> <dfn class="idl-code" data-dfn-type="interface" data-export id="audiomediatrackprocessor"><code><c- g>AudioMediaTrackProcessor</c-></code><a class="self-link" href="#audiomediatrackprocessor"></a></dfn> {
<c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/web-messaging.html#messageport" id="ref-for-messageport"><c- n>MessagePort</c-></a> <dfn class="idl-code" data-dfn-for="AudioMediaTrackProcessor" data-dfn-type="attribute" data-export data-readonly data-type="MessagePort" id="dom-audiomediatrackprocessor-port"><code><c- g>port</c-></code><a class="self-link" href="#dom-audiomediatrackprocessor-port"></a></dfn>;
<c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="#mediatrackplatformoptions" id="ref-for-mediatrackplatformoptions①"><c- n>MediaTrackPlatformOptions</c-></a> <dfn class="idl-code" data-dfn-for="AudioMediaTrackProcessor" data-dfn-type="attribute" data-export data-readonly data-type="MediaTrackPlatformOptions" id="dom-audiomediatrackprocessor-platformoptions"><code><c- g>platformOptions</c-></code><a class="self-link" href="#dom-audiomediatrackprocessor-platformoptions"></a></dfn>;
<c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="#mediatracknodeoptions" id="ref-for-mediatracknodeoptions②"><c- n>MediaTrackNodeOptions</c-></a> <dfn class="idl-code" data-dfn-for="AudioMediaTrackProcessor" data-dfn-type="attribute" data-export data-readonly data-type="MediaTrackNodeOptions" id="dom-audiomediatrackprocessor-useroptions"><code><c- g>userOptions</c-></code><a class="self-link" href="#dom-audiomediatrackprocessor-useroptions"></a></dfn>;
<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean"><c- b>boolean</c-></a> <dfn class="idl-code" data-dfn-for="AudioMediaTrackProcessor" data-dfn-type="method" data-export data-lt="process(input, output, parameters)" id="dom-audiomediatrackprocessor-process"><code><c- g>process</c-></code><a class="self-link" href="#dom-audiomediatrackprocessor-process"></a></dfn>(<a class="n" data-link-type="idl-name"><c- n>Buffer</c-></a> <dfn class="idl-code" data-dfn-for="AudioMediaTrackProcessor/process(input, output, parameters)" data-dfn-type="argument" data-export id="dom-audiomediatrackprocessor-process-input-output-parameters-input"><code><c- g>input</c-></code><a class="self-link" href="#dom-audiomediatrackprocessor-process-input-output-parameters-input"></a></dfn>, <a class="n" data-link-type="idl-name"><c- n>Buffer</c-></a>? <dfn class="idl-code" data-dfn-for="AudioMediaTrackProcessor/process(input, output, parameters)" data-dfn-type="argument" data-export id="dom-audiomediatrackprocessor-process-input-output-parameters-output"><code><c- g>output</c-></code><a class="self-link" href="#dom-audiomediatrackprocessor-process-input-output-parameters-output"></a></dfn>, <a class="n" data-link-type="idl-name" href="#parameters" id="ref-for-parameters"><c- n>Parameters</c-></a> <dfn class="idl-code" data-dfn-for="AudioMediaTrackProcessor/process(input, output, parameters)" data-dfn-type="argument" data-export id="dom-audiomediatrackprocessor-process-input-output-parameters-parameters"><code><c- g>parameters</c-></code><a class="self-link" href="#dom-audiomediatrackprocessor-process-input-output-parameters-parameters"></a></dfn>);
};
</pre>
<p>Unlike the WebAudio API, there is no global clock; the currentFrame and currentTime are references to be interpreted in the context of this particular MediaStreamTrack.</p>
<p>The Buffer arguments are byte buffers, and must be interpreted by looking at channelCount and sampleFormat. They are allocated by the calling process, and are expected to be deallocated or reused after the process() function returns; the processing module cannot hold on to a reference to them.</p>
<p>If the MediaTrackNodeOptions includes a “true” for producesOutput, there will be an output buffer passed to process().</p>
<h2 class="heading settled" data-level="4" id="remaining-choices"><span class="secno">4. </span><span class="content">Design choices</span><a class="self-link" href="#remaining-choices"></a></h2>
Sometimes, processing will want to be done on multiple tracks. We could pass
multiple tracks into the AudioMediaTrackNode constructur, and have multiple
Buffers passed to process() - but this would require that the platform
synchronize the tracks, which works against the goal of minimizing platform
processing overhead.
<p>An alternative design for these cases is to have two (or more) worklets
writing into a common SharedArrayBuffer, which the trailing processor would
then read from in order to produce output.</p>
<h2 class="heading settled" data-level="5" id="prototype"><span class="secno">5. </span><span class="content">Emulating MediaTrackProcessor on top of WebAudio AudioWorkletNode</span><a class="self-link" href="#prototype"></a></h2>
This should be possible, and would allow to experiment with the API in parallel with implementation.
</main>
<div data-fill-with="conformance">
<h2 class="no-ref no-num heading settled" id="conformance"><span class="content"> Conformance</span><a class="self-link" href="#conformance"></a></h2>
<p> Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology.
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL”
in the normative parts of this document
are to be interpreted as described in RFC 2119.
However, for readability,
these words do not appear in all uppercase letters in this specification. </p>
<p> All of the text of this specification is normative
except sections explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a> </p>
<p> Examples in this specification are introduced with the words “for example”
or are set apart from the normative text with <code>class="example"</code>, like this: </p>
<div class="example" id="example-example"><a class="self-link" href="#example-example"></a> This is an example of an informative example. </div>
<p> Informative notes begin with the word “Note”
and are set apart from the normative text with <code>class="note"</code>, like this: </p>
<p class="note" role="note"> Note, this is an informative note. </p>
</div>
<script>
(function() {
"use strict";
var collapseSidebarText = '<span aria-hidden="true">←</span> '
+ '<span>Collapse Sidebar</span>';
var expandSidebarText = '<span aria-hidden="true">→</span> '
+ '<span>Pop Out Sidebar</span>';
var tocJumpText = '<span aria-hidden="true">↑</span> '
+ '<span>Jump to Table of Contents</span>';
var sidebarMedia = window.matchMedia('screen and (min-width: 78em)');
var autoToggle = function(e){ toggleSidebar(e.matches) };
if(sidebarMedia.addListener) {
sidebarMedia.addListener(autoToggle);
}
function toggleSidebar(on) {
if (on == undefined) {
on = !document.body.classList.contains('toc-sidebar');
}
/* Don’t scroll to compensate for the ToC if we’re above it already. */
var headY = 0;
var head = document.querySelector('.head');
if (head) {
// terrible approx of "top of ToC"
headY += head.offsetTop + head.offsetHeight;
}
var skipScroll = window.scrollY < headY;
var toggle = document.getElementById('toc-toggle');
var tocNav = document.getElementById('toc');
if (on) {
var tocHeight = tocNav.offsetHeight;
document.body.classList.add('toc-sidebar');
document.body.classList.remove('toc-inline');
toggle.innerHTML = collapseSidebarText;
if (!skipScroll) {
window.scrollBy(0, 0 - tocHeight);
}
tocNav.focus();
sidebarMedia.addListener(autoToggle); // auto-collapse when out of room
}
else {
document.body.classList.add('toc-inline');
document.body.classList.remove('toc-sidebar');
toggle.innerHTML = expandSidebarText;
if (!skipScroll) {
window.scrollBy(0, tocNav.offsetHeight);
}
if (toggle.matches(':hover')) {
/* Unfocus button when not using keyboard navigation,
because I don’t know where else to send the focus. */
toggle.blur();
}
}
}
function createSidebarToggle() {
/* Create the sidebar toggle in JS; it shouldn’t exist when JS is off. */
var toggle = document.createElement('a');
/* This should probably be a button, but appearance isn’t standards-track.*/
toggle.id = 'toc-toggle';
toggle.class = 'toc-toggle';
toggle.href = '#toc';
toggle.innerHTML = collapseSidebarText;
sidebarMedia.addListener(autoToggle);
var toggler = function(e) {
e.preventDefault();
sidebarMedia.removeListener(autoToggle); // persist explicit off states
toggleSidebar();
return false;
}
toggle.addEventListener('click', toggler, false);
/* Get <nav id=toc-nav>, or make it if we don’t have one. */
var tocNav = document.getElementById('toc-nav');
if (!tocNav) {
tocNav = document.createElement('p');
tocNav.id = 'toc-nav';
/* Prepend for better keyboard navigation */
document.body.insertBefore(tocNav, document.body.firstChild);
}
/* While we’re at it, make sure we have a Jump to Toc link. */
var tocJump = document.getElementById('toc-jump');
if (!tocJump) {
tocJump = document.createElement('a');
tocJump.id = 'toc-jump';
tocJump.href = '#toc';
tocJump.innerHTML = tocJumpText;
tocNav.appendChild(tocJump);
}
tocNav.appendChild(toggle);
}
var toc = document.getElementById('toc');
if (toc) {
createSidebarToggle();
toggleSidebar(sidebarMedia.matches);
/* If the sidebar has been manually opened and is currently overlaying the text
(window too small for the MQ to add the margin to body),
then auto-close the sidebar once you click on something in there. */
toc.addEventListener('click', function(e) {
if(e.target.tagName.toLowerCase() == "a" && document.body.classList.contains('toc-sidebar') && !sidebarMedia.matches) {
toggleSidebar(false);
}
}, false);
}
else {
console.warn("Can’t find Table of Contents. Please use <nav id='toc'> around the ToC.");
}
/* Wrap tables in case they overflow */
var tables = document.querySelectorAll(':not(.overlarge) > table.data, :not(.overlarge) > table.index');
var numTables = tables.length;
for (var i = 0; i < numTables; i++) {
var table = tables[i];
var wrapper = document.createElement('div');
wrapper.className = 'overlarge';
table.parentNode.insertBefore(wrapper, table);
wrapper.appendChild(table);
}
})();
</script>
<h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2>
<h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3>
<ul class="index">
<li><a href="#audiomediatracknode">AudioMediaTrackNode</a><span>, in §3</span>
<li><a href="#dom-audiomediatracknode-audiomediatracknode">AudioMediaTrackNode(inputTrack, options)</a><span>, in §3</span>
<li><a href="#audiomediatrackprocessor">AudioMediaTrackProcessor</a><span>, in §3</span>
<li><a href="#dom-audiomediatrackprocessor-audiomediatrackprocessor">AudioMediaTrackProcessor(platformOptions)</a><span>, in §3</span>
<li><a href="#dom-audiomediatrackprocessor-audiomediatrackprocessor">AudioMediaTrackProcessor(platformOptions, userOptions)</a><span>, in §3</span>
<li><a href="#audiomediatrackworklet">AudioMediaTrackWorklet</a><span>, in §3</span>
<li><a href="#dom-mediatrackplatformoptions-channelcount">channelCount</a><span>, in §3</span>
<li><a href="#dom-parameters-currentsample">currentSample</a><span>, in §3</span>
<li><a href="#dom-parameters-currenttime">currentTime</a><span>, in §3</span>
<li><a href="#dom-sampleformat-float32">"float32"</a><span>, in §3</span>
<li><a href="#dom-sampleformat-int32">"int32"</a><span>, in §3</span>
<li><a href="#mediatracknodeoptions">MediaTrackNodeOptions</a><span>, in §3</span>
<li><a href="#mediatrackplatformoptions">MediaTrackPlatformOptions</a><span>, in §3</span>
<li><a href="#dom-audiomediatracknode-outputtrack">outputTrack</a><span>, in §3</span>
<li><a href="#parameters">Parameters</a><span>, in §3</span>
<li><a href="#dom-audiomediatrackprocessor-platformoptions">platformOptions</a><span>, in §3</span>
<li><a href="#dom-audiomediatrackprocessor-port">port</a><span>, in §3</span>
<li><a href="#dom-audiomediatrackprocessor-process">process(input, output, parameters)</a><span>, in §3</span>
<li><a href="#dom-mediatracknodeoptions-producesoutput">producesOutput</a><span>, in §3</span>
<li><a href="#dom-parameters-samplecount">sampleCount</a><span>, in §3</span>
<li><a href="#dom-mediatrackplatformoptions-sampleformat">sampleFormat</a><span>, in §3</span>
<li><a href="#enumdef-sampleformat">SampleFormat</a><span>, in §3</span>
<li><a href="#dom-mediatrackplatformoptions-samplerate">sampleRate</a><span>, in §3</span>
<li><a href="#dom-audiomediatrackprocessor-useroptions">userOptions</a><span>, in §3</span>
</ul>
<aside class="dfn-panel" data-for="term-for-messageport">
<a href="https://html.spec.whatwg.org/multipage/web-messaging.html#messageport">https://html.spec.whatwg.org/multipage/web-messaging.html#messageport</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-messageport">3. Interface definition</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-Exposed">
<a href="https://heycam.github.io/webidl/#Exposed">https://heycam.github.io/webidl/#Exposed</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-Exposed">3. Interface definition</a> <a href="#ref-for-Exposed①">(2)</a> <a href="#ref-for-Exposed②">(3)</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-SecureContext">
<a href="https://heycam.github.io/webidl/#SecureContext">https://heycam.github.io/webidl/#SecureContext</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-SecureContext">3. Interface definition</a> <a href="#ref-for-SecureContext①">(2)</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-idl-boolean">
<a href="https://heycam.github.io/webidl/#idl-boolean">https://heycam.github.io/webidl/#idl-boolean</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-idl-boolean">3. Interface definition</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-idl-double">
<a href="https://heycam.github.io/webidl/#idl-double">https://heycam.github.io/webidl/#idl-double</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-idl-double">3. Interface definition</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-idl-float">
<a href="https://heycam.github.io/webidl/#idl-float">https://heycam.github.io/webidl/#idl-float</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-idl-float">3. Interface definition</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-idl-unsigned-long">
<a href="https://heycam.github.io/webidl/#idl-unsigned-long">https://heycam.github.io/webidl/#idl-unsigned-long</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-idl-unsigned-long">3. Interface definition</a> <a href="#ref-for-idl-unsigned-long①">(2)</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-idl-unsigned-long-long">
<a href="https://heycam.github.io/webidl/#idl-unsigned-long-long">https://heycam.github.io/webidl/#idl-unsigned-long-long</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-idl-unsigned-long-long">3. Interface definition</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-worklet">
<a href="https://drafts.css-houdini.org/worklets/#worklet">https://drafts.css-houdini.org/worklets/#worklet</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-worklet">3. Interface definition</a>
</ul>
</aside>
<h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3>
<ul class="index">
<li>
<a data-link-type="biblio">[HTML]</a> defines the following terms:
<ul>
<li><span class="dfn-paneled" id="term-for-messageport" style="color:initial">MessagePort</span>
</ul>
<li>
<a data-link-type="biblio">[WebIDL]</a> defines the following terms:
<ul>
<li><span class="dfn-paneled" id="term-for-Exposed" style="color:initial">Exposed</span>
<li><span class="dfn-paneled" id="term-for-SecureContext" style="color:initial">SecureContext</span>
<li><span class="dfn-paneled" id="term-for-idl-boolean" style="color:initial">boolean</span>
<li><span class="dfn-paneled" id="term-for-idl-double" style="color:initial">double</span>
<li><span class="dfn-paneled" id="term-for-idl-float" style="color:initial">float</span>
<li><span class="dfn-paneled" id="term-for-idl-unsigned-long" style="color:initial">unsigned long</span>
<li><span class="dfn-paneled" id="term-for-idl-unsigned-long-long" style="color:initial">unsigned long long</span>
</ul>
<li>
<a data-link-type="biblio">[worklets-1]</a> defines the following terms:
<ul>
<li><span class="dfn-paneled" id="term-for-worklet" style="color:initial">Worklet</span>
</ul>
</ul>
<h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2>
<h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3>
<dl>
<dt id="biblio-html">[HTML]
<dd>Anne van Kesteren; et al. <a href="https://html.spec.whatwg.org/multipage/">HTML Standard</a>. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a>
<dt id="biblio-rfc2119">[RFC2119]
<dd>S. Bradner. <a href="https://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>. March 1997. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc2119">https://tools.ietf.org/html/rfc2119</a>
<dt id="biblio-webidl">[WebIDL]
<dd>Cameron McCormack; Boris Zbarsky; Tobie Langel. <a href="https://heycam.github.io/webidl/">Web IDL</a>. 15 December 2016. ED. URL: <a href="https://heycam.github.io/webidl/">https://heycam.github.io/webidl/</a>
<dt id="biblio-worklets-1">[WORKLETS-1]
<dd>Ian Kilpatrick. <a href="https://www.w3.org/TR/worklets-1/">Worklets Level 1</a>. 7 June 2016. WD. URL: <a href="https://www.w3.org/TR/worklets-1/">https://www.w3.org/TR/worklets-1/</a>
</dl>
<h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3>
<dl>
<dt id="biblio-webaudio">[WebAudio]
<dd>Paul Adenot; Raymond Toy. <a href="https://www.w3.org/TR/webaudio/">Web Audio API</a>. 18 September 2018. CR. URL: <a href="https://www.w3.org/TR/webaudio/">https://www.w3.org/TR/webaudio/</a>
</dl>
<h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">IDL Index</span><a class="self-link" href="#idl-index"></a></h2>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed③"><c- g>Exposed</c-></a>=<c- n>Window</c->, <a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#SecureContext" id="ref-for-SecureContext②"><c- g>SecureContext</c-></a>]
<c- b>interface</c-> <a href="#audiomediatrackworklet"><code><c- g>AudioMediaTrackWorklet</c-></code></a>: <a class="n" data-link-type="idl-name" href="https://drafts.css-houdini.org/worklets/#worklet" id="ref-for-worklet①"><c- n>Worklet</c-></a> {
};
// This object is created by the application in order to instantiate
// a worklet containing the AudioMediaTrackProcessor.
[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed①①"><c- g>Exposed</c-></a>=<c- n>Window</c->, <a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#SecureContext" id="ref-for-SecureContext①①"><c- g>SecureContext</c-></a>,
<a href="#dom-audiomediatracknode-audiomediatracknode"><code><c- g>Constructor</c-></code></a>(<a class="n" data-link-type="idl-name"><c- n>MediaStreamTrack</c-></a> <a href="#dom-audiomediatracknode-audiomediatracknode-inputtrack-options-inputtrack"><code><c- g>inputTrack</c-></code></a>, <a class="n" data-link-type="idl-name" href="#mediatracknodeoptions" id="ref-for-mediatracknodeoptions③"><c- n>MediaTrackNodeOptions</c-></a> <a href="#dom-audiomediatracknode-audiomediatracknode-inputtrack-options-options"><code><c- g>options</c-></code></a>)]
<c- b>interface</c-> <a href="#audiomediatracknode"><code><c- g>AudioMediaTrackNode</c-></code></a> {
<c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name"><c- n>MediaStreamTrack</c-></a>? <a data-readonly data-type="MediaStreamTrack?" href="#dom-audiomediatracknode-outputtrack"><code><c- g>outputTrack</c-></code></a>;
};
// These parameters characterize a particular call to process().
<c- b>interface</c-> <a href="#parameters"><code><c- g>Parameters</c-></code></a> {
<c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long①"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <a data-readonly data-type="unsigned long long" href="#dom-parameters-currentsample"><code><c- g>currentSample</c-></code></a>;
<c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-double" id="ref-for-idl-double①"><c- b>double</c-></a> <a data-readonly data-type="double" href="#dom-parameters-currenttime"><code><c- g>currentTime</c-></code></a>;
<c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long" id="ref-for-idl-unsigned-long②"><c- b>unsigned</c-> <c- b>long</c-></a> <a data-readonly data-type="unsigned long" href="#dom-parameters-samplecount"><code><c- g>sampleCount</c-></code></a>;
};
// Format of samples. TODO: Figure out if there’s a common practice
// that we should refer to rather than defining our own enum.
<c- b>enum</c-> <a href="#enumdef-sampleformat"><code><c- g>SampleFormat</c-></code></a> {
<a href="#dom-sampleformat-float32"><code><c- s>"float32"</c-></code></a>,
<a href="#dom-sampleformat-int32"><code><c- s>"int32"</c-></code></a>,
};
// these options are given by the platform and cannot be changed by the user
<c- b>interface</c-> <a href="#mediatrackplatformoptions"><code><c- g>MediaTrackPlatformOptions</c-></code></a> {
<c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="#enumdef-sampleformat" id="ref-for-enumdef-sampleformat①"><c- n>SampleFormat</c-></a> <a data-readonly data-type="SampleFormat" href="#dom-mediatrackplatformoptions-sampleformat"><code><c- g>sampleFormat</c-></code></a>;
<c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long" id="ref-for-idl-unsigned-long①①"><c- b>unsigned</c-> <c- b>long</c-></a> <a data-readonly data-type="unsigned long" href="#dom-mediatrackplatformoptions-channelcount"><code><c- g>channelCount</c-></code></a>;
<c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-float" id="ref-for-idl-float①"><c- b>float</c-></a> <a data-readonly data-type="float" href="#dom-mediatrackplatformoptions-samplerate"><code><c- g>sampleRate</c-></code></a>;
};
// These are specified by the instantiator at node creation time
<c- b>interface</c-> <a href="#mediatracknodeoptions"><code><c- g>MediaTrackNodeOptions</c-></code></a> {
<c- b>attribute</c-> <a class="n" data-link-type="idl-name"><c- n>bool</c-></a> <a data-type="bool" href="#dom-mediatracknodeoptions-producesoutput"><code><c- g>producesOutput</c-></code></a>;
};
// The processor object is created by the platform when creating
// an AudioMediaTrackNode
[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed②①"><c- g>Exposed</c-></a>=<c- n>AudioMediaTrackWorklet</c->,
<a href="#dom-audiomediatrackprocessor-audiomediatrackprocessor"><code><c- g>Constructor</c-></code></a> (<a class="n" data-link-type="idl-name" href="#mediatrackplatformoptions" id="ref-for-mediatrackplatformoptions②"><c- n>MediaTrackPlatformOptions</c-></a> <a href="#dom-audiomediatrackprocessor-audiomediatrackprocessor-platformoptions-useroptions-platformoptions"><code><c- g>platformOptions</c-></code></a>,
<c- b>optional</c-> <a class="n" data-link-type="idl-name" href="#mediatracknodeoptions" id="ref-for-mediatracknodeoptions①①"><c- n>MediaTrackNodeOptions</c-></a> <a href="#dom-audiomediatrackprocessor-audiomediatrackprocessor-platformoptions-useroptions-useroptions"><code><c- g>userOptions</c-></code></a>)]
<c- b>interface</c-> <a href="#audiomediatrackprocessor"><code><c- g>AudioMediaTrackProcessor</c-></code></a> {
<c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/web-messaging.html#messageport" id="ref-for-messageport①"><c- n>MessagePort</c-></a> <a data-readonly data-type="MessagePort" href="#dom-audiomediatrackprocessor-port"><code><c- g>port</c-></code></a>;
<c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="#mediatrackplatformoptions" id="ref-for-mediatrackplatformoptions①①"><c- n>MediaTrackPlatformOptions</c-></a> <a data-readonly data-type="MediaTrackPlatformOptions" href="#dom-audiomediatrackprocessor-platformoptions"><code><c- g>platformOptions</c-></code></a>;
<c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="#mediatracknodeoptions" id="ref-for-mediatracknodeoptions②①"><c- n>MediaTrackNodeOptions</c-></a> <a data-readonly data-type="MediaTrackNodeOptions" href="#dom-audiomediatrackprocessor-useroptions"><code><c- g>userOptions</c-></code></a>;
<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean①"><c- b>boolean</c-></a> <a href="#dom-audiomediatrackprocessor-process"><code><c- g>process</c-></code></a>(<a class="n" data-link-type="idl-name"><c- n>Buffer</c-></a> <a href="#dom-audiomediatrackprocessor-process-input-output-parameters-input"><code><c- g>input</c-></code></a>, <a class="n" data-link-type="idl-name"><c- n>Buffer</c-></a>? <a href="#dom-audiomediatrackprocessor-process-input-output-parameters-output"><code><c- g>output</c-></code></a>, <a class="n" data-link-type="idl-name" href="#parameters" id="ref-for-parameters①"><c- n>Parameters</c-></a> <a href="#dom-audiomediatrackprocessor-process-input-output-parameters-parameters"><code><c- g>parameters</c-></code></a>);
};
</pre>
<aside class="dfn-panel" data-for="parameters">
<b><a href="#parameters">#parameters</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-parameters">3. Interface definition</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="enumdef-sampleformat">
<b><a href="#enumdef-sampleformat">#enumdef-sampleformat</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-enumdef-sampleformat">3. Interface definition</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="mediatrackplatformoptions">
<b><a href="#mediatrackplatformoptions">#mediatrackplatformoptions</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-mediatrackplatformoptions">3. Interface definition</a> <a href="#ref-for-mediatrackplatformoptions①">(2)</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="mediatracknodeoptions">
<b><a href="#mediatracknodeoptions">#mediatracknodeoptions</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-mediatracknodeoptions">3. Interface definition</a> <a href="#ref-for-mediatracknodeoptions①">(2)</a> <a href="#ref-for-mediatracknodeoptions②">(3)</a>
</ul>
</aside>
<script>/* script-dfn-panel */
document.body.addEventListener("click", function(e) {
var queryAll = function(sel) { return [].slice.call(document.querySelectorAll(sel)); }
// Find the dfn element or panel, if any, that was clicked on.
var el = e.target;
var target;
var hitALink = false;
while(el.parentElement) {
if(el.tagName == "A") {
// Clicking on a link in a <dfn> shouldn't summon the panel
hitALink = true;
}
if(el.classList.contains("dfn-paneled")) {
target = "dfn";
break;
}
if(el.classList.contains("dfn-panel")) {
target = "dfn-panel";
break;
}
el = el.parentElement;
}
if(target != "dfn-panel") {
// Turn off any currently "on" or "activated" panels.
queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(function(el){
el.classList.remove("on");
el.classList.remove("activated");
});
}
if(target == "dfn" && !hitALink) {
// open the panel
var dfnPanel = document.querySelector(".dfn-panel[data-for='" + el.id + "']");
if(dfnPanel) {
dfnPanel.classList.add("on");
var rect = el.getBoundingClientRect();
dfnPanel.style.left = window.scrollX + rect.right + 5 + "px";
dfnPanel.style.top = window.scrollY + rect.top + "px";
var panelRect = dfnPanel.getBoundingClientRect();
var panelWidth = panelRect.right - panelRect.left;
if(panelRect.right > document.body.scrollWidth && (rect.left - (panelWidth + 5)) > 0) {
// Reposition, because the panel is overflowing
dfnPanel.style.left = window.scrollX + rect.left - (panelWidth + 5) + "px";
}
} else {
console.log("Couldn't find .dfn-panel[data-for='" + el.id + "']");
}
} else if(target == "dfn-panel") {
// Switch it to "activated" state, which pins it.
el.classList.add("activated");
el.style.left = null;
el.style.top = null;
}
});
</script>