-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.html~
711 lines (621 loc) · 27.7 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>WebAudio guitar amp sim</title>
<script src="js/platform.js"></script>
<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>
<link rel="import" href="WebComponents/polymer.html">
<link rel="import" href="WebComponents/controls.html">
<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>WebAudio-Controls PFA </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</h2>
<p>Author: Michel Buffa (@micbuffa), GUI with the help of Mahdi Wartani.</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>
<!--
<div class="onoffswitch">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" checked onclick="amp.bypass(this);">
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
-->
<p>Press play to preview presets</p>
<audio id="player" controls crossorigin="anonymous" loop>
<source src="assets/audio/g_t_120_30.mp3">
Your browser does not support the audio tag.
</audio>
<!--
Presets:
<select id="QFPresetMenu2">
</select>
-->
<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>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>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>Preamp Volume (turn up if Ks are < 20 or if looking for high saturation levels)</p>
<div class="controls">
<label>0</label>
<input id="OGslider" type="range" value="6" step="0.1" min="0" max="10" oninput="amp.changeOutputGain(this.value);"></input>
<output id="outputGain">6</output>
</div>
<p>Tonestack Bass/Medium/Treble/Presence</p>
<div class="controls">
<label>0</label>
<input id="bassFreqSlider" type="range" value="5" step="0.01" min="0" max="10" oninput="amp.changeBassFilterValue(this.value);"></input>
<output id="bassFreq">5</output>
</div>
<div class="controls">
<label>0</label>
<input id="midFreqSlider" type="range" value="5" step="0.01" min="0" max="10" oninput="amp.changeMidFilterValue(this.value);"></input>
<output id="midFreq">5</output>
</div>
<div class="controls">
<label>0</label>
<input id="trebleFreqSlider" type="range" value="5" step="0.01" min="0" max="10" oninput="amp.changeTrebleFilterValue(this.value);"></input>
<output id="trebleFreq">5</output>
</div>
<div class="controls">
<label>0</label>
<input id="presenceFreqSlider" type="range" value="5" step="0.01" min="0" max="10" oninput="amp.changePresenceFilterValue(this.value);"></input>
<output id="presenceFreq">5</output>
</div>
<p>Post process EQ<p>
<div class="controls">
<label>60Hz</label>
<input id="EQ1slider" type="range" value="-1" step="1" min="-30" max="30" oninput="amp.eq.changeGain(this.value, 0);"></input>
<output id="gain0">-1 dB</output>
</div>
<div class="controls">
<label>170Hz</label>
<input id="EQ2slider" type="range" value="-5" step="1" min="-30" max="30" oninput="amp.eq.changeGain(this.value, 1);"></input>
<output id="gain1">-5 dB</output>
</div>
<div class="controls">
<label>350Hz</label>
<input id="EQ3slider" type="range" value="0" step="1" min="-30" max="30" oninput="amp.eq.changeGain(this.value, 2);"></input>
<output id="gain2">-0 dB</output>
</div>
<div class="controls">
<label>1000Hz</label>
<input id="EQ4slider" type="range" value="4" step="1" min="-30" max="30" oninput="amp.eq.changeGain(this.value, 3);"></input>
<output id="gain3">4 dB</output>
</div>
<div class="controls">
<label>3500Hz</label>
<input id="EQ5slider" type="range" value="13" step="1" min="-30" max="30" oninput="amp.eq.changeGain(this.value, 4);"></input>
<output id="gain4">13 dB</output>
</div>
<div class="controls">
<label>10000Hz</label>
<input id="EQ6slider" type="range" value="11" step="1" min="-30" max="30" oninput="amp.eq.changeGain(this.value, 5);"></input>
<output id="gain5">11 dB</output>
</div>
<p>Master Volume </p>
<div class="controls">
<label>0</label>
<input id="MVslider" type="range" value="1" step="0.01" min="0" max="10" oninput="amp.changeMasterVolume(this.value);"></input>
<output id="MVOutputGain">2.6</output>
</div>
<br>
<label for="convolverSlider">Reverb (Dry/Wet)</label>
<input type="range" min="0" max="10" step="0.1" value="2" id="convolverSlider" oninput="amp.changeReverb(this.value);"/>
<output id="reverbGainOutput">2</output>
-->
<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="impulsesCabinet">
</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;">
<webaudio-knob id="Knob1" step="0.1" log=false 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 id="Knob2" step="0.1" log=false 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>
<webaudio-knob id="Knob3" log=false 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 id="Knob4" log=false 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 id="Knob5" log=false 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 id="Knob6" log=false 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 id="Knob7" log=false 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="impulses">
</select>
<webaudio-knob id="Knob8" log=false 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>
<webaudio-slider 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 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 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 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 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 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 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 id="led" style="position:absolute;left:1048px;top:125px" src="img/led_23_red.png" value="1" height="23" width="23" tooltip="Switch-B"></webaudio-switch>
<webaudio-switch 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:750px;top:270px" type="button" onclick="initPresets()">Initialiser Liste</button>
-->
<button style="position:absolute;left:570px;top:270px" type="button" onclick="showCurrentSettings()">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 id="Knob9" log=false 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 id="Knob10" log=false 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>
<!--
<button style="position:absolute;left:650px;top:270px" type="button" onclick="Refresh()">Refresh liste</button>
-->
<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.changeReverb(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 message="";
var log=[];
var knobs = document.getElementsByTagName('webaudio-knob');
for(var i = 0; i < knobs.length; i++)
knobs[i].addEventListener('change',Dump,false);
var sliders = document.getElementsByTagName('webaudio-slider');
for(var i = 0; i < sliders.length; i++)
sliders[i].addEventListener("change",Dump,false);
var switches = document.getElementsByTagName('webaudio-switch');
for(var i = 0; i < switches.length; i++) {
switches[i].addEventListener("change",Dump,false);
}
var buttonled = document.getElementsByTagName('led');
function Dump(e) {
/*
var x = knobs[1].value;
var str="";
if(e.target.id=="switch1") {
str="switch1 + led ";
if(switches[1].value==1)
//switches[1].setValue(0,false);
else
//switches[1].setValue(1,false);
}
else
if(e.target.id=="webaudio-knob") {
str="webaudio-knob change capter ";
}
else
str=e.type + " : " + e.target.id + " : " + e.target.value + " ";
console.log(str);
log.unshift(str);
log.length=20;
str="";
for(var i=19;i>=0;--i) {
if(log[i])
str+=log[i]+"<br/>";
}
var evview=document.getElementById("events");
evview.innerHTML=str;
evview.scrollTop=evview.scrollHeight;
*/
}
</script>
<script type="text/javascript">
var presets = [];
var menuPresets = document.querySelector("#QFPresetMenu");
function initPresets() {
preset1 = {
name: 'fender clean',
volume: 5,
bass: 5,
Treble: 5,
Master:5,
Midlle: 5,
Lead:5,
Reverb:5,
Presence: 5,
slider1: 0,
slider2: 10,
slider3: 0,
slider4: 24,
slider5: 3,
slider6: 0,
};
presets.push(preset1);
preset2 = {
name: 'Marshall 1',
volume: 0,
bass: 0,
Treble: 0,
Master:0,
Midlle: 0,
Lead:0,
Reverb:0,
Presence: 0,
slider1: 0,
slider2: 5,
slider3: 24,
slider4: 24,
slider5: 0,
slider6: 0,
};
presets.push(preset2);
preset3 = {
name: 'Marshall 2',
volume: 2,
bass: 2,
Treble: 2,
Master:2,
Midlle: 2,
Lead:2,
Reverb:2,
Presence: 2,
slider1: 5,
slider2: 10,
slider3: -20,
slider4: 24,
slider5: -6,
slider6: 7,
};
presets.push(preset3);
preset4 = {
name: 'Fender crunch',
volume: 8,
bass: 8,
Treble: 8,
Master:8,
Midlle: 8,
Lead:8,
Reverb:8,
Presence: 8,
slider1: 1,
slider2: 2,
slider3: 3,
slider4: 24,
slider5: 8,
slider6: 9,
};
presets.push(preset4);
preset5 = {
name: 'Fender crunch 2',
volume: 10,
bass: 10,
Treble: 10,
Master:10,
Midlle: 0,
Lead:0,
Reverb:0,
Presence: 0,
slider1: 10,
slider2: 20,
slider3: 0,
slider4: 24,
slider5: -20,
slider6: 5,
};
presets.push(preset5);
presets.forEach(function(p, index) {
var option = document.createElement("option");
option.value = index;
option.text = p.name;
menuPresets.appendChild(option);
});
menuPresets.onchange = changePreset;
}
function removepresets(){
var opts = document.getElementsByTagName('option');
for (var i = 0; i < opts.length; i++) {
menuPresets.removeChild(opts[i]);
}
}
function Refresh() {
removepresets();
for(var i = 0; i < presets.length; i++) {
var option = document.createElement("option");
option.value = i;
option.text = presets.getName(i);
menuPresets.appendChild(option);
}
}
function changePreset() {
setPreset(presets[menuPresets.value]);
}
function showCurrentSettings() {
amp.printCurrentAmpValues();
}
function sauvgarder() {
var str=" mahdi set ";
var evview=document.getElementById("events");
evview.innerHTML=str;
evview.scrollTop=evview.scrollHeight;
var x1= document.getElementById("Knob1");
var x2= document.getElementById("Knob2");
var x3= document.getElementById("Knob3");
var x4= document.getElementById("Knob4");
var x5= document.getElementById("Knob5");
var x6= document.getElementById("Knob6");
var x7= document.getElementById("Knob7");
var x8= document.getElementById("Knob8");
var nombre =menuPresets.length + 1;
var pres={
name: 'preset'+ " "+nombre,
volume: x1.value,
bass: x2.value,
Treble: x3.value,
Master:x4.value,
Midlle: x5.value,
Lead:x6.value,
Reverb:x7.value,
Presence: x8.value,
slider1: 0,
slider2: 0,
slider3: 0,
slider4: 24,
slider5: 0,
slider6: 0,
}; presets.push(pres);
}
function setPreset(p) {
Redessinerknobs(p);
Redessinersliders(p);
}
function Redessinerknobs(p) {
var str=" Knobs ";
var evview=document.getElementById("events");
evview.innerHTML=str;
evview.scrollTop=evview.scrollHeight;
var x1= document.getElementById("Knob1");
var x2= document.getElementById("Knob2");
var x3= document.getElementById("Knob3");
var x4= document.getElementById("Knob4");
var x5= document.getElementById("Knob5");
var x6= document.getElementById("Knob6");
var x7= document.getElementById("Knob7");
var x8= document.getElementById("Knob8");
x1.value=p.volume;
x2.value=p.bass;
x3.value=p.Treble;
x4.value=p.Master;
x5.value=p.Midlle;
x6.value=p.Lead;
x7.value=p.Reverb;
x8.value=p.Presence;
x1.redraw();x2.redraw();
x3.redraw();x4.redraw();
x5.redraw();x6.redraw();
x7.redraw();x8.redraw();
}
function Redessinersliders(p) {
var x1= document.getElementById("slider1");
var x2= document.getElementById("slider2");
var x3= document.getElementById("slider3");
var x4= document.getElementById("slider4");
var x5= document.getElementById("slider5");
var x6= document.getElementById("slider6");
x1.setValue(p.slider1,false);x2.setValue(p.slider2,false);
x3.setValue(p.slider3,false);x4.setValue(p.slider4,false);
x5.setValue(p.slider5,false);x6.setValue(p.slider6,false);
}
function EcrirePreset() {
var str=" mahdi set ";
var evview=document.getElementById("events");
evview.innerHTML=str;
evview.scrollTop=evview.scrollHeight;
}
function getPresets() {
return presets;
}
function setDefaultPreset() {
setPreset(preset1);
}
</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</strong></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>