-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.html
369 lines (329 loc) · 23.3 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>WebAudio guitar amp sim</title>
<script src="js/adapter.js"></script>
<script src="js/initAudio.js"></script>
<script src="js/visualization.js"></script>
<script src="js/amp.js"></script>
<script src="js/utils.js"></script>
<script src="js/distorsionFactory.js"></script>
<script src="js/curveDrawer.js"></script>
<script src="./bower_componentsv2/webcomponentsjs/webcomponents-lite.min.js"></script>
<link rel="import" href="./bower_componentsv2/polymer/polymer.html">
<link rel="import" href="./webaudio-controls.html">
<script>UseWebAudioControlsMidi=1</script>
<link rel="stylesheet" charset="UTF-8" href="css/translateelement.css">
<link rel="stylesheet" charset="UTF-8" href="css/amp.css">
<style type="text/css">
table {
border: 1px solid #666;
}
table td {
border: 1px solid #bbb;
}
</style>
</head>
<body style="background-color:#eee;">
<h1>Clean Machine with midi learn support</h1>
<!-- Amp jsbin -->
<b>Expérimental (not working yet...):</b>
<div class="select">
<label for="audioSource">Audio input source: </label><select id="audioSource"></select>
</div>
<div class="select">
<label for="audioOutput">Audio output destination: </label><select id="audioOutput"></select>
</div>
<h2>Guitar amp emulation made with the Web Audio API: : <a href="../AmpSim3">TRY NEW VERSION HERE!</h2>
<p>Author: Michel Buffa (@micbuffa), GUI with the help of Mahdi Wartani.</p>
<p><a href="https://github.com/micbuffa/WebAudio-Guitar-Amplifier-Simulator/blob/master/README.md" target="_blank">You may visit the GitHub repo.</a></p>
<p><b>You need Google Chrome (the app should support soon other browsers) + don't forget to set the default input in your OS preferences. If you plugged a guitar in, then press the pulsing button in the middle of the Amp to activate it. Otherwise you can try the amp with the audio player on the left, press play and use the preset menu or the buttons/sliders.</b></p>
<p>Signal goes first throught hicut and low cut filters, then through 4 filters (F and Q), then to a distorsion stage (Ks), then to a tonestack (B/M/T/P) then to a master volume. It is then post processed by the EQ and a reverb, for fine tuning the tone, set the EQ after the rest. Finally there is a cabinet simulator (bottom of advanced settings).<br>
Check <a href="http://jsbin.com/cixiri/edit?js,console,output" target="_blank">this</a> to understand how filters work.
<article style="display: flex; flex-direction: row; width:100%">
<section style="flex: 1;">
<div class="eq">
<h2>Advanced settings</h2>
<p>Press play to preview presets</p>
<audio id="player" controls loop>
<source src="assets/audio/BasketCase Greenday riff DI.mp3">
<source src="assets/audio/BasketCase Greenday riff DI.ogg">
Your browser does not support the audio tag.
</audio>
<div id="demoSample">Choose a demo sample:
<select id="demoSampleMenu" onchange="changeDemoSample(this.value);">
<option value="0">Metal riff 1</option>
<option value="1">Metal riff 2</option>
<!--
<option value="2">Blues solo 1</option>
-->
<option value="3">Cool rythm</option>
<option value="4">Trash metal</option>
<option value="5">Black Sabbath Rythm</option>
<option value="6">Black Sabbath Solo</option>
<option value="7">Basketcase Riff</option>
<option value="8">In Bloom riff</option>
<option value="9">Muse solo</option>
<option value="10">Muse rythm</option>
<!--
<option value="11">Simple guitar riff</option>
-->
</select>
</div>
<p>Low and high cut frequencies</p>
<div class="controls">
<label>Low</label>
<input id="lowCutFreqSlider" type="range" value="20" step="1" min="10" max="350" oninput="amp.changeLowCutFreqValue(this.value, 0);"></input>
<output id="lowCutFreq">20 Hz</output>
</div>
<div class="controls">
<label>High</label>
<input id="hiCutFreqSlider" type="range" value="10000" step="1" min="7000" max="20000" oninput="amp.changeHicutFreqValue(this.value, 0);"></input>
<output id="hiCutFreq">10000 Hz</output>
</div>
<p>Cut off frequencies (low, mid1, mid2, high)</p>
<div class="controls">
<label>F1</label>
<input id="F1slider" type="range" value="147" step="1" min="70" max="300" oninput="amp.changeFreqValues(this.value, 0);"></input>
<output id="freq0">147 Hz</output>
</div>
<div class="controls">
<label>F2</label>
<input id="F2slider" type="range" value="569" step="1" min="300" max="1200" oninput="amp.changeFreqValues(this.value, 1);"></input>
<output id="freq1">569 Hz</output>
</div>
<div class="controls">
<label>F3</label>
<input id="F3slider" type="range" value="1200" step="1" min="1200" max="3500" oninput="amp.changeFreqValues(this.value, 2);"></input>
<output id="freq2">1200 Hz</output>
</div>
<div class="controls">
<label>F4</label>
<input id="F4slider" type="range" value="3500" step="1" min="3500" max="7000" oninput="amp.changeFreqValues(this.value, 3);"></input>
<output id="freq3">3500 Hz</output>
</div>
<p>Presence (Q3, Q4), resonnance (Q1, Q2) associated to filters above...</p>
<div class="controls">
<label>Q1</label>
<input id="Q1slider" type="range" value="1" step="0.1" min="0" max="5" oninput="amp.changeQValues(this.value, 0);"></input>
<output id="q0">1</output>
</div>
<div class="controls">
<label>Q2</label>
<input id="Q2slider" type="range" value="10" step="0.1" min="0" max="30" oninput="amp.changeQValues(this.value, 1);"></input>
<output id="q1">10</output>
</div>
<div class="controls">
<label>Q3</label>
<input id="Q3slider" type="range" value="10" step="0.1" min="0" max="30" oninput="amp.changeQValues(this.value, 2);"></input>
<output id="q2">10</output>
</div>
<div class="controls">
<label>Q4</label>
<input id="Q4slider" type="range" value="5" step="0.1" min="0" max="17" oninput="amp.changeQValues(this.value, 3);"></input>
<output id="q3">5</output>
</div>
<p>
<p>DRIVE : distorsion levels (per band, low, mid1, mid2, high)
<div class="controls">
<label>K1</label>
<input id="K1slider" type="range" value="0" step="0.1" min="0" max="10" oninput="amp.changeDistorsionValues(this.value, 0);"></input>
<output id="k0">0</output>
</div>
<div class="controls">
<label>K2</label>
<input id="K2slider" type="range" value="0" step="0.1" min="0" max="10" oninput="amp.changeDistorsionValues(this.value, 1);"></input>
<output id="k1">10</output>
</div>
<div class="controls">
<label>K3</label>
<input id="K3slider" type="range" value="0" step="0.1" min="0" max="10" oninput="amp.changeDistorsionValues(this.value, 2);"></input>
<output id="k2">15</output>
</div>
<div class="controls">
<label>K4</label>
<input id="K4slider" type="range" value="0" step="0.1" min="0" max="10" oninput="amp.changeDistorsionValues(this.value, 3);"></input>
<output id="k3">15</output>
</div>
<p>
<div class="onoffswitch">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" onclick="amp.changeOversampling(this);">
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
<p>
<label for="convolverCabinetSlider">Cabinet Simulator (Dry/Wet)</label>
<input type="range" min="0" max="10" step="0.1" value="2" id="convolverCabinetSlider" oninput="amp.changeRoom(this.value);"/>
<output id="cabinetGainOutput">2</output>
<p>
Cabinet impulse:
<select id="cabinetImpulses">
</select>
</div>
<!-- end amp jsbin -->
</section>
<section style="flex: 4; order: 1;">
<div class="ampGUI" style="position:relative;background-image: url('img/imageprincipalefinienew.png');width:1127px;height:545px;padding:0px;">
<div>
<webaudio-knob midilearn=true id="Knob1" step="0.1" style="position:absolute;left:66px;top:90px" src="img/Prophet.png" value="0" min="0" max="10" diameter="69" sprites="99" tooltip="Volume" ></webaudio-knob>
<webaudio-knob midilearn=true id="Knob2" step="0.1" style="position:absolute;left:136px;top:90px" src="img/Prophet.png" value="5" min="0" max="10" diameter="69" sprites="99" tooltip="Treble"></webaudio-knob>
<!-- boost button -->
<label style="color:white;position:absolute;left:70px;top:64px">Clean / Disto : </label>
<!--
<webaudio-switch style="color:white; position:absolute;left:225px;top:58px" id="toggleBoost" value="0" src="img/led.png" tooltip="Toggle clean/disto channel"></webaudio-switch>
-->
<webaudio-switch midilearn=true style="color:white; position:absolute;left:170px;top:58px" id="toggleBoost" value="0" src="img/boostSwitch.png" tooltip="Toggle clean/disto channel"></webaudio-switch>
<!-- drive knob -->
<webaudio-knob midilearn=true id="Knob3" style="position:absolute;left:207px;top:90px" src="img/Prophet.png" value="0" step="0.1" min="0" max="10" diameter="69" sprites="99" tooltip="Bass"></webaudio-knob>
<select style="position:absolute;left:190px;top:190px" id="distorsionMenu">
</select>
<webaudio-knob midilearn=true id="Knob4" style="position:absolute;left:275px;top:90px" src="img/Prophet.png" value="0" min="0" max="10" step="0.1" diameter="69" sprites="99" tooltip="Master"></webaudio-knob>
<webaudio-knob midilearn=true id="Knob5" style="position:absolute;left:345px;top:90px" src="img/Prophet.png" value="0" min="0" max="10" step="0.1" diameter="69" sprites="99" tooltip="Midlle"></webaudio-knob>
<webaudio-knob midilearn=true id="Knob6" style="position:absolute;left:415px;top:90px" src="img/Prophet.png" value="0" min="0" max="10" step="0.1" diameter="69" sprites="99" tooltip="Lead Master"></webaudio-knob>
<webaudio-knob midilearn=true id="Knob7" style="position:absolute;left:486px;top:90px" src="img/Prophet.png" value="0" min="0" max="10" step="0.1" diameter="69" sprites="99" tooltip="Reverb"></webaudio-knob>
<select style="position:absolute;left:455px;top:190px" id="reverbImpulses">
</select>
<webaudio-knob midilearn=true id="Knob8" style="position:absolute;left:557px;top:90px" src="img/Prophet.png" value="0" min="0" max="10" step="0.1" diameter="69" sprites="99" tooltip="Presence"></webaudio-knob>
</div>
<webaudio-slider midilearn=true id="slider1" style="position:absolute;left:731px;top:64px" src="img/vsliderbody.png" knobsrc="img/vsliderknob.png" value="-30" min="-30" max="30" step="1" basewidth="24" baseheight="128" knobwidth="24" knobheight="24" ditchLength="100" tooltip="Slider1"></webaudio-slider>
<webaudio-slider midilearn=true id="slider2" Units="Db" style="position:absolute;left:774px;top:64px" src="img/vsliderbody.png" knobsrc="img/vsliderknob.png" value="-30" min="-30" max="30" step="1" basewidth="24" baseheight="128" knobwidth="24" knobheight="24" ditchLength="100" tooltip="Slider2"></webaudio-slider>
<webaudio-slider midilearn=true id="slider3" Units="Db" style="position:absolute;left:819px;top:64px" src="img/vsliderbody.png" knobsrc="img/vsliderknob.png" value="-30" min="-30" max="30" step="1" basewidth="24" baseheight="128" knobwidth="24" knobheight="24" ditchLength="100" tooltip="Slider3"></webaudio-slider>
<webaudio-slider midilearn=true id="slider4" Units="Db" style="position:absolute;left:865px;top:64px" src="img/vsliderbody.png" knobsrc="img/vsliderknob.png" value="-30" min="-30" max="30" step="1" basewidth="24" baseheight="128" knobwidth="24" knobheight="24" ditchLength="100" units="%" tooltip="Slider4"></webaudio-slider>
<webaudio-slider midilearn=true id="slider5" Units="Db" style="position:absolute;left:908px;top:64px" src="img/vsliderbody.png" knobsrc="img/vsliderknob.png" value="-30" min="-30" max="30" step="1" basewidth="24" baseheight="128" knobwidth="24" knobheight="24" ditchLength="100" tooltip="Slider5"></webaudio-slider>
<webaudio-slider midilearn=true id="slider6" Units="Db" style="position:absolute;left:951px;top:64px" src="img/vsliderbody.png" knobsrc="img/vsliderknob.png" value="-30" min="-30" max="30" step="1" basewidth="24" baseheight="128" knobwidth="24" knobheight="24" ditchLength="100" units="%" tooltip="Slider6"></webaudio-slider>
<webaudio-switch midilearn=true id="switch1" style="position:absolute;left:1033px;top:72px" src="img/switch_toggle.png" value="0" height="45" width="45" tooltip="Switch-A Tooltip text test"></webaudio-switch>
<webaudio-switch midilearn=true id="led" style="position:absolute;left:1043px;top:125px" src="img/led_23_red.png" value="1" height="23" width="23" tooltip="Switch-B"></webaudio-switch>
<webaudio-switch midilearn=true id="switch2" style="position:absolute;left:1033px;top:140px" src="img/switch_toggle.png" value="0" height="45" width="45" tooltip="Switch-B"></webaudio-switch>
<button style="position:absolute;left:570px;top:270px" type="button" onclick="amp.printCurrentAmpValues();">Show current settings in console</button>
<button id="toggleGuitarIn" style="position:absolute;left:570px;top:300px" class="pulse" type="button" onclick="toggleGuitarInput(event)">Guitar input: <span style='color:red;'>NOT ACTIVATED</span>, click to toggle on/off!</button>
<webaudio-knob midilearn=true id="Knob9" style="position:absolute;left:570px;top:350px" src="img/Prophet.png" value="1" default="1" min="0" max="10" step="0.1" diameter="49" sprites="99" tooltip="InputGain"></webaudio-knob>
<canvas id="inputSignalCanvas" style="position:absolute;left:630px;top:350px" width=150 height=50></canvas>
<div style="color:white; position:absolute;left:560px;top:405px">Input Gain
</div>
<webaudio-knob midilearn=true id="Knob10" style="position:absolute;left:780px;top:350px" src="img/Prophet.png" value="5" default="5" min="0" max="10" step="0.1" diameter="49" sprites="99" tooltip="OutputGain"></webaudio-knob>
<canvas id="outputSignalCanvas" style="position:absolute;left:830px;top:350px" width=150 height=50></canvas>
<div style="color:white; position:absolute;left:763px;top:405px">Output Gain
</div>
<label for="QFPresetMenu2" style="color:white; position:absolute;left:790px;top:270px">Presets :</label>
<select id="QFPresetMenu2" style="position:absolute;left:850px;top:270px"></select>
<p><div style="color:white; position:absolute;left:100px;top:385px">
<canvas id="distoDrawerCanvas" style="margin-right:20px;left-margin:20px;" width="100" height="100"></canvas>
<canvas id="signalDrawerCanvas" width="100" height="100"></canvas>
</div>
<div style="color:white; position:absolute;left:100px;top:495px">Transfer function and distorded signal example...
</div>
</section>
</article>
<div class="events" id="events" style="background:rgba(128,128,255,0.5);overflow:scroll"></div>
<script type="text/javascript">
// Binding avec le vrai ampli
// Volume
var volumeOutputPreAmp = document.querySelector("#Knob1");
volumeOutputPreAmp.addEventListener("change", function (evt) {
amp.changeOutputGain(evt.target.value);
});
// Master Volume
var masterVolume = document.querySelector("#Knob2");
masterVolume.addEventListener("change", function (evt) {
amp.changeMasterVolume(evt.target.value);
});
// Drive
var drive = document.querySelector("#Knob3");
drive.addEventListener("change", function (evt) {
amp.changeDrive(evt.target.value);
});
// Bass
var bass = document.querySelector("#Knob4");
bass.addEventListener("change", function (evt) {
amp.changeBassFilterValue(evt.target.value);
});
// Middle
var mid = document.querySelector("#Knob5");
mid.addEventListener("change", function (evt) {
amp.changeMidFilterValue(evt.target.value);
});
// Treble
var treble = document.querySelector("#Knob6");
treble.addEventListener("change", function (evt) {
amp.changeTrebleFilterValue(evt.target.value);
});
// Reverb
var reverb = document.querySelector("#Knob7");
reverb.addEventListener("change", function (evt) {
amp.changeReverbGain(evt.target.value);
});
// Presence
var presence = document.querySelector("#Knob8");
presence.addEventListener("change", function (evt) {
amp.changePresenceFilterValue(evt.target.value);
});
// input gain
var inputGain = document.querySelector("#Knob9");
inputGain.addEventListener("change", function (evt) {
amp.changeInputGainValue(evt.target.value);
});
// output gain
var outputGain = document.querySelector("#Knob10");
outputGain.addEventListener("change", function (evt) {
amp.changeOutputGainValue(evt.target.value);
});
// Equalizer
for (var i = 1; i < 7; i++) {
createListenerForEQ(i);
}
function createListenerForEQ(i) {
var eq = document.querySelector("#slider" + i);
eq.addEventListener("change", function (evt) {
amp.eq.changeGain(evt.target.value, i - 1);
});
}
// On / Off switch
var onOff = document.querySelector("#switch1");
onOff.addEventListener("change", function (evt) {
var state = {};
if (evt.target.value == 1) {
state.checked = false;
} else {
state.checked = true;
}
amp.bypass(state);
});
// EQ on/off switch
var eqOnOff = document.querySelector("#switch2");
eqOnOff.addEventListener("change", function (evt) {
var state = {};
if (evt.target.value == 1) {
state.checked = false;
} else {
state.checked = true;
}
amp.bypassEQ(state);
});
var boostOnOff = document.querySelector("#toggleBoost");
boostOnOff.addEventListener("change", function (evt) {
var state = {};
if (evt.target.value == 1) {
state.checked = false;
} else {
state.checked = true;
}
amp.boostOnOff(state);
});
</script>
<div>
<table>
<tr><th>Operation</th><th>Component</th><th>Description</th></tr>
<tr><td><b>Click</b></td><td>Switch/Param</td><td>toggle / activate the switch or focus the param</td></tr>
<tr><td><b>Drag</b></td><td>Knob/Slider</td><td>up/right to increase value / down/left to decrease value</td></tr>
<tr><td><b>Shift+Drag</b></td><td>Knob/Slider</td><td>fine control</td></tr>
<tr><td><b>Ctrl+Click/Command+Click</b></td><td>Knob/Slider/Switch</td><td>set to default value</td></tr>
<tr><td><b>Edit with Keyboard</b></td><td>Param</td><td>edit the value directly</td></tr>
<tr><td><b>MouseWheel</b></td><td>Knob/Slider</td><td>rotate upward to increase value / downward to decrease value</td></tr>
<tr><td><b>Shift+MouseWheel</b></td><td>Knob/Slider</td><td>fine control</td></tr>
</table>
</div>
</body>
</html>