-
Notifications
You must be signed in to change notification settings - Fork 283
Expand file tree
/
Copy pathtear_down2_virtual.html
More file actions
37 lines (34 loc) · 949 Bytes
/
tear_down2_virtual.html
File metadata and controls
37 lines (34 loc) · 949 Bytes
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
<!DOCTYPE html>
<html>
<head>
<script>
const inputs = 1;
function sleep(miliseconds) {
var currentTime = new Date().getTime();
while (currentTime + miliseconds >= new Date().getTime()) {
}
}
async function playSourceNode(audioContext) {
let soundSource1 = audioContext.createConstantSource();
await audioContext.audioWorklet.addModule('tear-down.js');
let worklet;
worklet = new AudioWorkletNode(audioContext, 'tear-down');
let delay = audioContext.createDelay(0.01);
soundSource1.connect(worklet).connect(delay).connect(audioContext.destination);
soundSource1.start();
return [soundSource1, worklet];
}
function onLoad() {
let audioCtx = new OfflineAudioContext(1,44100, 44100);
playSourceNode(audioCtx).then((src)=>{
audioCtx.startRendering();
sleep(200);
src[0].disconnect();
src[1].disconnect();
parent.removeVirtual();
});
}
</script>
</head>
<body onload="onLoad()"/>
</html>