-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmolgav.js
13133 lines (12716 loc) · 450 KB
/
molgav.js
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
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
function App() {
var me = this;
this.mixer = new Mixer();
this.compiler = new MidiCompiler();
this.messages = [];
this.song = new Song();
this.position = null;
this.cache = new Cache();
this.renderer = new Renderer();
this.select = new Select();
this.audioBufferSourceNode = null;
this.audioContext = null;
this.playOn = false;
//this.openedSlotId = null;
this.instanceID = "";
this.mixerMode=1;
this.tapSizeMode=1;
this.renderSlotStep=false;
//this.storeExamples=new StoreExamples();
this.init = function () {
/*
var aaa={
saved:true,
message:"dfsfbsgfb"
};
console.log(JSON.stringify(aaa));
*/
console.log("App.init");
try {
me.instanceID = 1.0 * readTexFromStorage("instanceID");
if (me.instanceID < 1) {
me.instanceID = randomKey();
saveTexToStorage("instanceID", "" + me.instanceID);
}
console.log(me.instanceID);
//me.readTexFromStorage
//saveTexToStorage("mixRealTime", me.mixRealTime?"1":"0");
app.mixerMode = readNumFromStorage("mixerMode",1,1,3);
app.mixerMode=1;
app.tapSizeMode = readNumFromStorage("tapSizeMode",1,2,3);
calcTapSize(me.tapSizeMode);
//me.mixerMode = (mx == "1");
var t = readTexFromStorage("last");
//console.log(t);
var o = JSON.parse(t);
if (o != null) {
me.song = o;
//console.log("last",me.song);
toolbox.adjustSamples(app.song);
//console.log(me.song);
//console.log("t.length " + t.length);
//var compressed = LZString.compressToBase64(t);
//console.log("compressed.length " + compressed.length);
//console.log(compressed);
/*
var r1 = app.song.riffs[1];
//toolbox.findRiffById(238335, app.song);
var r2 = app.song.riffs[3];
//toolbox.findRiffById(639294, app.song);
for (var i = 0; i < r1.tunes[0].steps.length; i++) {
var a1 = r1.tunes[0].steps[i][0];
var a2 = r2.tunes[0].steps[i][0];
console.log(a1.pitch + "/" + a1.length + " : " + a2.pitch + "/" + a2.length);
if (r1.tunes[0].steps[i].length > 1) {
a1 = r1.tunes[0].steps[i][1];
a2 = r2.tunes[0].steps[i][1];
console.log(" " + a1.pitch + "/" + a1.length + " : " + a2.pitch + "/" + a2.length);
}
}*/
console.log("last",me.song);
} else {
console.log("can't load last");
}
} catch (e) {
console.log(e);
}
me.renderer.init();
me.renderer.layers[me.renderer.layers.length] = me.select;
me.resize();
me.renderer.loadSettings(me.song);
var songPosition = toolbox.findPosition(app.song.selectedPositionId, app.song, true);
if (songPosition != null) {
me.showPosition(songPosition);
} else {
me.showSong();
}
me.renderer.fireRender();
console.log("App.init done");
};
this.done = function () {
console.log("App.done");
me.blur();
};
this.resize = function () {
console.log("App.resize " + window.innerWidth + "x" + window.innerHeight);
me.renderer.onResize();
};
this.focus = function () {
console.log("App.focus");
me.renderer.fireRender();
};
this.blur = function () {
console.log("App.blur");
me.stopAudio5();
me.renderer.saveSettings(me.song);
if(app.song.samples){
for(var i=0;i<app.song.samples.length;i++){
try{
app.song.samples[i].signed=null;
}catch(e){
console.log(e);
}
}
}
console.log(me.song);
var saveText = JSON.stringify(me.song);
saveTexToStorage("last", saveText);
saveTexToStorage("mixerMode", ""+me.mixerMode );
saveTexToStorage("tapSizeMode", ""+me.tapSizeMode );
//console.log(saveText);
};
this.addMessage = function (msg) {
if (me.messages.length > 1) {
me.messages[2] = me.messages[1];
}
if (me.messages.length > 0) {
me.messages[1] = me.messages[0];
}
me.messages[0] = msg;
};
this.___log = function (msg) {
me.addMessage(msg);
try {
console.log(msg);
} catch (e) {
me.addMessage("log error: " + e);
}
};
this.hidePrompt = function () {
me.select.visibled = false;
app.renderer.fireRender();
};
this.promptSelect = function (caption, list, callback) {
console.log("promptSelect: " + caption);
me.select.items = list;
me.select.caption = caption;
me.select.action = callback;
me.select.visibled = true;
app.renderer.fireRender();
};
this.promptConfirm = function (caption, callback) {
var items = [];
items[0] = new Item(lang.yes(), "", callback);
items[1] = new Item(lang.cancel(), "");
me.promptSelect(caption, items);
};
this.promptWarning = function (caption) {
var items = [];
//items[0] = new Item("Close", "");
me.promptSelect(caption, items);
};
this.selectRiffIfNotSelected = function (slot) {
if (app.song.selectedRiffId) {
for (var i = 0; i < slot.riffIds.length; i++) {
if (slot.riffIds[i] == app.song.selectedRiffId) {
return app.song.selectedRiffId;
}
}
}
//console.log("----"+app.song.selectedRiffId);
if (slot.riffIds.length > 0) {
app.song.selectedRiffId = slot.riffIds[0];
return app.song.selectedRiffId;
}
app.song.selectedRiffId = undefined;
return app.song.selectedRiffId;
}
this.selectInstrumentIfNotSelected = function (riffId) {
var r = toolbox.findRiffById(riffId, app.song);
if(r){
if (toolbox.existsSampleIdInRiff(app.song.selectedSampleId, r)) {
return app.song.selectedSampleId;
}
if(r.tunes){
if (r.tunes.length > 0) {
app.song.selectedSampleId = r.tunes[0].sampleId; ;
return app.song.selectedSampleId;
}
}
}
app.song.selectedSampleId = undefined;
return app.song.selectedSampleId;
}
//me.mixRealTime = false;
this.switchRealTimeMixing = function () {
stopPlay();
//me.mixRealTime = !me.mixRealTime;
me.mixerMode++;
if(me.mixerMode>3){
me.mixerMode=1;
}
}
this.switchTapSize = function () {
me.tapSizeMode++;
if(me.tapSizeMode>3){
me.tapSizeMode=1;
}
calcTapSize(me.tapSizeMode);
//me.renderer.fireRender();
}
this.showPosition = function (slot) {
console.log("showPosition",slot);
if (slot != null) {
stopPlay();
if(!slot.left){
slot.left=0;
}
if(!slot.top){
slot.top=0;
}
//me.slot = slot;
//me.renderer.panelSong.visibled = false;
//me.renderer.panelPosition.visibled = true;
app.song.selectedPositionId = slot.id;
me.renderer.panelSong.visibled = false;
me.renderer.panelPosition.visibled = true;
me.renderer.panelPosition.horizontal.visibled = true;
me.renderer.panelPosition.keysBorder.visibled = true;
me.renderer.panelPosition.panelBeat.visibled = true;
me.renderer.panelPosition.panelMelody.visibled = true;
me.renderer.panelPosition.panelKeys.visibled = true;
var riffId = me.selectRiffIfNotSelected(slot);
if (riffId) {
me.selectInstrumentIfNotSelected(riffId);
console.log("app.song.selectedSampleId " + app.song.selectedSampleId);
}
app.renderer.menuRiffs.refresh();
app.renderer.menuSamples.refresh();
//app.renderer.menuExamples.list.visibled = false;
//app.renderer.menuExamples.vertical.visibled = false;
//
app.renderer.menuRiffs.list.visibled = true;
app.renderer.menuRiffs.vertical.visibled = true;
app.renderer.menuSamples.list.visibled = true;
app.renderer.menuSamples.vertical.visibled = true;
//console.log(app.renderer.menuExamples);
} else {
me.promptWarning("No selected position");
}
};
this.playPosition = function (slot) {
//var cuSong = toolbox.songFromPosition(slot, app.song);
console.log("playPosition", app.song, slot);
me.mixAndPlay(app.song, slot);
/*console.log("playPosition");
if (slot != null) {
this.showFog();
app.mixer.mixPosition(slot, app.song, function (signed) {
//app.playAudioChrome(signed);
app.playAudio5(signed);
});
} else {
me.promptWarning("No selected position");
}*/
};
this.countSongLen = function (song, sr) {
var s16 = //app.mixer.pcm.sampleRate
sr * (60.0 / 4.0) / song.tempo;
if (me.lockedSlot != null) {
return s16 * 1 * song.meter;
} else {
var len = 0;
var p = toolbox.findOrCreatePositionXY(song, 0, 0);
do {
len++;
p = toolbox.nextPosition(song, p.left, p.top);
//console.log("countSongLen ", p);
} while (p.left != 0 || p.top != 0);
var all = s16 * len * song.meter;
console.log("countSongLen ", s16, len, song.meter, all);
return all;
}
};
var countMix = 0;
var countFull = 0;
var countPart = 100000;
//var countBuffer = [];
buffers = [];
//var countSong=null;
var startMixing = 0;
var startSending = 0;
var doneSending = 0;
me.mixedLength = 0;
me.slotLength = 0;
me.slotMapX = [];
me.slotMapY = [];
me.highIndex = 0;
me.playStartTime = 0;
me.lockedSlot = null;
this.playedSlotChanged = function () {
if (app.playOn) {
var cuTime = new Date().getTime() - me.playStartTime;
var fromStart = cuTime % me.mixedLength;
var idx = Math.floor(fromStart / me.slotLength);
if (idx != me.highIndex) {
me.highIndex = idx;
//console.log(app.highIndex);
return true;
} else {
return false;
}
} else {
return false;
}
};
this.buildHighlightMap = function (length) {
me.mixedLength = 1000 * length / app.mixer.mixSampleRate; //44100;
me.slotLength = 1000 * (app.mixer.mixSong.meter * app.mixer.pcm.sampleRate * (60.0 / 4.0) / app.mixer.mixSong.tempo) / 44100;
me.slotMapX = [];
me.slotMapY = [];
me.slotMapX[me.slotMapX.length] = 0;
me.slotMapY[me.slotMapY.length] = 0;
var p = toolbox.nextPosition(app.mixer.mixSong, 0, 0);
while (!(p.left == 0 && p.top == 0)) {
me.slotMapX[me.slotMapX.length] = p.left;
me.slotMapY[me.slotMapY.length] = p.top;
p = toolbox.nextPosition(app.mixer.mixSong, p.left, p.top);
}
//console.log(me.mixedLength, me.slotLength, me.slotMapX, me.slotMapY);
me.highIndex = 0;
me.playStartTime = new Date().getTime();
};
this.partMix = function () {
//console.log("countBuffer.length",countBuffer.length,countMix);
//countMix = countMix - countPart;
if (countMix > countPart) {
var pre = new Date().getTime();
var signed = app.mixer.mixNext(countPart);
countMix = countMix - countPart;
//countBuffer = countBuffer.concat(signed);
buffers[buffers.length] = signed;
console.log("mixed part", (new Date().getTime() - pre) / 1000);
window.setTimeout(me.partMix, 10);
//console.log(new Date().getTime());
app.promptWarning("mixing " + Math.round(100 - 100 * countMix / countFull) + "% - " //
+app.mixer.mixSongPosition.left + ":" + app.mixer.mixSongPosition.top);
} else {
var signed = app.mixer.mixNext(countMix);
//countBuffer = countBuffer.concat(signed);
buffers[buffers.length] = signed;
//console.log("countBuffer.length",countBuffer.length);
app.promptWarning("Initialize sound");
startSending = new Date().getTime();
//app.playAudio5(countBuffer);
app.playAudio5(buffers, app.mixer.mixSampleRate);
var fullLen = 0;
for (var i = 0; i < buffers.length; i++) {
fullLen = fullLen + buffers[i].length;
}
//me.buildHighlightMap(countBuffer.length);
me.buildHighlightMap(fullLen);
doneSending = new Date().getTime();
me.playOn = true;
app.renderer.menuSlot.menuItemPlay.caption = "Stop";
app.renderer.menuSlot.menuItemPlay.renderIcon = toolbox.iconPlayStop;
app.hidePrompt();
console.log("mixing", (startSending - startMixing) / 1000, "sending", (doneSending - startSending) / 1000);
}
};
this.playSong = function (song) {
//console.log("playSong ", song);
me.mixAndPlay(song, null);
}
this.mixAndPlay = function (song, slot) {
me.lockedSlot = slot;
console.log("mixAndPlay ", song, slot);
//return;
var s = song;
//this.showFog();
//countSong=song;
app.cache.all(s, function () { //
app.promptWarning("mixing");
var currentRate = 44100;
countMix = me.countSongLen(s, currentRate);
countFull = countMix;
buffers = [];
//countBuffer = [];
app.mixer.mixReset(s, currentRate);
//console.log("partMix "+countMix);
startMixing = new Date().getTime();
me.partMix();
/*
var sz = me.countSongLen(s);
app.mixer.mixReset(s);
var signed = app.mixer.mixNext(sz);
console.log("signed",signed);
*/
/*try {
//console.log("playSong",s);
//var signed = app.mixer.mixWholeSong(s);
////////////////////////////////////////////////////////////////////
var sz = me.countSongLen(s);
app.mixer.mixReset(s);
//var t=app.mixer.pcm.sampleRate * (60.0 / 4.0) / s.tempo
//console.log(t*64);
var signed = app.mixer.mixNext(sz);
////////////////////////////////////////////////////////////////////
me.playOn = true;
app.renderer.menuSlot.menuItemPlay.caption = "Stop";
app.hidePrompt();
app.playAudio5(signed);
} catch (exp) {
console.log(exp);
app.promptWarning("Unknown error. Refresh page and try again.");
}*/
}, function () { //
app.promptWarning("Can't cache waves");
});
};
this.showSong = function () {
console.log("showSong");
app.song.selectedPositionId = null;
stopPlay();
me.renderer.panelSong.visibled = true;
me.renderer.panelPosition.visibled = false;
me.renderer.panelPosition.keysBorder.visibled = false;
me.renderer.panelPosition.horizontal.visibled = false;
me.renderer.panelPosition.panelBeat.visibled = false;
me.renderer.panelPosition.panelMelody.visibled = false;
me.renderer.panelPosition.panelKeys.visibled = false;
//app.renderer.menuExamples.list.visibled = true;
//app.renderer.menuExamples.vertical.visibled = true;
//
app.renderer.menuRiffs.list.visibled = false;
app.renderer.menuRiffs.vertical.visibled = false;
app.renderer.menuSamples.list.visibled = false;
app.renderer.menuSamples.vertical.visibled = false;
app.renderer.clearCache();
};
this.showFog = function () {
console.log("showFog");
var div = document.getElementById('playDiv');
div.style.visibility = 'visible';
};
this.hideFog = function () {
console.log("hideFog");
var div = document.getElementById('playDiv');
div.style.visibility = 'hidden';
};
this.playAudioChrome = function (signed) {
console.log("start playAudioChrome");
var data = app.mixer.unsigned(signed);
var s = app.mixer.pcm.make(data);
// window.open(s);
console.log("seek audioID");
var audioID = document.getElementById("playAudio");
console.log("found " + audioID);
audioID.pause();
console.log("setup audioID");
audioID.src = s;
//console.log(s);
console.log("play audioID");
audioID.play();
console.log("done playAudioChrome");
};
this.stopAudioTizen = function () {}
this.playAudioTizen = function (signed) {
console.log("start playAudioTizen");
var audioContext = null;
try {
console.log("fix up for prefixing");
window.AudioContext = window.AudioContext || window.webkitAudioContext;
audioContext = new AudioContext();
} catch (e) {
console.log(e);
}
//var audioContext = new webkitAudioContext();
var audioBuffer = audioContext.createBuffer(1, signed.length, 44100);
var float32Array = audioBuffer.getChannelData(0);
for (i = 0; i < float32Array.length; i++) {
// float32Array[i] = Math.sin(2 * 180 * (i / float32Array.length));
// // Two waveform oscillations
float32Array[i] = signed[i] / 768.0;
}
console.log("Create source node");
var audioBufferSourceNode = audioContext.createBufferSource();
audioBufferSourceNode.loop = true; // Make sure that sound will repeat
// over and over again
audioBufferSourceNode.buffer = audioBuffer; // Assign our buffer to the
// source node buffer
console.log("Connect to the destination and play");
audioBufferSourceNode.connect(audioContext.destination);
audioBufferSourceNode.noteOn(0);
console.log("done playAudioTizen");
};
this.stopAudio5 = function () {
console.log("try this.stopAudio5");
if (app.audioBufferSourceNode != null) {
console.log("audioBufferSourceNode.stop");
//app.audioBufferSourceNode.noteOff(0);
try {
app.audioBufferSourceNode.stop(0);
app.audioBufferSourceNode.disconnect(0);
} catch (ops) {
console.log(ops);
}
}
};
me.testPlayOn = false;
me.scriptProcessorNode = null;
this.testPlay = function (fromPosition) {
console.log("test play",fromPosition);
if (me.testPlayOn) {
me.testPlayStop();
me.testPlayOn = false;
} else {
this.testPlayStart(fromPosition);
me.testPlayOn = true;
app.renderer.menuSlot.menuItemPlay.caption = "Stop";
app.renderer.menuSlot.menuItemPlay.renderIcon = toolbox.iconPlayStop;
}
}
this.testPlayStart = function (fromPosition) {
app.cache.all(app.song, function () { //
try {
me.testPlayMix(fromPosition);
} catch (exp) {
console.log(exp);
app.promptWarning("Unknown error. Refresh page and try again.");
}
}, function () { //
console.log("Can't cache");
});
}
/*
this.copyAudioBuffer = function (output, signed) {
for (var i = 0; i < output.length; i++) {
output[i] = signed[i] / 128.0;
}
};*/
me.scriptRatio = 1;
me.markChanged = false;
me.markBar = 0;
this.testPlayMix = function (fromPosition) {
console.log("render play");
if (this.audioContext == null) {
try {
console.log("fix up for prefixing");
window.AudioContext = window.AudioContext || window.webkitAudioContext;
this.audioContext = new AudioContext();
} catch (e) {
console.log(e);
}
}
console.log("fromPosition",fromPosition);
if(fromPosition!=undefined){
app.mixer.mixReset(app.song, 44100,fromPosition.left,fromPosition.top); //this.audioContext.sampleRate);
}else{
app.mixer.mixReset(app.song, 44100); //this.audioContext.sampleRate);
}
app.hidePrompt();
//console.log(this.audioContext.sampleRate);
me.scriptRatio = this.audioContext.sampleRate / app.mixer.mixSampleRate; //48000/22050~2
me.scriptProcessorNode = this.audioContext.createScriptProcessor(1024 * 16, 1, 1);
me.testPlayOn=true;
me.scriptProcessorNode.onaudioprocess = function (audioProcessEvent) {
if(!me.testPlayOn){
console.log('done test');
}
var output = audioProcessEvent.outputBuffer.getChannelData(0);
//console.log("onaudioprocess",app.mixer.mixSongPosition, app.mixer.mix16Counter);
/*if(me.markBar!=app.mixer.mix16Counter+1){
me.markChanged=true;
me.markBar=app.mixer.mix16Counter+1;
if(me.markBar>app.mixer.mixSong.meter){
me.markBar=0;
}
}*/
//n = new Date().getTime();
var nStart = new Date().getTime();
var signed = app.mixer.mixNext(output.length / me.scriptRatio);
var nMixed = new Date().getTime();
//me.copyAudioBuffer(output, signed);
//console.log("mixed", signed.length, new Date().getTime() - n);
//n = new Date().getTime();
var le = output.length;
for (var i = 0; i < le; i++) {
output[i] = signed[~~(i / me.scriptRatio)] / 128.0;
}
var nSent = new Date().getTime();
//console.log(output.length,signed.length,(nMixed-nStart),(nSent-nMixed));
if (me.markBar != app.mixer.mix16Counter) {
me.markChanged = true;
me.markBar = app.mixer.mix16Counter;
}
};
//me.scriptProcessorNode.connect(this.audioContext.destination);
this.connectFilters();
console.log("play stream");
}
this.testPlayStop = function () {
console.log("stop test");
try{
//console.log(0,me.scriptProcessorNode);
//console.log(22,me.scriptProcessorNode);
//console.log(33,me.scriptProcessorNode.stop);
//me.scriptProcessorNode.onaudioprocess = null;
//console.log(1,me.scriptProcessorNode);
//me.scriptProcessorNode.disconnect(0);
//console.log(2,me.scriptProcessorNode);
me.testPlayOn=false;
this.disconnectFilters();
me.scriptProcessorNode.onaudioprocess = null;
}catch(e){
console.log(e);
}
}
this.disconnectFilters=function(){
console.log('disconnectFilters');
//this.stopAudio5();
//this.testPlayStop();
me.scriptProcessorNode.disconnect();
me.cabinet.disconnect();
this.eq32.disconnect();
this.eq63.disconnect();
this.eq125.disconnect();
this.eq250.disconnect();
this.eq500.disconnect();
this.eq1000.disconnect();
this.eq2000.disconnect();
this.eq4000.disconnect();
this.eq8000.disconnect();
this.eq16000.disconnect();
this.eq16000.disconnect();
//this.audioContext.destination
}
this.createEq=function(f){
var r = this.audioContext.createBiquadFilter();
r.type = "peaking";
r.gain.value = 0;
r.frequency.value = f;
r.Q.value = 1;
return r;
};
var cabinetImpulse = [
0.21543064713478088, 0.5968216061592102, 0.912590742111206, 1.009040355682373, 0.9345616102218628, 0.801206111907959, 0.6011229753494263, 0.26208391785621643, -0.15228676795959473, -0.4350961744785309, -0.48666444420814514, -0.4288691282272339, -0.3704981207847595, -0.2561623454093933, -0.04052649438381195, 0.17862018942832947, 0.2724054753780365, 0.24724756181240082, 0.2167157530784607, 0.20630916953086853, 0.1514209359884262, 0.06955219060182571, 0.0402434803545475, 0.060467563569545746, 0.061958879232406616, 0.032873984426259995, 0.021819235756993294, 0.06011128053069115, 0.09806782752275467, 0.06384801119565964, -0.0015385178849101067, -0.027264418080449104, -0.03607996925711632, -0.07115244120359421, -0.1131587028503418, -0.12434571981430054, -0.10727634280920029, -0.08802803605794907, -0.081361323595047, -0.07060238718986511, -0.03427581116557121, 0.0165542121976614, 0.051248181611299515, 0.06536567211151123, 0.07843148708343506, 0.09632094204425812, 0.1042163223028183, 0.08259140700101852, 0.039928097277879715, -0.000016878602764336392, -0.04120249301195145, -0.08023693412542343, -0.08385323733091354, -0.05380384251475334, -0.026715470477938652, -0.015028324909508228, -0.01248881034553051, -0.01870650239288807, -0.023754261434078217, -0.016837626695632935, 0.00027974805561825633, 0.03090488724410534, 0.06972981989383698, 0.09138311445713043, 0.08398831635713577, 0.04752659425139427, -0.026607006788253784, -0.11458443850278854, -0.17355750501155853, -0.18816959857940674, -0.16167782247066498, -0.1138182133436203, -0.0625002309679985, -0.0023175477981567383, 0.05573539063334465, 0.08099162578582764, 0.0743165835738182, 0.05173585191369057, 0.017583470791578293, -0.020232556387782097, -0.04887932166457176, -0.06019516661763191, -0.04803912714123726, -0.022699838504195213, -0.007916916161775589, -0.006094999611377716, -0.005430098157376051, -0.006030711345374584, -0.010485637933015823, -0.013108702376484871, -0.011642907746136189, -0.007692738436162472, -0.009490063413977623, -0.023917309939861298, -0.0439474992454052, -0.059613678604364395, -0.0727449581027031, -0.0874256119132042, -0.09657616913318634, -0.0874454528093338, -0.05405423417687416, -0.009308633394539356, 0.029695535078644753, 0.05620267987251282, 0.07000041007995605, 0.06662970781326294, 0.039906397461891174, -0.005657647270709276, -0.05048786848783493, -0.07378202676773071, -0.07216660678386688, -0.05560455098748207, -0.031112220138311386, 0.004654848016798496, 0.046538323163986206, 0.0763992890715599, 0.08234427124261856, 0.06932748109102249, 0.04536190629005432, 0.012190708890557289, -0.026757802814245224, -0.059276893734931946, -0.07063663750886917, -0.06073087081313133, -0.04259337857365608, -0.024757644161581993, -0.007923992350697517, 0.0038201306015253067, 0.006704794708639383, 0.0006276994245126843, -0.010062245652079582, -0.02169060707092285, -0.03375179320573807, -0.045504357665777206, -0.052042849361896515, -0.04681602492928505, -0.0317591093480587, -0.011852407827973366, 0.009543869644403458, 0.03038186766207218, 0.04442504420876503, 0.046188805252313614, 0.03669305518269539, 0.021895622834563255, 0.006584728602319956, -0.008723045699298382, -0.022465411573648453, -0.029115084558725357, -0.02606464922428131, -0.018390463665127754, -0.007948294281959534, 0.006139181088656187, 0.02365432307124138, 0.04001886397600174, 0.05026216804981232, 0.05206458270549774, 0.04648716002702713, 0.03525657206773758, 0.020295828580856323, 0.007124812807887793, -0.0007859422476030886, -0.003528402652591467, -0.004326618276536465, -0.003223479725420475, 0.001898214453831315, 0.011344361118972301, 0.021089665591716766, 0.027267171069979668, 0.030684491619467735, 0.034853167831897736, 0.03793236240744591, 0.03687287122011185, 0.03426499292254448, 0.02986184135079384, 0.021451886743307114, 0.006213867571204901, -0.014579360373318195, -0.03657245635986328, -0.05428414046764374, -0.06528056412935257, -0.06960880756378174, -0.06619733572006226, -0.05323607102036476, -0.03208938241004944, -0.009560045786201954, 0.008747615851461887, 0.020191103219985962, 0.026018358767032623, 0.026448266580700874, 0.020869575440883636, 0.00883603934198618, -0.005096427630633116, -0.015290601179003716, -0.020192015916109085, -0.021057674661278725, -0.019490627571940422, -0.015410632826387882, -0.010093389078974724, -0.004010305739939213, 0.00048223097110167146, 0.0026107209268957376, 0.0028934648726135492, 0.0014824860263615847, -0.0022311166394501925, -0.007446200121194124, -0.011157603934407234, -0.009691177867352962, -0.0026775740552693605, 0.006318830884993076, 0.016671236604452133, 0.028856370598077774, 0.04094632342457771, 0.047701507806777954, 0.04683326184749603, 0.03889548033475876, 0.026584459468722343, 0.011334787122905254, -0.006133715622127056, -0.02312016487121582, -0.03626122698187828, -0.044013138860464096, -0.047411371022462845, -0.046604305505752563, -0.04210542514920235, -0.03351067006587982, -0.022980641573667526, -0.013227921910583973, -0.00561345973983407, 0.0006461172015406191, 0.005001382436603308, 0.004958947189152241, 0.00020787646644748747, -0.006511499173939228, -0.012609242461621761, -0.018038621172308922, -0.022384846583008766, -0.026645928621292114, -0.029441222548484802, -0.03070375882089138, -0.03207818791270256, -0.03373796120285988, -0.033664267510175705, -0.03123638592660427, -0.02786093018949032, -0.024137306958436966, -0.020027926191687584, -0.014925992116332054, -0.009408882819116116, -0.004254710860550404, -0.0015616693999618292, -0.0003241176309529692, 0.0005090478807687759, 0.0008944355067797005, -0.0002254969149362296, -0.003317910945042968, -0.008154000155627728, -0.014963667839765549, -0.02246604859828949, -0.029114725068211555, -0.032375480979681015, -0.03212503343820572, -0.029286976903676987, -0.025135193020105362, -0.02029402367770672, -0.016161171719431877, -0.01347831916064024, -0.012094123288989067, -0.011148608289659023, -0.01092602964490652, -0.012366020120680332, -0.014583750627934933, -0.016934849321842194, -0.016986113041639328, -0.014306334778666496, -0.009947847574949265, -0.005885828286409378, -0.0028604124672710896, -0.00166955532040447, -0.0031240142416208982, -0.0066781435161828995, -0.010771148838102818, -0.013623828068375587, -0.01503301877528429, -0.015533410012722015, -0.01602126844227314, -0.015237911604344845, -0.012613206170499325, -0.008412916213274002, -0.004656169563531876, -0.0019548600539565086, -0.0004186307196505368, -0.0002632643445394933, -0.001078148139640689, -0.003136928891763091, -0.005833863280713558, -0.00817201565951109, -0.009918177500367165, -0.012166693806648254, -0.014298240654170513, -0.01615956798195839, -0.016845442354679108, -0.016618898138403893, -0.015319762751460075, -0.013006903231143951, -0.011169347912073135, -0.01104626152664423, -0.013486696407198906, -0.017205964773893356, -0.020489372313022614, -0.02262824960052967, -0.024647511541843414, -0.025322768837213516, -0.02420748956501484, -0.021420037373900414, -0.01808883249759674, -0.01487987581640482, -0.011713198386132717, -0.0075867436826229095, -0.0014461097307503223, 0.004765826277434826, 0.011101474054157734, 0.017936162650585175, 0.02484249323606491, 0.030499249696731567, 0.033716827630996704, 0.03332783654332161, 0.030338775366544724, 0.025132428854703903, 0.01745148003101349, 0.008070390671491623, -0.0013380979653447866, -0.008722211234271526, -0.013296839781105518, -0.014733284711837769, -0.014595059677958488, -0.01235901191830635, -0.00832095555961132, -0.002855962608009577, 0.0034165852703154087, 0.008934847079217434, 0.013021393679082394, 0.01571965590119362, 0.016309615224599838, 0.014797830954194069, 0.011826683767139912, 0.007333396468311548, 0.0034922000486403704, 0.0002447538136038929, -0.002383120357990265, -0.005072775762528181, -0.007684432435780764, -0.009015006013214588, -0.009408456273376942, -0.009085617028176785, -0.007706624921411276, -0.004863137379288673, -0.0006994402501732111, 0.0037215487100183964, 0.0076995231211185455, 0.012335987761616707, 0.017019130289554596, 0.021243983879685402, 0.02323785610496998, 0.023657439276576042, 0.02411380410194397, 0.024499382823705673, 0.024237850680947304, 0.023478135466575623, 0.023719852790236473, 0.02487410232424736, 0.026960235089063644, 0.02916790544986725, 0.031412966549396515, 0.03221511095762253, 0.03025699220597744, 0.025351881980895996, 0.019108442589640617, 0.01321971882134676, 0.008099084720015526, 0.0049324617721140385, 0.005158879794180393, 0.009367605671286583, 0.01545126736164093, 0.021470027044415474, 0.026083439588546753, 0.028766999021172523, 0.028658799827098846, 0.026369886472821236, 0.02307923696935177, 0.020697418600320816, 0.01980249583721161, 0.019800569862127304, 0.02052113227546215, 0.021404724568128586, 0.022159064188599586, 0.02159978821873665, 0.02117772586643696, 0.02160928025841713, 0.02213750220835209, 0.0217842198908329, 0.021314255893230438, 0.02170047163963318, 0.023659775033593178, 0.025936657562851906, 0.02686470001935959, 0.02738819271326065, 0.028048396110534668, 0.029754197224974632, 0.03073766455054283, 0.030877292156219482, 0.031080391258001328, 0.03133474290370941, 0.03092869743704796, 0.029190879315137863, 0.02689928002655506, 0.02518794871866703, 0.024028057232499123, 0.022769413888454437, 0.021680595353245735, 0.021209388971328735, 0.02217874489724636, 0.024036550894379616, 0.026725517585873604, 0.028888223692774773, 0.029527070000767708, 0.027979440987110138, 0.0240374393761158, 0.018913162872195244, 0.013648840598762035, 0.008995386771857738, 0.00561821972951293, 0.004852965474128723, 0.007157151587307453, 0.011991658248007298, 0.017482029274106026, 0.02298426628112793, 0.02756546251475811, 0.031613342463970184, 0.034563709050416946, 0.03534603491425514, 0.03427572175860405, 0.03138532489538193, 0.028111211955547333, 0.02470341883599758, 0.021615495905280113, 0.019310377538204193, 0.017880117520689964, 0.017427345737814903, 0.018292605876922607, 0.019323579967021942, 0.019984086975455284, 0.02059226855635643, 0.021606795489788055, 0.023186566308140755, 0.024739105254411697, 0.02611706405878067, 0.026730723679065704, 0.02669014409184456, 0.025629781186580658, 0.02431567944586277, 0.022744080051779747, 0.020479783415794373, 0.01762154884636402, 0.01484072394669056, 0.012670980766415596, 0.011577125638723373, 0.011743986047804356, 0.012899884022772312, 0.015058006159961224, 0.01757703721523285, 0.020545795559883118, 0.023281874135136604, 0.026306649670004845, 0.02827739343047142, 0.028792761266231537, 0.0284836757928133, 0.026860522106289864, 0.024503735825419426, 0.02129681222140789, 0.01818491891026497, 0.016214769333600998, 0.015278742648661137, 0.014794239774346352, 0.014647534117102623, 0.014521394856274128, 0.01497400738298893, 0.015048091299831867, 0.014649317599833012, 0.01454203762114048, 0.015269934199750423, 0.01701710931956768, 0.018740246072411537, 0.020514754578471184, 0.022477958351373672, 0.024894319474697113, 0.02636157162487507, 0.026610717177391052, 0.025659842416644096, 0.023916520178318024, 0.02204001694917679, 0.02027026005089283, 0.01858575828373432, 0.016703076660633087, 0.015152250416576862, 0.013809406198561192, 0.012629716657102108, 0.010960012674331665, 0.008608912117779255, 0.006123064551502466, 0.00420666066929698, 0.002617286518216133, 0.002109742257744074, 0.002359414007514715, 0.0034437943249940872, 0.006111311260610819, 0.008973740972578526, 0.011518840678036213, 0.01297441590577364, 0.013642345555126667, 0.01496337354183197, 0.016785765066742897, 0.018189983442425728, 0.019928907975554466, 0.021299611777067184, 0.022269612178206444, 0.023118028417229652, 0.023365603759884834, 0.023188089951872826, 0.02258181758224964, 0.021343624219298363, 0.01886119320988655, 0.016527950763702393, 0.014604204334318638, 0.01343659870326519, 0.013131040148437023, 0.012633188627660275, 0.01186030637472868, 0.011492013931274414, 0.011381853371858597, 0.011943533085286617, 0.013400917872786522, 0.015176567249000072, 0.017601530998945236, 0.01965697668492794, 0.020918818190693855, 0.021229170262813568, 0.021227670833468437, 0.020709579810500145, 0.019577862694859505, 0.018399901688098907, 0.01717550866305828, 0.016039520502090454, 0.014947028830647469, 0.014207295142114162, 0.013959930278360844, 0.013774494640529156, 0.01288316585123539, 0.011520768515765667, 0.00958836730569601, 0.008349471725523472, 0.008004005067050457, 0.008273424580693245, 0.00913707260042429, 0.010169871151447296, 0.011512425728142262, 0.01322258822619915, 0.015106071718037128, 0.01675349846482277, 0.018983881920576096, 0.021157914772629738, 0.023190787062048912, 0.024281535297632217, 0.02411787584424019, 0.023879000917077065, 0.023799583315849304, 0.023732606321573257, 0.02359982207417488, 0.023311303928494453, 0.02295803092420101, 0.022652829065918922, 0.02173047512769699, 0.02036707103252411, 0.01839054562151432, 0.0169263556599617, 0.01598234847187996, 0.015275765210390091, 0.015207109972834587, 0.015659503638744354, 0.01683749072253704, 0.018287526443600655, 0.018939340487122536, 0.01845484972000122, 0.01803481951355934, 0.017686035484075546, 0.017736004665493965, 0.01794508472084999, 0.018100736662745476, 0.018460357561707497, 0.019061757251620293, 0.01909411884844303, 0.01845553331077099, 0.01756439357995987, 0.016640711575746536, 0.016287878155708313, 0.015974678099155426, 0.01616983488202095, 0.01652108132839203, 0.017075972631573677, 0.017725003883242607, 0.018328584730625153, 0.01859879307448864, 0.018393630161881447, 0.018152328208088875, 0.017780201509594917, 0.017523275688290596, 0.01695038564503193, 0.016107823699712753, 0.014828597195446491, 0.01346095371991396, 0.012626615352928638, 0.012123453430831432, 0.011739023961126804, 0.012173754163086414, 0.013171656988561153, 0.014738261699676514, 0.016374042257666588, 0.017482876777648926, 0.018487591296434402, 0.019241219386458397, 0.01993723399937153, 0.019945308566093445, 0.019486935809254646, 0.018450763076543808, 0.01743159629404545, 0.016388213261961937, 0.015265108086168766, 0.014344451017677784, 0.013353877700865269, 0.012590006925165653, 0.01183322723954916, 0.01138110738247633, 0.010991524904966354, 0.011145785450935364, 0.01162227988243103, 0.012387159280478954, 0.013465341180562973, 0.01415256503969431, 0.014540813863277435, 0.014842638745903969, 0.01497583743184805, 0.015172794461250305, 0.015254128724336624, 0.015174600295722485, 0.015161671675741673, 0.014955122955143452, 0.014953358098864555, 0.014415239915251732, 0.01371652353554964, 0.013073869980871677, 0.012675928883254528, 0.012205786071717739, 0.010953662917017937, 0.009703557938337326, 0.008400470949709415, 0.0070907617919147015, 0.005614303983747959, 0.00399211747571826, 0.0028318013064563274, 0.0023449338041245937, 0.001892397296614945, 0.0016293504741042852, 0.0014260754687711596, 0.0016792926471680403, 0.002481335075572133, 0.0033124203328043222, 0.004107580054551363, 0.004881458356976509, 0.0059921094216406345, 0.006947262678295374, 0.0077794683165848255, 0.008139584213495255, 0.008168037049472332, 0.00801029521971941, 0.007641770876944065, 0.006639445200562477, 0.005481263156980276, 0.004593227058649063, 0.003779152873903513, 0.003704094560816884, 0.0036095213145017624, 0.0036758154164999723, 0.003972520586103201, 0.0043353610672056675, 0.00501225795596838, 0.005699905566871166, 0.0064070215448737144, 0.007258421741425991, 0.007822658866643906, 0.008177590556442738, 0.007934465073049068, 0.007126898970454931, 0.006318606436252594, 0.005578884854912758, 0.005119682289659977, 0.004566395655274391, 0.0043058255687355995, 0.004098812583833933, 0.0043900227174162865, 0.004875325597822666, 0.00515600573271513, 0.005149120930582285, 0.0048681143671274185, 0.004986184649169445, 0.004895544610917568, 0.004720186349004507, 0.004221620503813028, 0.003589416155591607, 0.0030347078572958708, 0.002290945267304778, 0.0012738935183733702, 0.000310782139422372, -0.00037588702980428934, -0.0006495100678876042, -0.0007506556576117873, -0.0007555402698926628, -0.0006584118236787617, -0.0007202723063528538, -0.0003436738916207105, -0.00008188463834812865, 0.00011992516374448314, 0.0003234184405300766, 0.00046378682600334287, 0.0008167859050445259, 0.0011720213806256652, 0.001299970899708569, 0.0015005605528131127, 0.00163346529006958, 0.0017340650083497167, 0.002200270537286997, 0.0024142679758369923, 0.002646057400852442, 0.002830315614119172, 0.0031074476428329945, 0.003541199490427971, 0.0039541213773190975, 0.00418891804292798, 0.004249358084052801, 0.004441992845386267, 0.004687505308538675, 0.0046772886998951435, 0.004359186626970768, 0.004179010633379221, 0.003897064132615924, 0.003982380963861942, 0.004444570746272802, 0.004856145940721035, 0.005302333738654852, 0.005598870106041431, 0.005606310907751322, 0.0053276196122169495, 0.00448607886210084, 0.003321837866678834, 0.0022578281350433826, 0.0014632545644417405, 0.00116553227417171, 0.001070239464752376, 0.001274989452213049, 0.0015098018338903785, 0.0013849219540134072, 0.0007359600276686251, -0.00016652923659421504, -0.00119821319822222, -0.0017387457191944122, -0.001857258495874703, -0.0020216943230479956, -0.0014801501529291272, -0.0007014920702204108, 0.00006278433284023777, 0.0007342675817199051, 0.0009815434459596872, 0.001090519712306559, 0.0015014564851298928, 0.0018475191900506616, 0.0022566469851881266, 0.0025674132630228996, 0.002647989895194769, 0.0028317789547145367, 0.0026876532938331366, 0.0023158034309744835, 0.0016587504651397467, 0.0009811859345063567, 0.0005619326257146895, 0.00042020148248411715, 0.00014140714483801275, -0.0003501601458992809, -0.0009926443453878164, -0.0015243280213326216, -0.001688204356469214, -0.0014444824773818254, -0.0008679215679876506, -0.00017552345525473356, 0.0007929576677270234, 0.0017622277373448014, 0.002955969888716936, 0.0037032244727015495, 0.003968075383454561, 0.004155659582465887, 0.004199094604700804, 0.00388252642005682, 0.0029849661514163017, 0.002383091254159808, 0.0023920307867228985, 0.002808729186654091, 0.003671530168503523, 0.004778810776770115, 0.005765472073107958, 0.0069187963381409645, 0.007709179539233446, 0.008099487982690334, 0.008224641904234886, 0.007752975448966026, 0.007013326045125723, 0.006283430848270655, 0.005604949779808521, 0.005053934641182423, 0.0047821346670389175, 0.004711075220257044, 0.00490749254822731, 0.0053318035788834095, 0.005805234890431166, 0.0057732118293643, 0.005711518228054047, 0.0053523508831858635, 0.004587352741509676, 0.003965782932937145, 0.003174843732267618, 0.0026875415351241827, 0.0024147718213498592, 0.002023827750235796, 0.0016229357570409775, 0.0012612749123945832, 0.0009442834416404366, 0.00100702082272619, 0.0011898291995748878, 0.0016817698488011956, 0.002405939158052206, 0.003097693668678403, 0.0036436805967241526, 0.003751526353880763, 0.003728907322511077, 0.0034544679801911116, 0.003319082548841834, 0.0032604620791971684, 0.003225090680643916, 0.003307204693555832, 0.0037804460152983665, 0.004538693930953741, 0.005377302411943674, 0.00631408067420125, 0.007009519264101982, 0.007737479638308287, 0.00817260891199112, 0.008021706715226173, 0.007621052674949169, 0.00709929084405303, 0.006841753143817186, 0.007071401458233595, 0.006955174263566732, 0.006979983299970627, 0.007134930696338415, 0.007216953672468662, 0.007680959068238735, 0.007674100808799267, 0.007626682985574007, 0.007830965332686901, 0.007578921504318714, 0.007525190245360136, 0.007550046779215336, 0.006909883581101894, 0.006582202855497599, 0.006130857393145561, 0.005568686407059431, 0.005489404778927565, 0.005463678389787674, 0.005689429119229317, 0.006223639938980341, 0.0068840282037854195, 0.007481776177883148, 0.00801945012062788, 0.008092887699604034, 0.007790358737111092, 0.007188436109572649, 0.006594008766114712, 0.006100914906710386, 0.005805319640785456, 0.005965563002973795, 0.006277150474488735, 0.006958983838558197, 0.007964856922626495, 0.008860764093697071, 0.009537050500512123, 0.010060160420835018, 0.009914032183587551, 0.009419641457498074, 0.008611924014985561, 0.007563543505966663, 0.006794919725507498, 0.0060444301925599575, 0.005593912675976753, 0.005717646796256304, 0.0062563177198171616, 0.006834173575043678, 0.007201578933745623, 0.0073845344595611095, 0.007643272168934345, 0.007984527386724949, 0.008088839240372181, 0.007879854179918766, 0.0077146138064563274, 0.007583287078887224, 0.007419266737997532, 0.006916858721524477, 0.006169332657009363, 0.005764216184616089, 0.005425105337053537, 0.005352593492716551, 0.005366846919059753, 0.005144142080098391, 0.005156502593308687, 0.004966386593878269, 0.0044348761439323425, 0.004381120670586824, 0.004409103188663721, 0.00526434974744916, 0.006776796188205481, 0.008197384886443615, 0.010052028112113476, 0.011176991276443005, 0.011839274317026138, 0.012102543376386166, 0.01200910285115242, 0.011729279533028603, 0.010719996877014637, 0.009463089518249035, 0.008232560008764267, 0.007502677850425243, 0.007320786826312542, 0.007477460894733667, 0.008102511055767536, 0.009425369091331959, 0.010968389920890331, 0.011967563070356846, 0.012194694951176643, 0.011589610017836094, 0.010613023303449154, 0.009447392076253891, 0.00793096236884594, 0.006647375877946615, 0.005823659710586071, 0.005735725164413452, 0.006562649738043547, 0.007679290138185024, 0.009036938659846783, 0.01042928732931614, 0.011354620568454266, 0.011908311396837234, 0.012163960374891758, 0.011751074343919754, 0.011137016117572784, 0.010404868982732296, 0.010027408599853516, 0.010215177200734615, 0.00991208665072918, 0.009687679819762707, 0.00950705073773861, 0.009437819011509418, 0.009723471477627754, 0.009843580424785614, 0.01026991382241249, 0.011125528253614902, 0.012117594480514526, 0.01310840342193842, 0.014009472914040089, 0.014716126956045628, 0.01499140728265047, 0.01494104228913784, 0.014420831575989723, 0.013578644953668118, 0.012652751989662647, 0.011509435251355171, 0.010674403049051762, 0.010090630501508713, 0.00992405042052269, 0.010035603307187557, 0.010395843535661697, 0.011367681436240673, 0.012247451581060886, 0.01292894221842289, 0.01323037687689066, 0.01290128380060196 //
, 0.012412846088409424, 0.011881769634783268, 0.011394902132451534, 0.011432386934757233, 0.011705550365149975, 0.012392738834023476, 0.013260241597890854, 0.013967094011604786, 0.014649388380348682, 0.015115051530301571, 0.01574135571718216, 0.016272755339741707, 0.016801325604319572, 0.017091937363147736, 0.016757505014538765, 0.016091907396912575, 0.015182072296738625, 0.014059804379940033, 0.0130093302577734, 0.012249546125531197, 0.012213101610541344, 0.012792995199561119, 0.013340847566723824, 0.013936218805611134, 0.014507493935525417, 0.015153603628277779, 0.015433823689818382, 0.015528528951108456, 0.015467364341020584, 0.015101905912160873, 0.014795813709497452, 0.014419583603739738, 0.014409510418772697, 0.01454454381018877, 0.014884287491440773, 0.015612313523888588, 0.016240378841757774, 0.0169378574937582, 0.017385484650731087, 0.017318177968263626, 0.017224146053195, 0.016599027439951897, 0.015667840838432312, 0.014761682599782944, 0.013656697236001492, 0.012647535651922226, 0.0118126654997468, 0.011388967745006084, 0.011465967632830143, 0.012147679924964905, 0.012951509095728397, 0.013766846619546413, 0.01469302736222744, 0.015411022119224072, 0.0160461887717247, 0.01648390293121338, 0.016418403014540672, 0.016036512330174446, 0.015596617013216019, 0.015028283931314945, 0.014333635568618774, 0.013646405190229416, 0.013122966513037682, 0.012871665880084038, 0.013126415200531483, 0.013603503815829754, 0.01422082632780075, 0.014844223856925964, 0.015500962734222412, 0.016078198328614235, 0.016460413113236427, 0.016773846000432968, 0.016550598666071892, 0.016360819339752197, 0.015961432829499245, 0.015173391439020634, 0.014628639444708824, 0.014172067865729332, 0.013878009282052517, 0.013878073543310165, 0.013811588287353516, 0.013744164258241653, 0.013631564565002918, 0.013356813229620457, 0.013204325921833515, 0.01301491353660822, 0.013034477829933167, 0.013102715834975243, 0.013048626482486725, 0.013078358955681324, 0.013383961282670498, 0.013674277812242508, 0.01391078531742096, 0.01440994068980217, 0.014821880497038364, 0.015075757168233395, 0.0150291183963418, 0.014662956818938255, 0.01412707008421421, 0.013535420410335064, 0.012635970488190651, 0.011714765802025795, 0.011141438968479633, 0.010654289275407791, 0.010486215353012085, 0.01059418823570013, 0.010696226730942726, 0.011277207173407078, 0.012242707423865795, 0.013126908801496029, 0.013838368467986584, 0.014153258875012398, 0.014305193908512592, 0.013981769792735577, 0.013416043482720852, 0.012842519208788872, 0.012167155742645264, 0.01166493073105812, 0.011473841033875942, 0.011618184857070446, 0.011956105008721352, 0.012568287551403046, 0.013004579581320286, 0.013487705029547215, 0.013944651931524277, 0.014032193459570408, 0.014076191000640392, 0.013954299502074718, 0.013562698848545551, 0.013230158016085625, 0.01292618177831173, 0.012486116029322147, 0.012189147993922234, 0.01213584840297699, 0.012635939754545689, 0.01313534565269947, 0.013425358571112156, 0.013903738930821419, 0.014152146875858307, 0.014466127380728722, 0.014428224414587021, 0.01370506826788187, 0.013289976865053177, 0.012941394001245499, 0.012569431215524673, 0.0121396379545331, 0.01167829055339098, 0.011942439712584019, 0.012580282986164093, 0.013235033489763737, 0.013615910895168781, 0.013795369304716587, 0.013826929032802582, 0.01355353370308876, 0.013018330559134483, 0.012481383979320526, 0.012285898439586163, 0.012179648503661156, 0.012094151228666306, 0.012122824788093567, 0.012541119009256363, 0.012963997200131416, 0.013264667242765427, 0.013537195511162281, 0.013911860063672066, 0.014572557993233204, 0.014749240130186081, 0.014565053395926952, 0.014359003864228725, 0.014215157367289066, 0.014263561926782131, 0.013914047740399837, 0.013337858952581882, 0.013253077864646912, 0.013631082139909267, 0.014026734977960587, 0.014183548279106617, 0.014400768093764782, 0.014576883055269718, 0.014850170351564884, 0.014911995269358158, 0.014455966651439667, 0.014247008599340916, 0.014077267609536648, 0.013879160396754742, 0.013734252192080021, 0.013564618304371834, 0.01358800195157528, 0.013566733337938786, 0.013305691070854664, 0.013168592005968094, 0.013194986619055271, 0.013434050604701042, 0.01373623963445425, 0.013892733491957188, 0.01429456751793623, 0.01452893577516079, 0.014416244812309742, 0.013845180161297321, 0.012914175167679787, 0.012104973196983337, 0.011274795979261398, 0.010466321371495724, 0.00997490156441927, 0.009912525303661823, 0.01015469804406166, 0.010517792776226997, 0.010824578814208508, 0.01118448469787836, 0.011524800211191177, 0.011692634783685207, 0.011777506209909916, 0.011597046628594398, 0.011357040144503117, 0.011138399131596088, 0.010467343963682652, 0.010010523721575737, 0.009701712056994438, 0.009179463610053062, 0.008964866399765015, 0.008885395713150501, 0.009159800596535206, 0.00961792841553688, 0.010011838749051094, 0.010343562811613083, 0.010590267367661, 0.010762288235127926, 0.010562464594841003, 0.010228768922388554, 0.009986278600990772, 0.009699761867523193, 0.009482546709477901, 0.009259922429919243, 0.009029233828186989, 0.00910810474306345, 0.009175288490951061, 0.009444848634302616, 0.009799780324101448, 0.01003597304224968, 0.010300484485924244, 0.010111347772181034, 0.01000223308801651, 0.010042624548077583, 0.010140898637473583, 0.010440485551953316, 0.010505711659789085, 0.010575580410659313, 0.010496056638658047, 0.010382856242358685, 0.010228248313069344, 0.009751665405929089, 0.009565906599164009, 0.00938502885401249, 0.009310073219239712, 0.009283332154154778, 0.009105559438467026, 0.009026946499943733, 0.008700757287442684, 0.008411834016442299, 0.00784752145409584, 0.007326927036046982, 0.007126570679247379, 0.006924489047378302, 0.0071752117946743965, 0.007424334064126015, 0.007733169011771679, 0.008243120275437832, 0.008460420183837414, 0.008755940943956375, 0.00901307724416256, 0.008982366882264614, 0.008806911297142506, 0.00837703701108694, 0.00798852276057005, 0.007536747958511114, 0.00696614058688283, 0.006489212159067392, 0.006346233654767275, 0.0066445874981582165, 0.006959556136280298, 0.006979146506637335, 0.00665844464674592, 0.0064283511601388454, 0.006281404756009579, 0.006058587692677975, 0.005857170559465885, 0.005637696944177151, 0.0054486822336912155, 0.005248318426311016, 0.005006600636988878, 0.004908635746687651, 0.004987711552530527, 0.005137220025062561, 0.005069238133728504, 0.004784014541655779, 0.004507753066718578, 0.00398490484803915, 0.003497990081086755, 0.00315344356931746, 0.0031796139664947987, 0.003487585112452507, 0.0034717696253210306, 0.0033888122998178005, 0.003326109144836664, 0.00350622134283185, 0.0037000984884798527, 0.0037626095581799746, 0.003949293401092291, 0.003895667614415288, 0.0037580702919512987, 0.003513262839987874, 0.0032416293397545815, 0.0032066095154732466, 0.0030652808491140604, 0.003158701118081808, 0.0037545065861195326, 0.00481851352378726, 0.0057361251674592495, 0.005820162128657103, 0.005611015949398279, 0.005549239926040173, 0.0057312422432005405, 0.005527210421860218, 0.004860243760049343, 0.004282800015062094, 0.003921201918274164, 0.004141994286328554, 0.004464016295969486, 0.004878038540482521, 0.005969424732029438, 0.007242430932819843, 0.008517526090145111, 0.009341172873973846, 0.00924844853579998, 0.008743077516555786, 0.0077638523653149605, 0.006453184876590967, 0.005033108871430159, 0.003793108044192195, 0.0031811834778636694, 0.0031813783571124077, 0.0039010769687592983, 0.005006244871765375, 0.0061169154942035675, 0.0068039256148040295, 0.006716156844049692, 0.00617636926472187, 0.005235009361058474, 0.003704615868628025, 0.001701893168501556, -0.0005080783739686012, -0.002113428432494402, -0.002723793499171734, -0.0025596877094358206, -0.0017805362585932016, -0.0006843429291620851, 0.000729061895981431, 0.0021497313864529133, 0.0031836130656301975, 0.0033087681513279676, 0.0022434100974351168, 0.000610697956290096, -0.0013592755421996117, -0.0033229843247681856, -0.0047263759188354015, -0.005759161431342363, -0.005965626798570156, -0.005142474081367254, -0.0037259776145219803, -0.0021157613955438137, -0.001130569726228714, -0.00040823366725817323, 0.00006468883657362312, 0.0003941055329050869, 0.0008047073497436941, 0.0005073107313364744, -0.000030237313694669865, -0.0005578917916864157, -0.0010490218410268426, -0.0010776841081678867, -0.0009596815216355026, -0.0006778578390367329, 0.00007186144648585469, 0.0012178391916677356, 0.0025709683541208506, 0.004076437093317509, 0.005590024404227734, 0.006470864173024893, 0.006784231401979923, 0.006614754442125559, 0.005967785604298115, 0.005532745737582445, 0.005094377789646387, 0.0046429866924881935, 0.004658310674130917, 0.004737512674182653, 0.00476499879732728, 0.0049448162317276, 0.004814527928829193, 0.004901107866317034, 0.005304482765495777, 0.005460107699036598, 0.005936520639806986, 0.0063781095668673515, 0.006620687432587147, 0.0066262767650187016, 0.0060614654794335365, 0.005227190908044577, 0.004141692537814379, 0.003308851271867752, 0.002886096714064479, 0.002735450863838196, 0.003139893990010023, 0.003685001516714692, 0.00401698611676693, 0.0042271362617611885, 0.00423698965460062, 0.00426843436434865, 0.0047109066508710384, 0.005403256043791771, 0.006550786551088095, 0.008142773061990738, 0.00960939098149538, 0.011059891432523727, 0.012023250572383404, 0.012141953222453594, 0.011235751211643219, 0.008755795657634735, 0.0050553190521895885, 0.00020434075850062072, -0.005329569336026907, -0.010194053873419762, -0.013633639551699162, -0.014548451639711857, -0.012522155418992043, -0.008561711758375168, -0.0030455163214355707, 0.0027793473564088345, 0.007436168380081654, 0.010537274181842804, 0.011352931149303913, 0.010044889524579048, 0.0073913699015975, 0.0036405660212039948, -0.0007170343887992203, -0.004877010360360146, -0.008550330065190792, -0.011188802309334278, -0.01259575691074133, -0.012816696427762508, -0.01139416079968214, -0.009195743128657341, -0.006657713558524847, -0.003983590751886368, -0.0016622395487502217, 0.0004850461846217513, 0.0014511989429593086, 0.00121109199244529, 0.0004552381578832865, -0.0009223476517945528, -0.002249782904982567, -0.00322528718970716, -0.003448309376835823, -0.002547504147514701, -0.0007742087473161519, 0.0014783745864406228, 0.0035463657695800066, 0.004867668263614178, 0.004968354478478432, 0.004018057603389025, 0.00248652882874012, 0.0009849804919213057, 0.00007966826524352655, -0.000019469356629997492, 0.0004891985445283353, 0.0014737911988049746, 0.002656186930835247, 0.0034695304930210114, 0.003842866513878107, 0.003711456200107932, 0.003457743674516678, 0.003412203397601843, 0.0035664206370711327, 0.004038712475448847, 0.004720110911875963, 0.004973366856575012, 0.004748934879899025, 0.0042039984837174416, 0.0032233186066150665, 0.0024940890725702047, 0.0018735071644186974, 0.0011394205503165722, 0.0007922023069113493, 0.0008719172328710556, 0.0014163162559270859, 0.0023518395610153675, 0.0034084178041666746, 0.004349309019744396, 0.0047156717628240585, 0.004423675127327442, 0.0034617814235389233, 0.0020741219632327557, 0.0008914608624763787, 0.00009569706162437797, -0.00007738446583971381, 0.00028482393827289343, 0.0008842726238071918, 0.001350083970464766, 0.0016136938938871026, 0.0017465953715145588, 0.001663515344262123, 0.0017947549931704998, 0.0020924548152834177, 0.0021935543045401573, 0.0023237853311002254, 0.0022673329804092646, 0.0015724782133474946, 0.0007042744546197355, -0.00018172642739955336, -0.0007303110905922949, -0.000419959076680243, 0.00037285941652953625, 0.0014732438139617443, 0.002541382098570466, 0.003225372638553381, 0.0033113497775048018, 0.0029500017408281565, 0.002518998458981514, 0.0019532586447894573, 0.0017245702911168337, 0.0017401166260242462, 0.0018367856973782182, 0.002232428640127182, 0.002508210251107812, 0.0028898322489112616, 0.0031823995523154736, 0.003140102606266737, 0.0032547018490731716, 0.003496068064123392, 0.003740378189831972, 0.0038447617553174496, 0.003847528714686632, 0.0038321649190038443, 0.00369443790987134, 0.0033678666222840548, 0.003026065416634083, 0.0027238023467361927, 0.0023623290471732616, 0.002223776187747717, 0.002216088119894266, 0.0023202463053166866, 0.002538147382438183, 0.002786851953715086, 0.0033315466716885567, 0.0039264727383852005, 0.004425765946507454, 0.004675170872360468, 0.004644646774977446, 0.004448204766958952, 0.003805271815508604, 0.003062805626541376, 0.0023384527303278446, 0.0017330879345536232, 0.0015174502041190863, 0.0014465636340901256, 0.0015171606792137027, 0.0016836861614137888, 0.0017887256108224392, 0.0017487392760813236, 0.001680344226770103, 0.0015162660274654627, 0.0014656998682767153, 0.00180426228325814, 0.0022254306823015213, 0.0029277957510203123, 0.0037256854120641947, 0.004296914208680391, 0.004738764837384224, 0.004701427184045315, 0.004322536755353212, 0.003712218953296542, 0.0028687105514109135, 0.0022475675214082003, 0.0016850612591952085, 0.0013638838427141309, 0.0015220599016174674, 0.0019569299183785915, 0.0027320864610373974, 0.0036124351900070906, 0.004505667369812727, 0.005304994061589241, 0.005686677526682615, 0.005537889432162046, 0.00518879434093833, 0.0046307360753417015, 0.003925326280295849, 0.0037136112805455923, 0.0035381605848670006, 0.0034842202439904213, 0.003910266328603029, 0.004218217916786671, 0.004589456599205732, 0.005025103222578764, 0.0051208361983299255, 0.004993602633476257, 0.004805011674761772, 0.004380928818136454, 0.003986455034464598, 0.003784528002142906, 0.0034296729136258364, 0.003221668768674135, 0.003073623636737466, 0.0030513007659465075, 0.003397309221327305, 0.0037330538034439087, 0.004082251340150833, 0.004306059330701828, 0.004479679279029369, 0.004455546848475933, 0.00390683114528656, 0.00329418433830142, 0.0026740706525743008, 0.002420394914224744, 0.0026929278392344713, 0.00288230087608099, 0.0033047646284103394, 0.0038144204299896955, 0.0039025719743222, 0.003936010412871838, 0.003630533814430237, 0.0030349947046488523, 0.0027655665762722492, 0.002462423872202635, 0.0022237978409975767, 0.0022701791021972895, 0.002346745692193508, 0.002617523306980729, 0.002745262114331126, 0.0026609175838530064, 0.002646411769092083, 0.002343765925616026, 0.0020540852565318346, 0.002063068561255932, 0.002130575943738222, 0.002514956519007683, 0.003059430280700326, 0.0034631979651749134, 0.0038214719388633966, 0.003951800987124443, 0.0037385765463113785, 0.003207040950655937, 0.0027390734758228064, 0.0022255058865994215, 0.0017232031095772982, 0.0016189906746149063, 0.0014750621048733592, 0.0017304137581959367, 0.002133177826181054, 0.002527008531615138, 0.0031764216255396605, 0.0035936268977820873, 0.004094433970749378, 0.004396325442939997, 0.004531043581664562, 0.0045782942324876785, 0.004269558470696211, 0.003984500654041767, 0.0035818801261484623, 0.0032541428226977587, 0.0031115696765482426, 0.0028840757440775633, 0.0030212034471333027, 0.0031825476326048374, 0.003321812953799963, 0.003627037862315774, 0.00354979420080781, 0.00361230899579823, 0.0035899814683943987, 0.0034443619661033154, 0.003689515870064497, 0.0037979288026690483, 0.0038350149989128113, 0.003871121210977435, 0.003747330280020833, 0.003595770336687565, 0.0035960066597908735, 0.003609640523791313, 0.0036399560049176216, 0.0038872200530022383, 0.003919849172234535, 0.0038564391434192657, 0.0038357710000127554, 0.0036394766066223383, 0.0035362644121050835, 0.0034025097265839577, 0.003185085952281952, 0.003137917025014758, 0.0031541939824819565, 0.0031280831899493933, 0.003187599591910839, 0.003268567379564047, 0.0033073739614337683, 0.0034046689979732037, 0.0035519003868103027, 0.0036603547632694244, 0.0037175877951085567, 0.003854026785120368, 0.0037620754446834326, 0.0036541521549224854, 0.0036983645986765623, 0.0035833243746310472, 0.0036747308913618326, 0.003839736571535468, 0.004090690519660711, 0.004525883123278618, 0.004719125106930733, 0.004855429753661156, 0.004903391003608704, 0.004665014799684286, 0.004448711406439543, 0.004073177929967642, 0.0036911240313202143, 0.0035396546591073275, 0.0033724738750606775, 0.0034479456953704357, 0.003667575540021062, 0.0038928312715142965, 0.0041901119984686375, 0.004473154898732901, 0.004506301134824753, 0.004388915374875069, 0.004314776510000229, 0.003959660418331623, 0.0038018084596842527, 0.0037354477681219578, 0.0034334715455770493, 0.003509165020659566, 0.0035486011765897274, 0.0034486493095755577, 0.0035498274955898523, 0.003478849772363901, 0.0034537988249212503, 0.003579140407964587, 0.0035735226701945066, 0.003612934146076441, 0.0036370365414768457, 0.003665999975055456, 0.0035910215228796005, 0.00341517711058259, 0.0034341595601290464, 0.00325314630754292, 0.003294011577963829, 0.0034851408563554287, 0.003233584575355053, 0.003230823902413249, 0.0030800977256149054, 0.0026985749136656523, 0.002659183694049716, 0.0023890994489192963, 0.002112569287419319, 0.002180662238970399, 0.002213628264144063, 0.002345734741538763, 0.00258060684427619, 0.0026515088975429535, 0.002719671931117773, 0.0027913590893149376, 0.0027095675468444824, 0.002666149288415909, 0.00261293794028461, 0.002445994643494487, 0.0024161781184375286, 0.0022663010749965906, 0.0021308823488652706, 0.0020744898356497288, 0.001875419053249061, 0.001892830478027463, 0.0016516546020284295, 0.0014571778010576963, 0.001362251816317439, 0.0010652649216353893, 0.0011790853459388018, 0.0011516333324834704, 0.0012670991709455848, 0.0015805341536179185, 0.0017885505221784115, 0.0022090435959398746, 0.002399461343884468, 0.002548342337831855, 0.0025593095924705267, 0.0024412262719124556, 0.0022646018769592047, 0.0019817687571048737, 0.0018445099703967571, 0.0016525143291801214, 0.00170049665030092, 0.0016851864056661725, 0.001669559278525412, 0.0018607575912028551, 0.0017741444753482938, 0.0019529784331098199, 0.002182088792324066, 0.0022599720396101475, 0.002565286820754409, 0.0026213587261736393, 0.0025952819269150496, 0.0026767051313072443, 0.0025406009517610073, 0.0023858880158513784, 0.0022297168616205454, 0.00205581565387547, 0.0019052453571930528, 0.0018749526934698224, 0.0019647718872874975, 0.0018552580149844289, 0.0020349211990833282, 0.002229001373052597, 0.0021600762847810984, 0.0023720422759652138, 0.0023593909572809935, 0.002295572077855468, 0.0024066201876848936, 0.0023086778819561005, 0.002212274121120572, 0.002159703290089965, 0.0019509524572640657, 0.0017122593708336353, 0.0016697305254638195, 0.0015934944385662675, 0.0015826878370717168, 0.0017203952884301543, 0.0017866553971543908, 0.0019190401071682572, 0.002013672608882189, 0.001925884047523141, 0.0017837643390521407, 0.001600378891453147, 0.0014059290988370776, 0.0012858263216912746, 0.0011078733950853348, 0.0010809071827679873, 0.001163580804131925, 0.0011431947350502014, 0.0013023820938542485, 0.001408495125360787, 0.001413727062754333, 0.0015169313410297036, 0.0015990567626431584, 0.001626363256946206, 0.0016389981610700488, 0.0016043479554355145, 0.0014789553824812174, 0.0014661768218502402, 0.0013657783856615424, 0.0012610855046659708, 0.001355151180177927, 0.0013420428149402142, 0.0013873787829652429, 0.0014193785609677434, 0.0014290717663243413, 0.0014307141536846757, 0.0014190947404131293, 0.0013911114074289799, 0.001236982992850244, 0.0012818017276003957, 0.0012572372797876596, 0.0012878396082669497, 0.0013311628717929125, 0.0012968098744750023, 0.001496048062108457, 0.001552770147100091, 0.0015596277080476284, 0.0016602810937911272, 0.0016984452959150076, 0.0016573044704273343, 0.0017007780261337757, 0.0016286155441775918, 0.0015325117856264114, 0.0015684677055105567, 0.001473617390729487, 0.0014130428899079561, 0.00141138827893883, 0.0013640552060678601, 0.0012739542871713638, 0.0012688601855188608, 0.0012069486547261477, 0.0012043587630614638, 0.0012561905896291137, 0.001184329972602427, 0.0012173845898360014, 0.0011891932226717472, 0.0012418186524882913, 0.0011815129546448588, 0.0011010760208591819, 0.0011639953590929508, 0.0010174071649089456, 0.001118669519200921, 0.0010877975728362799, 0.0009390687337145209, 0.0009270430891774595, 0.0007580534438602626, 0.0008157776319421828, 0.0007608722080476582, 0.000731595850083977, 0.0007662322022952139, 0.0005747482064180076, 0.0005956249660812318, 0.0004872815334238112, 0.0003062747127842158, 0.0002412889152765274, 0.0002215852146036923, 0.0002788079436868429, 0.00027078730636276305, 0.00042486729216761887, 0.00047206159797497094, 0.0005310976994223893, 0.0007640847470611334, 0.0008464898564852774, 0.0009724320843815804, 0.0011020833626389503, 0.0011099466355517507, 0.0009462819434702396, 0.0007360427989624441, 0.00047649501357227564, 0.00020863588724751025, 0.00010495850438019261, -0.000023991597117856145, 0.00006606688111787662, 0.0001810896792449057, 0.0001817229058360681, 0.0003182019863743335, 0.0002247150696348399, 0.0002596426638774574, 0.0003827809705398977, 0.00031637022038921714, 0.00047066513798199594, 0.000469747930765152, 0.0004577196959871799, 0.0004358267760835588, 0.0002509938203729689, 0.00021791848121210933, 0.000010781488526845351, 0.000023965581931406632, -0.000002906528834500932, -0.00010011948324972764, 0.00009983363997889683, 0.000001128331291511131, 0.00009032255184138194, 0.00017235599807463586, 0.00009351316111860797, 0.00026010372675955296, 0.00021124863997101784, 0.00017325997760053724, 0.0002445185964461416, 0.0001269610511371866, 0.00025811270461417735, 0.0003537570883054286, 0.00028113005100749433, 0.00041845726082101464, 0.00032426632242277265, 0.0003459929139353335, 0.0003459471627138555, 0.00023384644009638578, 0.0003321077674627304, 0.00021345657296478748, 0.00026774953585118055, 0.00025542726507410407, 0.00018380470282863826, 0.00040042566251941025, 0.00034106624661944807, 0.00046647037379443645, 0.00064715655753389, 0.0005262511549517512, 0.0006501885945908725, 0.0006337449885904789, 0.0005370753351598978, 0.0005602843593806028, 0.0003937570727430284, 0.00032488195574842393, 0.0002918272220995277, 0.00020553648937493563, 0.00017958642274606973, 0.00009813827637117356, 0.000008372976481041405, -0.000057320150517625734, -0.0000216558273677947, 0.0000147614964589593, -0.00001325852736044908, 0.00012977571168448776, 0.00021425793238449842, 0.0002037436788668856, 0.00037602538941428065, 0.0004294032696634531, 0.0003860184515360743, 0.0005059731774963439, 0.00039649842074140906, 0.00026597807300277054, 0.0002995587419718504, 0.00011269236711086705, 0.00000147554817431228 //
, 0.000016443167623947375, -0.00003407561962376349, -0.00005273898568702862, 0.00007563901453977451, 0.00006271440361160785, 0.00005105325544718653, 0.00014747577370144427, 0.000028352655135677196, 0.00015006570902187377, 0.00007996612839633599, 0.00004943599924445152, 0.00025472790002822876, 0.00010100463259732351, 0.00020899632363580167, 0.00015609159891027957, 0.00002092659633490257, 0.00009445635078009218, -0.000011896834621438757, 0.000004741103566630045, -0.00006463228055508807, -0.0001333757973043248, -0.0001847890525823459, -0.0002513438230380416, -0.00023702302132733166, -0.00038303466862998903, -0.00037701710243709385, -0.00031067620147950947, -0.000296302285278216, -0.000026792817152454518, 0.00005725225491914898, 0.0001039490889525041, 0.0003046135825570673, 0.0001957686326932162, 0.00017764864605851471, 0.00013666940503753722, -0.00003552396083250642, -0.000003554727754817577, -0.0000299124549201224, -0.00004520211223280057, 0.000002159246832889039, 0.00007056313188513741, 0.00005591469016508199, 0.0001015309535432607, 0.00022127926058601588, 0.00011247194197494537, 0.00021095969714224339, 0.00016735993267502636, -0.000048102974687935784, 0.00007062359509291127, -0.00009568708628648892, -0.0001804609055398032, -0.00011775188613682985, -0.0002559250278864056, -0.00007072336302371696, 0.000021769537852378562, 0.00008256341970991343, 0.0003065279743168503, 0.0003318350645713508, 0.0003853626549243927, 0.00039483944419771433, 0.0004149565938860178, 0.00032722382456995547, 0.00023680870071984828, 0.00021660416678059846, 0.0000685889899614267, 0.00015701152733527124, -0.000016330488506355323, -0.00002005070746236015, 0.00008248546510003507, -0.00007792981341481209, 0.00020276950090192258, 0.00015292881289497018, 0.00012754343333654106, 0.00027759026852436364, 0.00018318294314667583, 0.00016299284470733255, 0.00010094359458889812, 0.000058865723985945806, 0.000002594048964965623, 0.00003903829929186031, 0.000046174038288882, 0.00007909060514066368, 0.00012273895845282823, 0.00009757888619787991, 0.00013255261001177132, 0.00011674823326757178, 0.0001310874504270032, 0.00008483991405228153, 0.00002180447700084187, 0.000024236596800619736, 0.0000017055874650395708, -0.000006383335403370438, 0.000006840114565420663, 0.000025644250854384154, -0.00004047592301503755, -0.00008400051592616364, 0.0000030356998195202323, -0.00005431680619949475, -0.00010562714305706322, 0.0000019930726011807565, -0.00005882163532078266, -0.00004040663770865649, 0.000041544637497281656, -0.000053374718845589086, -0.00004876630919170566, -0.00006780691182939336, -0.00009301674435846508, -0.000004693175924330717, -0.00009159332694252953, -0.00008364747191080824, -0.0000128614319692133, -0.00021310822921805084, -0.00016931007849052548, -0.00013953016605228186, -0.0002648105437401682, -0.00015257885388564318, -0.00009655269968789071, -0.0000871247029863298, -0.000013048580512986518, 0.0000139726198540302, 0.0000029010939215368126, 0.00006042142922524363, -0.00003639016722445376, -0.00006372696225298569, -0.000001922818455568631, -0.00020918996597174555, -0.0001450410345569253, -0.00006247487908694893, -0.0002372680464759469, -0.0001366327633149922, -0.0000966571387834847, -0.00017797019972931594, -0.00006262780516408384, -0.00009402752766618505, -0.00016626647266093642, -0.00009953269182005897, -0.0001304188626818359, -0.0001278262643609196, -0.00009818274702411145, -0.00011750443809432909, -0.000009857811164692976, -0.00008461871038889512, -0.00010569883306743577, 0.00001085805160983, -0.00011621668090810999, -0.00002944252446468454, -0.000044263761083129793, -0.00010271128121530637, -0.000014649805962108076, -0.00009419941488886252, -0.00005971280188532546, -0.00005979196430416778, -0.000010148820365429856, -0.000027335041522746906, -0.0000617482146481052, 0.00002283337562403176, -0.00006315900827758014, -0.00004418776370584965, 0.000002149694410036318, -0.000034120792406611145, -0.00006459573341999203, -1.7087232606627367e-7, -0.000018552917026681826, -0.00007125300908228382, 0.000039345606637652963, -0.000048369791329605505, -0.00001353240259049926, 0.00004371571048977785, -0.000035690234653884545, 0.00004885479575023055, -0.0000148163862832007 //
];
this.connectFilters=function(){
console.log('connectFilters');
/*if(me.testPlayOn){
console.log('can not connect');
return;
}*/
if(this.cabinet){
//
}else{
/*
this.compressorMaster=this.audioContext.createDynamicsCompressor();
this.compressorMaster.threshold.value = -50;//-24;
this.compressorMaster.knee.value = 40;//30;
this.compressorMaster.ratio.value = 12;
this.compressorMaster.reduction.value = -20;//0;
this.compressorMaster.attack.value = 0.003;
this.compressorMaster.release.value = 0.25;
*/
this.cabinet=this.audioContext.createConvolver();
var audioBuffer = this.audioContext.createBuffer(1, cabinetImpulse.length, this.audioContext.sampleRate);
var data = audioBuffer.getChannelData(0);
for(var i=0;i<cabinetImpulse.length;i++){
data[i] = cabinetImpulse[i];;
}
this.cabinet.buffer = audioBuffer;
//
this.eq32 = this.createEq(32);
this.eq63 = this.createEq(63);
this.eq125 = this.createEq(125);
this.eq250 = this.createEq(250);
this.eq500 = this.createEq(500);
this.eq1000 = this.createEq(1000);
this.eq2000 = this.createEq(2000);
this.eq4000 = this.createEq(4000);
this.eq8000 = this.createEq(8000);
this.eq16000 = this.createEq(16000);
}
console.log(this.song.equalizer);
if(this.song.equalizer){
//this.scriptProcessorNode.connect(this.eq63);
this.scriptProcessorNode.connect(this.cabinet);
this.cabinet.connect(this.eq32);
this.eq32.connect(this.eq63);
this.eq63.connect(this.eq125);
this.eq125.connect(this.eq250);
this.eq250.connect(this.eq500);
this.eq500.connect(this.eq1000);
this.eq1000.connect(this.eq2000);
this.eq2000.connect(this.eq4000);
this.eq4000.connect(this.eq8000);
this.eq8000.connect(this.eq16000);
this.eq16000.connect(this.audioContext.destination);
if(this.song.equalizer==1){
this.eq32.gain.value = 0;
this.eq63.gain.value = 2;
this.eq125.gain.value = 3;
this.eq250.gain.value = 4;
this.eq500.gain.value = 2;
this.eq1000.gain.value = 4;
this.eq2000.gain.value = 6;
this.eq4000.gain.value = 7;
this.eq8000.gain.value = 5;
this.eq16000.gain.value = -5;
}else{
this.eq32.gain.value = 6;
this.eq63.gain.value = 5;
this.eq125.gain.value = 5;
this.eq250.gain.value = -2;
this.eq500.gain.value = -6;
this.eq1000.gain.value = 4;
this.eq2000.gain.value = 10;
this.eq4000.gain.value = 3;
this.eq8000.gain.value = -2;
this.eq16000.gain.value = -10;
}
}else{
//this.scriptProcessorNode.connect(this.audioContext.destination);
this.scriptProcessorNode.connect(this.cabinet);
this.cabinet.connect(this.audioContext.destination);
}
//this.scriptProcessorNode.connect(this.compressorMaster);
//this.compressorMaster.connect(this.audioContext.destination);
//this.scriptProcessorNode.connect(this.audioContext.destination);
}
//this.playAudio5 = function (signed) {
this.playAudio5 = function (buffers, mixSampleRate) {
console.log("start playAudio5");
//var div = document.getElementById('playDiv');
//div.style.visibility = 'visible';
this.stopAudio5();
if (this.audioContext == null) {
try {
console.log("fix up for prefixing");
window.AudioContext = window.AudioContext || window.webkitAudioContext;
this.audioContext = new AudioContext();
} catch (e) {
console.log(e);
}
}
this.audioBufferSourceNode = this.audioContext.createBufferSource();
//console.log("1");
//console.log(this.audioContext.destination);
this.audioBufferSourceNode.connect(this.audioContext.destination);
/*
var gainNode = this.audioContext.createGain();
this.audioBufferSourceNode.connect(gainNode);
gainNode.connect(this.audioContext.destination);
*/
//console.log("song length "+signed.length/44100);
this.audioBufferSourceNode.loop = true; // Make sure that sound will repeat
signed = [];
for (var i = 0; i < buffers.length; i++) {
signed = signed.concat(buffers[i]);
}
var audioBuffer = this.audioContext.createBuffer(1, signed.length, mixSampleRate);
var float32Array = audioBuffer.getChannelData(0);
for (i = 0; i < float32Array.length; i++) {
float32Array[i] = signed[i] / 768.0;
}
//console.log("send", signed);
this.audioBufferSourceNode.buffer = audioBuffer; // Assign our buffer to the
//this.audioBufferSourceNode.noteOn(0);
this.audioBufferSourceNode.start();
console.log("done playAudio5");
};
this.doTestSample = function (sample, f32, fre, loopStart, loopEnd) {
var audioBufferSourceNode = me.audioContext.createBufferSource();
audioBufferSourceNode.connect(me.audioContext.destination);
//var fre=44100.0;
if (loopStart != 0 && loopEnd != 0) {
audioBufferSourceNode.loop = true;
audioBufferSourceNode.loopStart = sample.loopStart / fre;
audioBufferSourceNode.loopEnd = sample.loopEnd / fre;
}
var audioBuffer = me.audioContext.createBuffer(1, f32.length, fre);
var float32Array = audioBuffer.getChannelData(0);
for (i = 0; i < float32Array.length; i++) {
float32Array[i] = f32[i];
}
//loopEnd: 17523loopStart: 17100
audioBufferSourceNode.buffer = audioBuffer;
return audioBufferSourceNode;
};
//me.nextPosition=null;
me.tick16 = 0;
me.song16 = 0;
me.position16 = null;
me.play16on = false;
me.drums16 = [];
me.instruments16 = [];
me.c16 = 0;
me.ticker16 = null;
this.decay16 = function () {}
this.add16 = function () {
console.log(me.c16, me.position16.left, "x", me.position16.top, ":", me.tick16);
for (var r = 0; r < me.position16.riffIds.length; r++) {
var songRiff = toolbox.findRiffById(me.position16.riffIds[r], me.song16);
var chord = songRiff.beat[me.tick16];
if (chord != null) {
for (var i = 0; i < chord.length; i++) {
var songRiffBeatPoint = chord[i];
me.drum16(toolbox.findSampleById(songRiffBeatPoint.sampleId, me.song16));
}
}
for (var t = 0; t < songRiff.tunes.length; t++) {
var songRiffTune = songRiff.tunes[t];
var chord = songRiffTune.steps[me.tick16];
if (chord != null) {
for (var i = 0; i < chord.length; i++) {
var songRiffTunePoint = chord[i];
var songSample = toolbox.findSampleById(songRiffTune.sampleId, me.song16);
this.instrument16(songSample, songRiffTunePoint);
}
}
}
}
me.c16++;
}
this.drum16 = function (sample) {
console.log("drum16", sample);
var audioBufferSourceNode = me.audioContext.createBufferSource();
audioBufferSourceNode.connect(me.audioContext.destination);
var f32 = app.cache.find32Buffer(sample.path);
var audioBuffer = me.audioContext.createBuffer(1, f32.length, 44100);
var float32Array = audioBuffer.getChannelData(0);
/*console.log(float32Array.length);
console.log(float32Array.push);
console.log(float32Array);*/
float32Array.set(f32);
/*for (i = 0; i < float32Array.length; i++) {
float32Array[i] = f32[i];
}*/
audioBufferSourceNode.buffer = audioBuffer;
audioBufferSourceNode.start();
}
this.instrument16 = function (sample, songRiffTunePoint) {
console.log("instrument16", sample, songRiffTunePoint);
}
this.moveNext16 = function () {
me.add16();
me.tick16++;
if (me.tick16 >= me.song16.meter) {
me.tick16 = 0;
me.position16 = toolbox.nextPosition(me.song16, me.position16.left, me.position16.top);
}
};
this.resetNext16 = function (song) {
me.song16 = song;
me.position16 = toolbox.findOrCreatePositionXY(me.song16, 0, 0);
me.tick16 = 0;
me.drums16 = [];
me.instruments16 = [];
me.c16 = 0;
};
this.playBuffer = function (song) {
if (this.audioContext == null) {
try {
console.log("fix up for prefixing");
window.AudioContext = window.AudioContext || window.webkitAudioContext;
this.audioContext = new AudioContext();
} catch (e) {
console.log(e);
}
}
app.cache.all(song, function () { //
me.play16on = true;
me.resetNext16(song);
var d16 = (60000 / 4) / song.tempo;
me.ticker16 = new Ticker(d16, me.moveNext16);
me.ticker16.start();
}, function () { //
console.log("Can't cache");
});
/*
for (var i = 0; i < 999; i++) {
me.moveNext16();
}
*/
/*
app.cache.all(song, function () { //
console.log("playBuffer",song);
me.hidePrompt();
var sample=app.song.samples[2];
var fre=44100.0;
var f32=app.cache.find32Buffer(sample.path);
window.AudioContext = window.AudioContext || window.webkitAudioContext;
me.audioContext = new AudioContext();
var s2=me.doTestSample(sample,f32,fre,sample.loopStart/fre,sample.loopEnd/fre);
fre=44100.0*2;
var s2a=me.doTestSample(sample,f32,fre,0,0);
fre=44100.0/2;
var s2b=me.doTestSample(sample,f32,fre,0,0);
s2.start();
s2a.start();
s2b.start();
}, function () { //
console.log("Can't cache");
});*/
};
this.stopBuffer = function () {
me.play16on = false;
if (me.ticker16) {
me.ticker16.stop();
}
}
return this;
}
// Copyright (c) 2013 Pieroxy <[email protected]>
// This work is free. You can redistribute it and/or modify it
// under the terms of the WTFPL, Version 2
// For more information see LICENSE.txt or http://www.wtfpl.net/
//
// This lib is part of the lz-string project.
// For more information, the home page:
// http://pieroxy.net/blog/pages/lz-string/index.html
//
// Base64 compression / decompression for already compressed content (gif, png, jpg, mp3, ...)
// version 1.1.0
var Base64String = {
compressToUTF16 : function (input) {
var output = "",
i,c,
current,
status = 0;
input = this.compress(input);
for (i=0 ; i<input.length ; i++) {
c = input.charCodeAt(i);
switch (status++) {
case 0:
output += String.fromCharCode((c >> 1)+32);
current = (c & 1) << 14;
break;
case 1:
output += String.fromCharCode((current + (c >> 2))+32);
current = (c & 3) << 13;
break;
case 2:
output += String.fromCharCode((current + (c >> 3))+32);
current = (c & 7) << 12;
break;
case 3:
output += String.fromCharCode((current + (c >> 4))+32);
current = (c & 15) << 11;
break;
case 4:
output += String.fromCharCode((current + (c >> 5))+32);
current = (c & 31) << 10;
break;
case 5:
output += String.fromCharCode((current + (c >> 6))+32);
current = (c & 63) << 9;
break;
case 6:
output += String.fromCharCode((current + (c >> 7))+32);
current = (c & 127) << 8;