forked from khoin/DattorroReverbNode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
170 lines (155 loc) ยท 5.17 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebAudio Dattorro</title>
<style type="text/css">
* { font-family: sans-serif; }
label, input+span { font-family: monospace; font-size: 2ex; line-height: 2.2ex;}
input { height: 2.2ex; }
body {
margin: 20px auto;
max-width: 800px;
padding: 5px;
}
div>label {
width: 33%;
display: inline-block;
}
#controls>div {
display: flex;
align-items:center;
}
</style>
</head>
<body>
<button id="b1">Play kikuo.wav</button> <button id="b2">Play kikuo2.wav</button>
<br><br>
<div id="controls">
<div>
<label>PreLPF _______(๐ป 0 โฌ
โก 1 ๐บ): </label>
<input type="range" id="bw" name="bandwidth" max="1" step="0.0001">
<span id="bwv"></span>
</div>
<div>
<label>PreDiffuse1 __(๐ 0 โฌ
๐โก 1 ๐): </label>
<input type="range" id="fi" name="inputDiffusion1" max="1" step="0.0001">
<span id="fiv"></span>
</div>
<div>
<label>PreDiffuse2___(๐ 0 โฌ
๐โก 1 ๐): </label>
<input type="range" id="si" name="inputDiffusion2" max="1" step="0.0001">
<span id="siv"></span>
</div>
<div>
<label>DecayRate_____(๐ 0 โฌ
โก 1 ๐จ): </label>
<input type="range" id="dc" name="decay" min="0" max="1" step="0.0001">
<span id="dcv"></span>
</div>
<div>
<label>DecayDiffuse__(๐ 0 โฌ
๐โก 1 ๐): </label>
<input type="range" id="ft" name="decayDiffusion1" max="0.999999" step="0.0001">
<span id="ftv"></span>
</div>
<div>
<label>DecayDiffuse2_(๐ 0 โฌ
๐โก 1 ๐): </label>
<input type="range" id="st" name="decayDiffusion2" max="0.999999" step="0.0001">
<span id="stv"></span>
</div>
<div>
<label>Damping_______(๐ป 0 โฌ
โก 1 ๐): </label>
<input type="range" id="dp" name="damping" max="1" step="0.0001">
<span id="dpv"></span>
</div>
<div>
<label>Dry___________(๐ป 0 โฌ
โก 1 ๐บ): </label>
<input type="range" id="dr" name="dry" max="1" step="0.0001">
<span id="drv"></span>
</div>
<div>
<label>Wet___________(๐ป 0 โฌ
โก 1 ๐บ): </label>
<input type="range" id="we" name="wet" max="1" step="0.0001" >
<span id="wev"></span>
</div>
<br>
<div>
<label>๐ท Presets</label>
<button id="smol">roomy owo</button>
<button id="bige">churchy uwu</button>
<button id="frez">freezy ewe</button>
</div>
</div>
<div>
<h2>
dattorro's reverb ๐ฃ
</h2>
<h4>
an (almost) faithful implementation in AudioWorklet. flexible — freezable — fast — free!
</h4>
<p>
๐ช flexible (compared to ConvolverNode) <br>
๐จ freezable (just set decay to 1!) <br>
๐
fast (less than 100 ฮผs each .process() on my machine on battery saving)<br>
๐ free!! (freeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee in so many ways)
</p>
<h3>๐ papers papers papers</h3>
<ul>
<li>AudioWorklet spec [<a href="https://webaudio.github.io/web-audio-api/#audioworklet">winky linky</a>]</li>
<li>Jon Dattorro's paper [<a href="https://ccrma.stanford.edu/~dattorro/EffectDesignPart1.pdf">pdf linky</a>]</li>
</ul>
<h3>๐ผ music music music</h3>
<p>both clips are from Kikuo's Mikukikuo5 under CC BY-NC-SA: former - short fast sounds; latter - pitched.</p>
<ul>
<li>ใซใฉใซใฉใซใฉใฎใซใฉ / Kara Kara Kara no Kara [<a href="https://kikuo.bandcamp.com/track/kara-kara-kara-no-kara">Bandcamp</a>]</li>
<li>MAWARU [<a href="https://kikuo.bandcamp.com/track/mawaru">Bandcamp</a>]</li>
<li>Sea is [<a href="https://kikuo.bandcamp.com/track/sea-is">Bandcamp</a>]</li>
</ul>
<h3>โ
todo todo todo</h3>
<ul>
<li>add excursion (assess performance first)</li>
<li>add predelay</li>
<li>add microphone input to demo</li>
</ul>
<h3>โ license & ๐พ source</h3>
<p> public domain // [<a href="https://github.com/khoin/DattorroReverbNode">repo</a>]</p>
</div>
</body>
<script type="module">
const aC = new AudioContext();
const w1 = new Audio('./kikuo.wav'),
w2 = new Audio('./kikuo2.wav');
const presets = [
[ 0.5683, 0.4666, 0.5853, 0.3226, 0.6954, 0.6022, 0.6446, 0.4921, 0.6361 ],
[ 0.928 , 0.7331, 0.4534, 0.8771, 0.7839, 0.1992, 0.5975, 0.0042, 0.9619 ],
[ 0.999 , 0.75 , 0.625 , 1 , 0.5 , 0.711 , 0.195 , 0.915 , 0.194 ]
];
aC.audioWorklet.addModule('dattorroReverb.js').then(_ => {
let k1 = aC.createMediaElementSource(w1);
let k2 = aC.createMediaElementSource(w2);
let reverb = new AudioWorkletNode(aC, 'DattorroReverb');
k1.connect(reverb);
k2.connect(reverb);
reverb.connect(aC.destination);
b1.onclick = _ => aC.resume() & w1.play();
b2.onclick = _ => aC.resume() & w2.play();
const pull = _ =>
[...document.querySelectorAll("input")]
.forEach(r => r.nextElementSibling.innerText = r.value = reverb.parameters.get(r.name).value);
const push = _ =>
[...document.querySelectorAll("input")]
.forEach(r => reverb.parameters.get(r.name).linearRampToValueAtTime(r.value, aC.currentTime+0.005));
[...document.querySelectorAll("input")]
.forEach(r => r.onmousemove = e => push() & pull());
[smol, bige, frez]
.forEach((b, i) =>
b.onclick = e => {
[bw, fi, si, dc, ft, st, dp, dr, we].forEach((p, j) => p.value = presets[i][j]);
push();
setTimeout(pull, 200);
});
pull();
}, e => {
console.error(e);
});
</script>
</html>