Skip to content

Commit 40a140d

Browse files
authored
Update index.html
1 parent a58fa01 commit 40a140d

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

index.html

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
12
<!DOCTYPE html>
23
<html>
34
<head>
4-
<title>Stream audio from fetch() in Worker to AudioWorklet</title>
5+
<title>Stream audio from Worker to AudioWorklet</title>
56
</head>
67

78
<body>
9+
<pre>
10+
DELTAnine Live at 8X10 on 2013-12-11
11+
(Deltanine121113Pt3Wav.wav size 291MB duration 27:27)</pre
12+
>
813
<button>Start Audio Playback</button>
914
<script>
15+
gc();
1016
// AudioWorkletStream
1117
// Stream audio from Worker to AudioWorklet
1218
// guest271314 2-24-2020
@@ -44,11 +50,7 @@
4450
'audio-data-worklet-stream',
4551
workletOptions
4652
);
47-
aw.onprocessorerror = e => console.error(e);
4853
aw.connect(ac.destination);
49-
// transfer sources, here, e.g.
50-
// Native File System file handle https://github.com/WICG/native-file-system/issues/117
51-
// ReadableStream, WritableStream https://github.com/whatwg/streams/blob/master/transferable-streams-explainer.md
5254
const worker = new Worker('worker.js', {
5355
type: 'module',
5456
});
@@ -59,7 +61,6 @@
5961
[aw.port]
6062
);
6163
worker.onmessage = async e => {
62-
// use suspend(), resume() to synchronize to degree possible
6364
if (e.data.start) {
6465
await ac.resume();
6566
}
@@ -77,31 +78,23 @@
7778
});
7879
}
7980
}
81+
8082
button.onclick = async _ => {
8183
button.disabled = true;
8284
button.textContent = 'Audio Playing';
8385
// set parameters as arrays for potential "infinite" input, output stream
84-
let workletStream = new AudioWorkletStream({
86+
let workletStream = new AudioWorkletStream({
8587
urls: [
86-
/*
87-
'https://ia800301.us.archive.org/10/items/DELTAnine2013-12-11.WAV/Deltanine121113Pt3Wav.wav', // 291MB
88-
*/
89-
'house--64kbs-0-wav',
90-
'house--64kbs-1-wav',
91-
'house--64kbs-2-wav',
92-
'house--64kbs-3-wav'
88+
'https://ia800301.us.archive.org/10/items/DELTAnine2013-12-11.WAV/Deltanine121113Pt3Wav.wav',
9389
],
9490
latencyHint: 1.0,
9591
workletOptions: {
96-
numberOfInputs: 2,
92+
numberOfInputs: 1,
9793
numberOfOutputs: 2,
9894
channelCount: 2,
9995
processorOptions: {
100-
buffers: new Map(),
10196
codec: 'audio/wav',
102-
processStarted: false,
103-
i: 0,
104-
n: 0,
97+
offset: 0
10598
},
10699
},
107100
});

0 commit comments

Comments
 (0)