audio-mixer-ui 0.5.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1267 @@
1
+ function V(m) {
2
+ return m && m.__esModule && Object.prototype.hasOwnProperty.call(m, "default") ? m.default : m;
3
+ }
4
+ var M = { exports: {} }, D = M.exports, B;
5
+ function _() {
6
+ return B || (B = 1, function(m, F) {
7
+ (function(b) {
8
+ function I(q) {
9
+ Object.assign(q, {
10
+ properties: {
11
+ masterVol: { type: Number, value: 0.5, observer: "setMasterVol" },
12
+ reverbLev: { type: Number, value: 0.3, observer: "setReverbLev" },
13
+ quality: { type: Number, value: 1, observer: "setQuality" },
14
+ debug: { type: Number, value: 0 },
15
+ src: { type: String, value: null, observer: "loadMIDIfromSrc" },
16
+ loop: { type: Number, value: 0 },
17
+ internalcontext: { type: Number, value: 1 },
18
+ tsmode: { type: Number, value: 0 },
19
+ voices: { type: Number, value: 64 },
20
+ useReverb: { type: Number, value: 1 },
21
+ /*@@gui*/
22
+ width: { type: String, value: "300px", observer: "layout" },
23
+ height: { type: String, value: "32px", observer: "layout" },
24
+ graph: { type: Number, value: 1 },
25
+ disabledrop: { type: Number, value: 0 },
26
+ perfmon: { type: Number, value: 0 }
27
+ /*@@guiEND*/
28
+ },
29
+ /*@@gui*/
30
+ layout: () => {
31
+ this.canvas.style.width = this.width, this.canvas.style.height = this.height;
32
+ },
33
+ /*@@guiEND*/
34
+ program: [
35
+ // 1-8 : Piano
36
+ { name: "Acoustic Grand Piano" },
37
+ { name: "Bright Acoustic Piano" },
38
+ { name: "Electric Grand Piano" },
39
+ { name: "Honky-tonk Piano" },
40
+ { name: "Electric Piano 1" },
41
+ { name: "Electric Piano 2" },
42
+ { name: "Harpsichord" },
43
+ { name: "Clavi" },
44
+ /* 9-16 : Chromatic Perc*/
45
+ { name: "Celesta" },
46
+ { name: "Glockenspiel" },
47
+ { name: "Music Box" },
48
+ { name: "Vibraphone" },
49
+ { name: "Marimba" },
50
+ { name: "Xylophone" },
51
+ { name: "Tubular Bells" },
52
+ { name: "Dulcimer" },
53
+ /* 17-24 : Organ */
54
+ { name: "Drawbar Organ" },
55
+ { name: "Percussive Organ" },
56
+ { name: "Rock Organ" },
57
+ { name: "Church Organ" },
58
+ { name: "Reed Organ" },
59
+ { name: "Accordion" },
60
+ { name: "Harmonica" },
61
+ { name: "Tango Accordion" },
62
+ /* 25-32 : Guitar */
63
+ { name: "Acoustic Guitar (nylon)" },
64
+ { name: "Acoustic Guitar (steel)" },
65
+ { name: "Electric Guitar (jazz)" },
66
+ { name: "Electric Guitar (clean)" },
67
+ { name: "Electric Guitar (muted)" },
68
+ { name: "Overdriven Guitar" },
69
+ { name: "Distortion Guitar" },
70
+ { name: "Guitar harmonics" },
71
+ /* 33-40 : Bass */
72
+ { name: "Acoustic Bass" },
73
+ { name: "Electric Bass (finger)" },
74
+ { name: "Electric Bass (pick)" },
75
+ { name: "Fretless Bass" },
76
+ { name: "Slap Bass 1" },
77
+ { name: "Slap Bass 2" },
78
+ { name: "Synth Bass 1" },
79
+ { name: "Synth Bass 2" },
80
+ /* 41-48 : Strings */
81
+ { name: "Violin" },
82
+ { name: "Viola" },
83
+ { name: "Cello" },
84
+ { name: "Contrabass" },
85
+ { name: "Tremolo Strings" },
86
+ { name: "Pizzicato Strings" },
87
+ { name: "Orchestral Harp" },
88
+ { name: "Timpani" },
89
+ /* 49-56 : Ensamble */
90
+ { name: "String Ensemble 1" },
91
+ { name: "String Ensemble 2" },
92
+ { name: "SynthStrings 1" },
93
+ { name: "SynthStrings 2" },
94
+ { name: "Choir Aahs" },
95
+ { name: "Voice Oohs" },
96
+ { name: "Synth Voice" },
97
+ { name: "Orchestra Hit" },
98
+ /* 57-64 : Brass */
99
+ { name: "Trumpet" },
100
+ { name: "Trombone" },
101
+ { name: "Tuba" },
102
+ { name: "Muted Trumpet" },
103
+ { name: "French Horn" },
104
+ { name: "Brass Section" },
105
+ { name: "SynthBrass 1" },
106
+ { name: "SynthBrass 2" },
107
+ /* 65-72 : Reed */
108
+ { name: "Soprano Sax" },
109
+ { name: "Alto Sax" },
110
+ { name: "Tenor Sax" },
111
+ { name: "Baritone Sax" },
112
+ { name: "Oboe" },
113
+ { name: "English Horn" },
114
+ { name: "Bassoon" },
115
+ { name: "Clarinet" },
116
+ /* 73-80 : Pipe */
117
+ { name: "Piccolo" },
118
+ { name: "Flute" },
119
+ { name: "Recorder" },
120
+ { name: "Pan Flute" },
121
+ { name: "Blown Bottle" },
122
+ { name: "Shakuhachi" },
123
+ { name: "Whistle" },
124
+ { name: "Ocarina" },
125
+ /* 81-88 : SynthLead */
126
+ { name: "Lead 1 (square)" },
127
+ { name: "Lead 2 (sawtooth)" },
128
+ { name: "Lead 3 (calliope)" },
129
+ { name: "Lead 4 (chiff)" },
130
+ { name: "Lead 5 (charang)" },
131
+ { name: "Lead 6 (voice)" },
132
+ { name: "Lead 7 (fifths)" },
133
+ { name: "Lead 8 (bass + lead)" },
134
+ /* 89-96 : SynthPad */
135
+ { name: "Pad 1 (new age)" },
136
+ { name: "Pad 2 (warm)" },
137
+ { name: "Pad 3 (polysynth)" },
138
+ { name: "Pad 4 (choir)" },
139
+ { name: "Pad 5 (bowed)" },
140
+ { name: "Pad 6 (metallic)" },
141
+ { name: "Pad 7 (halo)" },
142
+ { name: "Pad 8 (sweep)" },
143
+ /* 97-104 : FX */
144
+ { name: "FX 1 (rain)" },
145
+ { name: "FX 2 (soundtrack)" },
146
+ { name: "FX 3 (crystal)" },
147
+ { name: "FX 4 (atmosphere)" },
148
+ { name: "FX 5 (brightness)" },
149
+ { name: "FX 6 (goblins)" },
150
+ { name: "FX 7 (echoes)" },
151
+ { name: "FX 8 (sci-fi)" },
152
+ /* 105-112 : Ethnic */
153
+ { name: "Sitar" },
154
+ { name: "Banjo" },
155
+ { name: "Shamisen" },
156
+ { name: "Koto" },
157
+ { name: "Kalimba" },
158
+ { name: "Bag pipe" },
159
+ { name: "Fiddle" },
160
+ { name: "Shanai" },
161
+ /* 113-120 : Percussive */
162
+ { name: "Tinkle Bell" },
163
+ { name: "Agogo" },
164
+ { name: "Steel Drums" },
165
+ { name: "Woodblock" },
166
+ { name: "Taiko Drum" },
167
+ { name: "Melodic Tom" },
168
+ { name: "Synth Drum" },
169
+ { name: "Reverse Cymbal" },
170
+ /* 121-128 : SE */
171
+ { name: "Guitar Fret Noise" },
172
+ { name: "Breath Noise" },
173
+ { name: "Seashore" },
174
+ { name: "Bird Tweet" },
175
+ { name: "Telephone Ring" },
176
+ { name: "Helicopter" },
177
+ { name: "Applause" },
178
+ { name: "Gunshot" }
179
+ ],
180
+ drummap: [
181
+ // 35
182
+ { name: "Acoustic Bass Drum" },
183
+ { name: "Bass Drum 1" },
184
+ { name: "Side Stick" },
185
+ { name: "Acoustic Snare" },
186
+ { name: "Hand Clap" },
187
+ { name: "Electric Snare" },
188
+ { name: "Low Floor Tom" },
189
+ { name: "Closed Hi Hat" },
190
+ { name: "High Floor Tom" },
191
+ { name: "Pedal Hi-Hat" },
192
+ { name: "Low Tom" },
193
+ { name: "Open Hi-Hat" },
194
+ { name: "Low-Mid Tom" },
195
+ { name: "Hi-Mid Tom" },
196
+ { name: "Crash Cymbal 1" },
197
+ { name: "High Tom" },
198
+ { name: "Ride Cymbal 1" },
199
+ { name: "Chinese Cymbal" },
200
+ { name: "Ride Bell" },
201
+ { name: "Tambourine" },
202
+ { name: "Splash Cymbal" },
203
+ { name: "Cowbell" },
204
+ { name: "Crash Cymbal 2" },
205
+ { name: "Vibraslap" },
206
+ { name: "Ride Cymbal 2" },
207
+ { name: "Hi Bongo" },
208
+ { name: "Low Bongo" },
209
+ { name: "Mute Hi Conga" },
210
+ { name: "Open Hi Conga" },
211
+ { name: "Low Conga" },
212
+ { name: "High Timbale" },
213
+ { name: "Low Timbale" },
214
+ { name: "High Agogo" },
215
+ { name: "Low Agogo" },
216
+ { name: "Cabasa" },
217
+ { name: "Maracas" },
218
+ { name: "Short Whistle" },
219
+ { name: "Long Whistle" },
220
+ { name: "Short Guiro" },
221
+ { name: "Long Guiro" },
222
+ { name: "Claves" },
223
+ { name: "Hi Wood Block" },
224
+ { name: "Low Wood Block" },
225
+ { name: "Mute Cuica" },
226
+ { name: "Open Cuica" },
227
+ { name: "Mute Triangle" },
228
+ { name: "Open Triangle" }
229
+ ],
230
+ program1: [
231
+ // 1-8 : Piano
232
+ [{ w: "sine", v: 0.4, d: 0.7, r: 0.1 }, { w: "triangle", v: 3, d: 0.7, s: 0.1, g: 1, a: 0.01, k: -1.2 }],
233
+ [{ w: "triangle", v: 0.4, d: 0.7, r: 0.1 }, { w: "triangle", v: 4, t: 3, d: 0.4, s: 0.1, g: 1, k: -1, a: 0.01 }],
234
+ [{ w: "sine", d: 0.7, r: 0.1 }, { w: "triangle", v: 4, f: 2, d: 0.5, s: 0.5, g: 1, k: -1 }],
235
+ [{ w: "sine", d: 0.7, v: 0.2 }, { w: "triangle", v: 4, t: 3, f: 2, d: 0.3, g: 1, k: -1, a: 0.01, s: 0.5 }],
236
+ [{ w: "sine", v: 0.35, d: 0.7 }, { w: "sine", v: 3, t: 7, f: 1, d: 1, s: 1, g: 1, k: -0.7 }],
237
+ [{ w: "sine", v: 0.35, d: 0.7 }, { w: "sine", v: 8, t: 7, f: 1, d: 0.5, s: 1, g: 1, k: -0.7 }],
238
+ [{ w: "sawtooth", v: 0.34, d: 2 }, { w: "sine", v: 8, f: 0.1, d: 2, s: 1, r: 2, g: 1 }],
239
+ [{ w: "triangle", v: 0.34, d: 1.5 }, { w: "square", v: 6, f: 0.1, d: 1.5, s: 0.5, r: 2, g: 1 }],
240
+ /* 9-16 : Chromatic Perc*/
241
+ [{ w: "sine", d: 0.3, r: 0.3 }, { w: "sine", v: 7, t: 11, d: 0.03, g: 1 }],
242
+ [{ w: "sine", d: 0.3, r: 0.3 }, { w: "sine", v: 11, t: 6, d: 0.2, s: 0.4, g: 1 }],
243
+ [{ w: "sine", v: 0.2, d: 0.3, r: 0.3 }, { w: "sine", v: 11, t: 5, d: 0.1, s: 0.4, g: 1 }],
244
+ [{ w: "sine", v: 0.2, d: 0.6, r: 0.6 }, { w: "triangle", v: 11, t: 5, f: 1, s: 0.5, g: 1 }],
245
+ [{ w: "sine", v: 0.3, d: 0.2, r: 0.2 }, { w: "sine", v: 6, t: 5, d: 0.02, g: 1 }],
246
+ [{ w: "sine", v: 0.3, d: 0.2, r: 0.2 }, { w: "sine", v: 7, t: 11, d: 0.03, g: 1 }],
247
+ [{ w: "sine", v: 0.2, d: 1, r: 1 }, { w: "sine", v: 11, t: 3.5, d: 1, r: 1, g: 1 }],
248
+ [{ w: "triangle", v: 0.2, d: 0.5, r: 0.2 }, { w: "sine", v: 6, t: 2.5, d: 0.2, s: 0.1, r: 0.2, g: 1 }],
249
+ /* 17-24 : Organ */
250
+ [{ w: "w9999", v: 0.22, s: 0.9 }, { w: "w9999", v: 0.22, t: 2, f: 2, s: 0.9 }],
251
+ [{ w: "w9999", v: 0.2, s: 1 }, { w: "sine", v: 11, t: 6, f: 2, s: 0.1, g: 1, h: 6e-3, r: 2e-3, d: 2e-3 }, { w: "w9999", v: 0.2, t: 2, f: 1, h: 0, s: 1 }],
252
+ [{ w: "w9999", v: 0.2, d: 0.1, s: 0.9 }, { w: "w9999", v: 0.25, t: 4, f: 2, s: 0.5 }],
253
+ [{ w: "w9999", v: 0.3, a: 0.04, s: 0.9 }, { w: "w9999", v: 0.2, t: 8, f: 2, a: 0.04, s: 0.9 }],
254
+ [{ w: "sine", v: 0.2, a: 0.02, d: 0.05, s: 1 }, { w: "sine", v: 6, t: 3, f: 1, a: 0.02, d: 0.05, s: 1, g: 1 }],
255
+ [{ w: "triangle", v: 0.2, a: 0.02, d: 0.05, s: 0.8 }, { w: "square", v: 7, t: 3, f: 1, d: 0.05, s: 1.5, g: 1 }],
256
+ [{ w: "square", v: 0.2, a: 0.02, d: 0.2, s: 0.5 }, { w: "square", v: 1, d: 0.03, s: 2, g: 1 }],
257
+ [{ w: "square", v: 0.2, a: 0.02, d: 0.1, s: 0.8 }, { w: "square", v: 1, a: 0.3, d: 0.1, s: 2, g: 1 }],
258
+ /* 25-32 : Guitar */
259
+ [{ w: "sine", v: 0.3, d: 0.5, f: 1 }, { w: "triangle", v: 5, t: 3, f: -1, d: 1, s: 0.1, g: 1 }],
260
+ [{ w: "sine", v: 0.4, d: 0.6, f: 1 }, { w: "triangle", v: 12, t: 3, d: 0.6, s: 0.1, g: 1, f: -1 }],
261
+ [{ w: "triangle", v: 0.3, d: 1, f: 1 }, { w: "triangle", v: 6, f: -1, d: 0.4, s: 0.5, g: 1, t: 3 }],
262
+ [{ w: "sine", v: 0.3, d: 1, f: -1 }, { w: "triangle", v: 11, f: 1, d: 0.4, s: 0.5, g: 1, t: 3 }],
263
+ [{ w: "sine", v: 0.4, d: 0.1, r: 0.01 }, { w: "sine", v: 7, g: 1 }],
264
+ [{ w: "triangle", v: 0.4, d: 1, f: 1 }, { w: "square", v: 4, f: -1, d: 1, s: 0.7, g: 1 }],
265
+ //[{w:"triangle",v:0.35,d:1,f:1,},{w:"square",v:7,f:-1,d:0.3,s:0.5,g:1,}],
266
+ [{ w: "triangle", v: 0.35, d: 1, f: 1 }, { w: "square", v: 7, f: -1, d: 0.3, s: 0.5, g: 1 }],
267
+ //[{w:"triangle",v:0.4,d:1,f:1,},{w:"square",v:4,f:-1,d:1,s:0.7,g:1,}],//[{w:"triangle",v:0.4,d:1,},{w:"square",v:4,f:2,d:1,s:0.7,g:1,}],
268
+ [{ w: "sine", v: 0.2, t: 1.5, a: 5e-3, h: 0.2, d: 0.6 }, { w: "sine", v: 11, t: 5, f: 2, d: 1, s: 0.5, g: 1 }],
269
+ /* 33-40 : Bass */
270
+ [{ w: "sine", d: 0.3 }, { w: "sine", v: 4, t: 3, d: 1, s: 1, g: 1 }],
271
+ [{ w: "sine", d: 0.3 }, { w: "sine", v: 4, t: 3, d: 1, s: 1, g: 1 }],
272
+ [{ w: "w9999", d: 0.3, v: 0.7, s: 0.5 }, { w: "sawtooth", v: 1.2, d: 0.02, s: 0.5, g: 1, h: 0, r: 0.02 }],
273
+ [{ w: "sine", d: 0.3 }, { w: "sine", v: 4, t: 3, d: 1, s: 1, g: 1 }],
274
+ [{ w: "triangle", v: 0.3, t: 2, d: 1 }, { w: "triangle", v: 15, t: 2.5, d: 0.04, s: 0.1, g: 1 }],
275
+ [{ w: "triangle", v: 0.3, t: 2, d: 1 }, { w: "triangle", v: 15, t: 2.5, d: 0.04, s: 0.1, g: 1 }],
276
+ [{ w: "triangle", d: 0.7 }, { w: "square", v: 0.4, t: 0.5, f: 1, d: 0.2, s: 10, g: 1 }],
277
+ [{ w: "triangle", d: 0.7 }, { w: "square", v: 0.4, t: 0.5, f: 1, d: 0.2, s: 10, g: 1 }],
278
+ /* 41-48 : Strings */
279
+ [{ w: "sawtooth", v: 0.4, a: 0.1, d: 11 }, { w: "sine", v: 5, d: 11, s: 0.2, g: 1 }],
280
+ [{ w: "sawtooth", v: 0.4, a: 0.1, d: 11 }, { w: "sine", v: 5, d: 11, s: 0.2, g: 1 }],
281
+ [{ w: "sawtooth", v: 0.4, a: 0.1, d: 11 }, { w: "sine", v: 5, t: 0.5, d: 11, s: 0.2, g: 1 }],
282
+ [{ w: "sawtooth", v: 0.4, a: 0.1, d: 11 }, { w: "sine", v: 5, t: 0.5, d: 11, s: 0.2, g: 1 }],
283
+ [{ w: "sine", v: 0.4, a: 0.1, d: 11 }, { w: "sine", v: 6, f: 2.5, d: 0.05, s: 1.1, g: 1 }],
284
+ [{ w: "sine", v: 0.3, d: 0.1, r: 0.1 }, { w: "square", v: 4, t: 3, d: 1, s: 0.2, g: 1 }],
285
+ [{ w: "sine", v: 0.3, d: 0.5, r: 0.5 }, { w: "sine", v: 7, t: 2, f: 2, d: 1, r: 1, g: 1 }],
286
+ [{ w: "triangle", v: 0.6, h: 0.03, d: 0.3, r: 0.3, t: 0.5 }, { w: "n0", v: 8, t: 1.5, d: 0.08, r: 0.08, g: 1 }],
287
+ /* 49-56 : Ensamble */
288
+ [{ w: "sawtooth", v: 0.3, a: 0.03, s: 0.5 }, { w: "sawtooth", v: 0.2, t: 2, f: 2, d: 1, s: 2 }],
289
+ [{ w: "sawtooth", v: 0.3, f: -2, a: 0.03, s: 0.5 }, { w: "sawtooth", v: 0.2, t: 2, f: 2, d: 1, s: 2 }],
290
+ [{ w: "sawtooth", v: 0.2, a: 0.02, s: 1 }, { w: "sawtooth", v: 0.2, t: 2, f: 2, a: 1, d: 1, s: 1 }],
291
+ [{ w: "sawtooth", v: 0.2, a: 0.02, s: 1 }, { w: "sawtooth", v: 0.2, f: 2, a: 0.02, d: 1, s: 1 }],
292
+ [{ w: "triangle", v: 0.3, a: 0.03, s: 1 }, { w: "sine", v: 3, t: 5, f: 1, d: 1, s: 1, g: 1 }],
293
+ [{ w: "sine", v: 0.4, a: 0.03, s: 0.9 }, { w: "sine", v: 1, t: 2, f: 3, d: 0.03, s: 0.2, g: 1 }],
294
+ [{ w: "triangle", v: 0.6, a: 0.05, s: 0.5 }, { w: "sine", v: 1, f: 0.8, d: 0.2, s: 0.2, g: 1 }],
295
+ [{ w: "square", v: 0.15, a: 0.01, d: 0.2, r: 0.2, t: 0.5, h: 0.03 }, { w: "square", v: 4, f: 0.5, d: 0.2, r: 11, a: 0.01, g: 1, h: 0.02 }, { w: "square", v: 0.15, t: 4, f: 1, a: 0.02, d: 0.15, r: 0.15, h: 0.03 }, { g: 3, w: "square", v: 4, f: -0.5, a: 0.01, h: 0.02, d: 0.15, r: 11 }],
296
+ /* 57-64 : Brass */
297
+ [{ w: "square", v: 0.2, a: 0.01, d: 1, s: 0.6, r: 0.04 }, { w: "sine", v: 1, d: 0.1, s: 4, g: 1 }],
298
+ [{ w: "square", v: 0.2, a: 0.02, d: 1, s: 0.5, r: 0.08 }, { w: "sine", v: 1, d: 0.1, s: 4, g: 1 }],
299
+ [{ w: "square", v: 0.2, a: 0.04, d: 1, s: 0.4, r: 0.08 }, { w: "sine", v: 1, d: 0.1, s: 4, g: 1 }],
300
+ [{ w: "square", v: 0.15, a: 0.04, s: 1 }, { w: "sine", v: 2, d: 0.1, g: 1 }],
301
+ [{ w: "square", v: 0.2, a: 0.02, d: 1, s: 0.5, r: 0.08 }, { w: "sine", v: 1, d: 0.1, s: 4, g: 1 }],
302
+ [{ w: "square", v: 0.2, a: 0.02, d: 1, s: 0.6, r: 0.08 }, { w: "sine", v: 1, f: 0.2, d: 0.1, s: 4, g: 1 }],
303
+ [{ w: "square", v: 0.2, a: 0.02, d: 0.5, s: 0.7, r: 0.08 }, { w: "sine", v: 1, d: 0.1, s: 4, g: 1 }],
304
+ [{ w: "square", v: 0.2, a: 0.02, d: 1, s: 0.5, r: 0.08 }, { w: "sine", v: 1, d: 0.1, s: 4, g: 1 }],
305
+ /* 65-72 : Reed */
306
+ [{ w: "square", v: 0.2, a: 0.02, d: 2, s: 0.6 }, { w: "sine", v: 2, d: 1, g: 1 }],
307
+ [{ w: "square", v: 0.2, a: 0.02, d: 2, s: 0.6 }, { w: "sine", v: 2, d: 1, g: 1 }],
308
+ [{ w: "square", v: 0.2, a: 0.02, d: 1, s: 0.6 }, { w: "sine", v: 2, d: 1, g: 1 }],
309
+ [{ w: "square", v: 0.2, a: 0.02, d: 1, s: 0.6 }, { w: "sine", v: 2, d: 1, g: 1 }],
310
+ [{ w: "sine", v: 0.4, a: 0.02, d: 0.7, s: 0.5 }, { w: "square", v: 5, t: 2, d: 0.2, s: 0.5, g: 1 }],
311
+ [{ w: "sine", v: 0.3, a: 0.05, d: 0.2, s: 0.8 }, { w: "sawtooth", v: 6, f: 0.1, d: 0.1, s: 0.3, g: 1 }],
312
+ [{ w: "sine", v: 0.3, a: 0.03, d: 0.2, s: 0.4 }, { w: "square", v: 7, f: 0.2, d: 1, s: 0.1, g: 1 }],
313
+ [{ w: "square", v: 0.2, a: 0.05, d: 0.1, s: 0.8 }, { w: "square", v: 4, d: 0.1, s: 1.1, g: 1 }],
314
+ /* 73-80 : Pipe */
315
+ [{ w: "sine", a: 0.02, d: 2 }, { w: "sine", v: 6, t: 2, d: 0.04, g: 1 }],
316
+ [{ w: "sine", v: 0.7, a: 0.03, d: 0.4, s: 0.4 }, { w: "sine", v: 4, t: 2, f: 0.2, d: 0.4, g: 1 }],
317
+ [{ w: "sine", v: 0.7, a: 0.02, d: 0.4, s: 0.6 }, { w: "sine", v: 3, t: 2, d: 0, s: 1, g: 1 }],
318
+ [{ w: "sine", v: 0.4, a: 0.06, d: 0.3, s: 0.3 }, { w: "sine", v: 7, t: 2, d: 0.2, s: 0.2, g: 1 }],
319
+ [{ w: "sine", a: 0.02, d: 0.3, s: 0.3 }, { w: "sawtooth", v: 3, t: 2, d: 0.3, g: 1 }],
320
+ [{ w: "sine", v: 0.4, a: 0.02, d: 2, s: 0.1 }, { w: "sawtooth", v: 8, t: 2, f: 1, d: 0.5, g: 1 }],
321
+ [{ w: "sine", v: 0.7, a: 0.03, d: 0.5, s: 0.3 }, { w: "sine", v: 3e-3, t: 0, f: 4, d: 0.1, s: 2e-3, g: 1 }],
322
+ [{ w: "sine", v: 0.7, a: 0.02, d: 2 }, { w: "sine", v: 1, t: 2, f: 1, d: 0.02, g: 1 }],
323
+ /* 81-88 : SynthLead */
324
+ [{ w: "square", v: 0.3, d: 1, s: 0.5 }, { w: "square", v: 1, f: 0.2, d: 1, s: 0.5, g: 1 }],
325
+ [{ w: "sawtooth", v: 0.3, d: 2, s: 0.5 }, { w: "square", v: 2, f: 0.1, s: 0.5, g: 1 }],
326
+ [{ w: "triangle", v: 0.5, a: 0.05, d: 2, s: 0.6 }, { w: "sine", v: 4, t: 2, g: 1 }],
327
+ [{ w: "triangle", v: 0.3, a: 0.01, d: 2, s: 0.3 }, { w: "sine", v: 22, t: 2, f: 1, d: 0.03, s: 0.2, g: 1 }],
328
+ [{ w: "sawtooth", v: 0.3, d: 1, s: 0.5 }, { w: "sine", v: 11, t: 11, a: 0.2, d: 0.05, s: 0.3, g: 1 }],
329
+ [{ w: "sine", v: 0.3, a: 0.06, d: 1, s: 0.5 }, { w: "sine", v: 7, f: 1, d: 1, s: 0.2, g: 1 }],
330
+ [{ w: "sawtooth", v: 0.3, a: 0.03, d: 0.7, s: 0.3, r: 0.2 }, { w: "sawtooth", v: 0.3, t: 0.75, d: 0.7, a: 0.1, s: 0.3, r: 0.2 }],
331
+ [{ w: "triangle", v: 0.3, a: 0.01, d: 0.7, s: 0.5 }, { w: "square", v: 5, t: 0.5, d: 0.7, s: 0.5, g: 1 }],
332
+ /* 89-96 : SynthPad */
333
+ [{ w: "triangle", v: 0.3, a: 0.02, d: 0.3, s: 0.3, r: 0.3 }, { w: "square", v: 3, t: 4, f: 1, a: 0.02, d: 0.1, s: 1, g: 1 }, { w: "triangle", v: 0.08, t: 0.5, a: 0.1, h: 0, d: 0.1, s: 0.5, r: 0.1, b: 0, c: 0 }],
334
+ [{ w: "sine", v: 0.3, a: 0.05, d: 1, s: 0.7, r: 0.3 }, { w: "sine", v: 2, f: 1, d: 0.3, s: 1, g: 1 }],
335
+ [{ w: "square", v: 0.3, a: 0.03, d: 0.5, s: 0.3, r: 0.1 }, { w: "square", v: 4, f: 1, a: 0.03, d: 0.1, g: 1 }],
336
+ [{ w: "triangle", v: 0.3, a: 0.08, d: 1, s: 0.3, r: 0.1 }, { w: "square", v: 2, f: 1, d: 0.3, s: 0.3, g: 1, t: 4, a: 0.08 }],
337
+ [{ w: "sine", v: 0.3, a: 0.05, d: 1, s: 0.3, r: 0.1 }, { w: "sine", v: 0.1, t: 2.001, f: 1, d: 1, s: 50, g: 1 }],
338
+ [{ w: "triangle", v: 0.3, a: 0.03, d: 0.7, s: 0.3, r: 0.2 }, { w: "sine", v: 12, t: 7, f: 1, d: 0.5, s: 1.7, g: 1 }],
339
+ [{ w: "sine", v: 0.3, a: 0.05, d: 1, s: 0.3, r: 0.1 }, { w: "sawtooth", v: 22, t: 6, d: 0.06, s: 0.3, g: 1 }],
340
+ [{ w: "triangle", v: 0.3, a: 0.05, d: 11, r: 0.3 }, { w: "triangle", v: 1, d: 1, s: 8, g: 1 }],
341
+ /* 97-104 : FX */
342
+ [{ w: "sawtooth", v: 0.3, d: 4, s: 0.8, r: 0.1 }, { w: "square", v: 1, t: 2, f: 8, a: 1, d: 1, s: 1, r: 0.1, g: 1 }],
343
+ [{ w: "triangle", v: 0.3, d: 1, s: 0.5, t: 0.8, a: 0.2, p: 1.25, q: 0.2 }, { w: "sawtooth", v: 0.2, a: 0.2, d: 0.3, s: 1, t: 1.2, p: 1.25, q: 0.2 }],
344
+ [{ w: "sine", v: 0.3, d: 1, s: 0.3 }, { w: "square", v: 22, t: 11, d: 0.5, s: 0.1, g: 1 }],
345
+ [{ w: "sawtooth", v: 0.3, a: 0.04, d: 1, s: 0.8, r: 0.1 }, { w: "square", v: 1, t: 0.5, d: 1, s: 2, g: 1 }],
346
+ [{ w: "triangle", v: 0.3, d: 1, s: 0.3 }, { w: "sine", v: 22, t: 6, d: 0.6, s: 0.05, g: 1 }],
347
+ [{ w: "sine", v: 0.6, a: 0.1, d: 0.05, s: 0.4 }, { w: "sine", v: 5, t: 5, f: 1, d: 0.05, s: 0.3, g: 1 }],
348
+ [{ w: "sine", a: 0.1, d: 0.05, s: 0.4, v: 0.8 }, { w: "sine", v: 5, t: 5, f: 1, d: 0.05, s: 0.3, g: 1 }],
349
+ [{ w: "square", v: 0.3, a: 0.1, d: 0.1, s: 0.4 }, { w: "square", v: 1, f: 1, d: 0.3, s: 0.1, g: 1 }],
350
+ /* 105-112 : Ethnic */
351
+ [{ w: "sawtooth", v: 0.3, d: 0.5, r: 0.5 }, { w: "sawtooth", v: 11, t: 5, d: 0.05, g: 1 }],
352
+ [{ w: "square", v: 0.3, d: 0.2, r: 0.2 }, { w: "square", v: 7, t: 3, d: 0.05, g: 1 }],
353
+ [{ w: "triangle", d: 0.2, r: 0.2 }, { w: "square", v: 9, t: 3, d: 0.1, r: 0.1, g: 1 }],
354
+ [{ w: "triangle", d: 0.3, r: 0.3 }, { w: "square", v: 6, t: 3, d: 1, r: 1, g: 1 }],
355
+ [{ w: "triangle", v: 0.4, d: 0.2, r: 0.2 }, { w: "square", v: 22, t: 12, d: 0.1, r: 0.1, g: 1 }],
356
+ [{ w: "sine", v: 0.25, a: 0.02, d: 0.05, s: 0.8 }, { w: "square", v: 1, t: 2, d: 0.03, s: 11, g: 1 }],
357
+ [{ w: "sine", v: 0.3, a: 0.05, d: 11 }, { w: "square", v: 7, t: 3, f: 1, s: 0.7, g: 1 }],
358
+ [{ w: "square", v: 0.3, a: 0.05, d: 0.1, s: 0.8 }, { w: "square", v: 4, d: 0.1, s: 1.1, g: 1 }],
359
+ /* 113-120 : Percussive */
360
+ [{ w: "sine", v: 0.4, d: 0.3, r: 0.3 }, { w: "sine", v: 7, t: 9, d: 0.1, r: 0.1, g: 1 }],
361
+ [{ w: "sine", v: 0.7, d: 0.1, r: 0.1 }, { w: "sine", v: 22, t: 7, d: 0.05, g: 1 }],
362
+ [{ w: "sine", v: 0.6, d: 0.15, r: 0.15 }, { w: "square", v: 11, t: 3.2, d: 0.1, r: 0.1, g: 1 }],
363
+ [{ w: "sine", v: 0.8, d: 0.07, r: 0.07 }, { w: "square", v: 11, t: 7, r: 0.01, g: 1 }],
364
+ [{ w: "triangle", v: 0.7, t: 0.5, d: 0.2, r: 0.2, p: 0.95 }, { w: "n0", v: 9, g: 1, d: 0.2, r: 0.2 }],
365
+ [{ w: "sine", v: 0.7, d: 0.1, r: 0.1, p: 0.9 }, { w: "square", v: 14, t: 2, d: 5e-3, r: 5e-3, g: 1 }],
366
+ [{ w: "square", d: 0.15, r: 0.15, p: 0.5 }, { w: "square", v: 4, t: 5, d: 1e-3, r: 1e-3, g: 1 }],
367
+ [{ w: "n1", v: 0.3, a: 1, s: 1, d: 0.15, r: 0, t: 0.5 }],
368
+ /* 121-128 : SE */
369
+ [{ w: "sine", t: 12.5, d: 0, r: 0, p: 0.5, v: 0.3, h: 0.2, q: 0.5 }, { g: 1, w: "sine", v: 1, t: 2, d: 0, r: 0, s: 1 }, { g: 1, w: "n0", v: 0.2, t: 2, a: 0.6, h: 0, d: 0.1, r: 0.1, b: 0, c: 0 }],
370
+ [{ w: "n0", v: 0.2, a: 0.05, h: 0.02, d: 0.02, r: 0.02 }],
371
+ [{ w: "n0", v: 0.4, a: 1, d: 1, t: 0.25 }],
372
+ [{ w: "sine", v: 0.3, a: 0.1, d: 1, s: 0.5 }, { w: "sine", v: 4, t: 0, f: 1.5, d: 1, s: 1, r: 0.1, g: 1 }, { g: 1, w: "sine", v: 4, t: 0, f: 2, a: 0.6, h: 0, d: 0.1, s: 1, r: 0.1, b: 0, c: 0 }],
373
+ [{ w: "square", v: 0.3, t: 0.25, d: 11, s: 1 }, { w: "square", v: 12, t: 0, f: 8, d: 1, s: 1, r: 11, g: 1 }],
374
+ [{ w: "n0", v: 0.4, t: 0.5, a: 1, d: 11, s: 1, r: 0.5 }, { w: "square", v: 1, t: 0, f: 14, d: 1, s: 1, r: 11, g: 1 }],
375
+ [{ w: "sine", t: 0, f: 1221, a: 0.2, d: 1, r: 0.25, s: 1 }, { g: 1, w: "n0", v: 3, t: 0.5, d: 1, s: 1, r: 1 }],
376
+ [{ w: "sine", d: 0.4, r: 0.4, p: 0.1, t: 2.5, v: 1 }, { w: "n0", v: 12, t: 2, d: 1, r: 1, g: 1 }]
377
+ ],
378
+ program0: [
379
+ // 1-8 : Piano
380
+ [{ w: "triangle", v: 0.5, d: 0.7 }],
381
+ [{ w: "triangle", v: 0.5, d: 0.7 }],
382
+ [{ w: "triangle", v: 0.5, d: 0.7 }],
383
+ [{ w: "triangle", v: 0.5, d: 0.7 }],
384
+ [{ w: "triangle", v: 0.5, d: 0.7 }],
385
+ [{ w: "triangle", v: 0.5, d: 0.7 }],
386
+ [{ w: "sawtooth", v: 0.3, d: 0.7 }],
387
+ [{ w: "sawtooth", v: 0.3, d: 0.7 }],
388
+ /* 9-16 : Chromatic Perc*/
389
+ [{ w: "sine", v: 0.5, d: 0.3, r: 0.3 }],
390
+ [{ w: "triangle", v: 0.5, d: 0.3, r: 0.3 }],
391
+ [{ w: "square", v: 0.2, d: 0.3, r: 0.3 }],
392
+ [{ w: "square", v: 0.2, d: 0.3, r: 0.3 }],
393
+ [{ w: "sine", v: 0.5, d: 0.1, r: 0.1 }],
394
+ [{ w: "sine", v: 0.5, d: 0.1, r: 0.1 }],
395
+ [{ w: "square", v: 0.2, d: 1, r: 1 }],
396
+ [{ w: "sawtooth", v: 0.3, d: 0.7, r: 0.7 }],
397
+ /* 17-24 : Organ */
398
+ [{ w: "sine", v: 0.5, a: 0.01, s: 1 }],
399
+ [{ w: "sine", v: 0.7, d: 0.02, s: 0.7 }],
400
+ [{ w: "square", v: 0.2, s: 1 }],
401
+ [{ w: "triangle", v: 0.5, a: 0.01, s: 1 }],
402
+ [{ w: "square", v: 0.2, a: 0.02, s: 1 }],
403
+ [{ w: "square", v: 0.2, a: 0.02, s: 1 }],
404
+ [{ w: "square", v: 0.2, a: 0.02, s: 1 }],
405
+ [{ w: "square", v: 0.2, a: 0.05, s: 1 }],
406
+ /* 25-32 : Guitar */
407
+ [{ w: "triangle", v: 0.5, d: 0.5 }],
408
+ [{ w: "square", v: 0.2, d: 0.6 }],
409
+ [{ w: "square", v: 0.2, d: 0.6 }],
410
+ [{ w: "triangle", v: 0.8, d: 0.6 }],
411
+ [{ w: "triangle", v: 0.4, d: 0.05 }],
412
+ [{ w: "square", v: 0.2, d: 1 }],
413
+ [{ w: "square", v: 0.2, d: 1 }],
414
+ [{ w: "sine", v: 0.4, d: 0.6 }],
415
+ /* 33-40 : Bass */
416
+ [{ w: "triangle", v: 0.7, d: 0.4 }],
417
+ [{ w: "triangle", v: 0.7, d: 0.7 }],
418
+ [{ w: "triangle", v: 0.7, d: 0.7 }],
419
+ [{ w: "triangle", v: 0.7, d: 0.7 }],
420
+ [{ w: "square", v: 0.3, d: 0.2 }],
421
+ [{ w: "square", v: 0.3, d: 0.2 }],
422
+ [{ w: "square", v: 0.3, d: 0.1, s: 0.2 }],
423
+ [{ w: "sawtooth", v: 0.4, d: 0.1, s: 0.2 }],
424
+ /* 41-48 : Strings */
425
+ [{ w: "sawtooth", v: 0.2, a: 0.02, s: 1 }],
426
+ [{ w: "sawtooth", v: 0.2, a: 0.02, s: 1 }],
427
+ [{ w: "sawtooth", v: 0.2, a: 0.02, s: 1 }],
428
+ [{ w: "sawtooth", v: 0.2, a: 0.02, s: 1 }],
429
+ [{ w: "sawtooth", v: 0.2, a: 0.02, s: 1 }],
430
+ [{ w: "sawtooth", v: 0.3, d: 0.1 }],
431
+ [{ w: "sawtooth", v: 0.3, d: 0.5, r: 0.5 }],
432
+ [{ w: "triangle", v: 0.6, d: 0.1, r: 0.1, h: 0.03, p: 0.8 }],
433
+ /* 49-56 : Ensamble */
434
+ [{ w: "sawtooth", v: 0.2, a: 0.02, s: 1 }],
435
+ [{ w: "sawtooth", v: 0.2, a: 0.02, s: 1 }],
436
+ [{ w: "sawtooth", v: 0.2, a: 0.02, s: 1 }],
437
+ [{ w: "sawtooth", v: 0.2, a: 0.02, s: 1 }],
438
+ [{ w: "triangle", v: 0.3, a: 0.03, s: 1 }],
439
+ [{ w: "sine", v: 0.3, a: 0.03, s: 1 }],
440
+ [{ w: "triangle", v: 0.3, a: 0.05, s: 1 }],
441
+ [{ w: "sawtooth", v: 0.5, a: 0.01, d: 0.1 }],
442
+ /* 57-64 : Brass */
443
+ [{ w: "square", v: 0.3, a: 0.05, d: 0.2, s: 0.6 }],
444
+ [{ w: "square", v: 0.3, a: 0.05, d: 0.2, s: 0.6 }],
445
+ [{ w: "square", v: 0.3, a: 0.05, d: 0.2, s: 0.6 }],
446
+ [{ w: "square", v: 0.2, a: 0.05, d: 0.01, s: 1 }],
447
+ [{ w: "square", v: 0.3, a: 0.05, s: 1 }],
448
+ [{ w: "square", v: 0.3, s: 0.7 }],
449
+ [{ w: "square", v: 0.3, s: 0.7 }],
450
+ [{ w: "square", v: 0.3, s: 0.7 }],
451
+ /* 65-72 : Reed */
452
+ [{ w: "square", v: 0.3, a: 0.02, d: 2 }],
453
+ [{ w: "square", v: 0.3, a: 0.02, d: 2 }],
454
+ [{ w: "square", v: 0.3, a: 0.03, d: 2 }],
455
+ [{ w: "square", v: 0.3, a: 0.04, d: 2 }],
456
+ [{ w: "square", v: 0.3, a: 0.02, d: 2 }],
457
+ [{ w: "square", v: 0.3, a: 0.05, d: 2 }],
458
+ [{ w: "square", v: 0.3, a: 0.03, d: 2 }],
459
+ [{ w: "square", v: 0.3, a: 0.03, d: 2 }],
460
+ /* 73-80 : Pipe */
461
+ [{ w: "sine", v: 0.7, a: 0.02, d: 2 }],
462
+ [{ w: "sine", v: 0.7, a: 0.02, d: 2 }],
463
+ [{ w: "sine", v: 0.7, a: 0.02, d: 2 }],
464
+ [{ w: "sine", v: 0.7, a: 0.02, d: 2 }],
465
+ [{ w: "sine", v: 0.7, a: 0.02, d: 2 }],
466
+ [{ w: "sine", v: 0.7, a: 0.02, d: 2 }],
467
+ [{ w: "sine", v: 0.7, a: 0.02, d: 2 }],
468
+ [{ w: "sine", v: 0.7, a: 0.02, d: 2 }],
469
+ /* 81-88 : SynthLead */
470
+ [{ w: "square", v: 0.3, s: 0.7 }],
471
+ [{ w: "sawtooth", v: 0.4, s: 0.7 }],
472
+ [{ w: "triangle", v: 0.5, s: 0.7 }],
473
+ [{ w: "sawtooth", v: 0.4, s: 0.7 }],
474
+ [{ w: "sawtooth", v: 0.4, d: 12 }],
475
+ [{ w: "sine", v: 0.4, a: 0.06, d: 12 }],
476
+ [{ w: "sawtooth", v: 0.4, d: 12 }],
477
+ [{ w: "sawtooth", v: 0.4, d: 12 }],
478
+ /* 89-96 : SynthPad */
479
+ [{ w: "sawtooth", v: 0.3, d: 12 }],
480
+ [{ w: "triangle", v: 0.5, d: 12 }],
481
+ [{ w: "square", v: 0.3, d: 12 }],
482
+ [{ w: "triangle", v: 0.5, a: 0.08, d: 11 }],
483
+ [{ w: "sawtooth", v: 0.5, a: 0.05, d: 11 }],
484
+ [{ w: "sawtooth", v: 0.5, d: 11 }],
485
+ [{ w: "triangle", v: 0.5, d: 11 }],
486
+ [{ w: "triangle", v: 0.5, d: 11 }],
487
+ /* 97-104 : FX */
488
+ [{ w: "triangle", v: 0.5, d: 11 }],
489
+ [{ w: "triangle", v: 0.5, d: 11 }],
490
+ [{ w: "square", v: 0.3, d: 11 }],
491
+ [{ w: "sawtooth", v: 0.5, a: 0.04, d: 11 }],
492
+ [{ w: "sawtooth", v: 0.5, d: 11 }],
493
+ [{ w: "triangle", v: 0.5, a: 0.8, d: 11 }],
494
+ [{ w: "triangle", v: 0.5, d: 11 }],
495
+ [{ w: "square", v: 0.3, d: 11 }],
496
+ /* 105-112 : Ethnic */
497
+ [{ w: "sawtooth", v: 0.3, d: 1, r: 1 }],
498
+ [{ w: "sawtooth", v: 0.5, d: 0.3 }],
499
+ [{ w: "sawtooth", v: 0.5, d: 0.3, r: 0.3 }],
500
+ [{ w: "sawtooth", v: 0.5, d: 0.3, r: 0.3 }],
501
+ [{ w: "square", v: 0.3, d: 0.2, r: 0.2 }],
502
+ [{ w: "square", v: 0.3, a: 0.02, d: 2 }],
503
+ [{ w: "sawtooth", v: 0.2, a: 0.02, d: 0.7 }],
504
+ [{ w: "triangle", v: 0.5, d: 1 }],
505
+ /* 113-120 : Percussive */
506
+ [{ w: "sawtooth", v: 0.3, d: 0.3, r: 0.3 }],
507
+ [{ w: "sine", v: 0.8, d: 0.1, r: 0.1 }],
508
+ [{ w: "square", v: 0.2, d: 0.1, r: 0.1, p: 1.05 }],
509
+ [{ w: "sine", v: 0.8, d: 0.05, r: 0.05 }],
510
+ [{ w: "triangle", v: 0.5, d: 0.1, r: 0.1, p: 0.96 }],
511
+ [{ w: "triangle", v: 0.5, d: 0.1, r: 0.1, p: 0.97 }],
512
+ [{ w: "square", v: 0.3, d: 0.1, r: 0.1 }],
513
+ [{ w: "n1", v: 0.3, a: 1, s: 1, d: 0.15, r: 0, t: 0.5 }],
514
+ /* 121-128 : SE */
515
+ [{ w: "triangle", v: 0.5, d: 0.03, t: 0, f: 1332, r: 1e-3, p: 1.1 }],
516
+ [{ w: "n0", v: 0.2, t: 0.1, d: 0.02, a: 0.05, h: 0.02, r: 0.02 }],
517
+ [{ w: "n0", v: 0.4, a: 1, d: 1, t: 0.25 }],
518
+ [{ w: "sine", v: 0.3, a: 0.8, d: 1, t: 0, f: 1832 }],
519
+ [{ w: "triangle", d: 0.5, t: 0, f: 444, s: 1 }],
520
+ [{ w: "n0", v: 0.4, d: 1, t: 0, f: 22, s: 1 }],
521
+ [{ w: "n0", v: 0.5, a: 0.2, d: 11, t: 0, f: 44 }],
522
+ [{ w: "n0", v: 0.5, t: 0.25, d: 0.4, r: 0.4 }]
523
+ ],
524
+ drummap1: [
525
+ /*35*/
526
+ [{ w: "triangle", t: 0, f: 70, v: 1, d: 0.05, h: 0.03, p: 0.9, q: 0.1 }, { w: "n0", g: 1, t: 6, v: 17, r: 0.01, h: 0, p: 0 }],
527
+ [{ w: "triangle", t: 0, f: 88, v: 1, d: 0.05, h: 0.03, p: 0.5, q: 0.1 }, { w: "n0", g: 1, t: 5, v: 42, r: 0.01, h: 0, p: 0 }],
528
+ [{ w: "n0", f: 222, p: 0, t: 0, r: 0.01, h: 0 }],
529
+ [{ w: "triangle", v: 0.3, f: 180, d: 0.05, t: 0, h: 0.03, p: 0.9, q: 0.1 }, { w: "n0", v: 0.6, t: 0, f: 70, h: 0.02, r: 0.01, p: 0 }, { g: 1, w: "square", v: 2, t: 0, f: 360, r: 0.01, b: 0, c: 0 }],
530
+ [{ w: "square", f: 1150, v: 0.34, t: 0, r: 0.03, h: 0.025, d: 0.03 }, { g: 1, w: "n0", t: 0, f: 13, h: 0.025, d: 0.1, s: 1, r: 0.1, v: 1 }],
531
+ /*40*/
532
+ [{ w: "triangle", f: 200, v: 1, d: 0.06, t: 0, r: 0.06 }, { w: "n0", g: 1, t: 0, f: 400, v: 12, r: 0.02, d: 0.02 }],
533
+ [{ w: "triangle", f: 100, v: 0.9, d: 0.12, h: 0.02, p: 0.5, t: 0, r: 0.12 }, { g: 1, w: "n0", v: 5, t: 0.4, h: 0.015, d: 5e-3, r: 5e-3 }],
534
+ [{ w: "n1", f: 390, v: 0.25, r: 0.01, t: 0 }],
535
+ [{ w: "triangle", f: 120, v: 0.9, d: 0.12, h: 0.02, p: 0.5, t: 0, r: 0.12 }, { g: 1, w: "n0", v: 5, t: 0.5, h: 0.015, d: 5e-3, r: 5e-3 }],
536
+ [{ w: "n1", v: 0.25, f: 390, r: 0.03, t: 0, h: 5e-3, d: 0.03 }],
537
+ /*45*/
538
+ [{ w: "triangle", f: 140, v: 0.9, d: 0.12, h: 0.02, p: 0.5, t: 0, r: 0.12 }, { g: 1, w: "n0", v: 5, t: 0.3, h: 0.015, d: 5e-3, r: 5e-3 }],
539
+ [{ w: "n1", v: 0.25, f: 390, t: 0, d: 0.2, r: 0.2 }, { w: "n0", v: 0.3, t: 0, c: 0, f: 440, h: 5e-3, d: 0.05 }],
540
+ [{ w: "triangle", f: 155, v: 0.9, d: 0.12, h: 0.02, p: 0.5, t: 0, r: 0.12 }, { g: 1, w: "n0", v: 5, t: 0.3, h: 0.015, d: 5e-3, r: 5e-3 }],
541
+ [{ w: "triangle", f: 180, v: 0.9, d: 0.12, h: 0.02, p: 0.5, t: 0, r: 0.12 }, { g: 1, w: "n0", v: 5, t: 0.3, h: 0.015, d: 5e-3, r: 5e-3 }],
542
+ [{ w: "n1", v: 0.3, f: 1200, d: 0.2, r: 0.2, h: 0.05, t: 0 }, { w: "n1", t: 0, v: 1, d: 0.1, r: 0.1, p: 1.2, f: 440 }],
543
+ /*50*/
544
+ [{ w: "triangle", f: 220, v: 0.9, d: 0.12, h: 0.02, p: 0.5, t: 0, r: 0.12 }, { g: 1, w: "n0", v: 5, t: 0.3, h: 0.015, d: 5e-3, r: 5e-3 }],
545
+ [{ w: "n1", f: 500, v: 0.15, d: 0.4, r: 0.4, h: 0, t: 0 }, { w: "n0", v: 0.1, t: 0, r: 0.01, f: 440 }],
546
+ [{ w: "n1", v: 0.3, f: 800, d: 0.2, r: 0.2, h: 0.05, t: 0 }, { w: "square", t: 0, v: 1, d: 0.1, r: 0.1, p: 0.1, f: 220, g: 1 }],
547
+ [{ w: "sine", f: 1651, v: 0.15, d: 0.2, r: 0.2, h: 0, t: 0 }, { w: "sawtooth", g: 1, t: 1.21, v: 7.2, d: 0.1, r: 11, h: 1 }, { g: 1, w: "n0", v: 3.1, t: 0.152, d: 2e-3, r: 2e-3 }],
548
+ null,
549
+ /*55*/
550
+ [{ w: "n1", v: 0.3, f: 1200, d: 0.2, r: 0.2, h: 0.05, t: 0 }, { w: "n1", t: 0, v: 1, d: 0.1, r: 0.1, p: 1.2, f: 440 }],
551
+ null,
552
+ [{ w: "n1", v: 0.3, f: 555, d: 0.25, r: 0.25, h: 0.05, t: 0 }, { w: "n1", t: 0, v: 1, d: 0.1, r: 0.1, f: 440, a: 5e-3, h: 0.02 }],
553
+ [{ w: "sawtooth", f: 776, v: 0.2, d: 0.3, t: 0, r: 0.3 }, { g: 1, w: "n0", v: 2, t: 0, f: 776, a: 5e-3, h: 0.02, d: 0.1, s: 1, r: 0.1, c: 0 }, { g: 11, w: "sine", v: 0.1, t: 0, f: 22, d: 0.3, r: 0.3, b: 0, c: 0 }],
554
+ [{ w: "n1", f: 440, v: 0.15, d: 0.4, r: 0.4, h: 0, t: 0 }, { w: "n0", v: 0.4, t: 0, r: 0.01, f: 440 }],
555
+ /*60*/
556
+ null,
557
+ null,
558
+ null,
559
+ null,
560
+ null,
561
+ /*65*/
562
+ null,
563
+ null,
564
+ null,
565
+ null,
566
+ null,
567
+ /*70*/
568
+ null,
569
+ null,
570
+ null,
571
+ null,
572
+ null,
573
+ /*75*/
574
+ null,
575
+ null,
576
+ null,
577
+ null,
578
+ null,
579
+ /*80*/
580
+ [{ w: "sine", f: 1720, v: 0.3, d: 0.02, t: 0, r: 0.02 }, { w: "square", g: 1, t: 0, f: 2876, v: 6, d: 0.2, s: 1, r: 0.2 }],
581
+ [{ w: "sine", f: 1720, v: 0.3, d: 0.25, t: 0, r: 0.25 }, { w: "square", g: 1, t: 0, f: 2876, v: 6, d: 0.2, s: 1, r: 0.2 }]
582
+ ],
583
+ drummap0: [
584
+ /*35*/
585
+ [{ w: "triangle", t: 0, f: 110, v: 1, d: 0.05, h: 0.02, p: 0.1 }],
586
+ [{ w: "triangle", t: 0, f: 150, v: 0.8, d: 0.1, p: 0.1, h: 0.02, r: 0.01 }],
587
+ [{ w: "n0", f: 392, v: 0.5, d: 0.01, p: 0, t: 0, r: 0.05 }],
588
+ [{ w: "n0", f: 33, d: 0.05, t: 0 }],
589
+ [{ w: "n0", f: 100, v: 0.7, d: 0.03, t: 0, r: 0.03, h: 0.02 }],
590
+ /*40*/
591
+ [{ w: "n0", f: 44, v: 0.7, d: 0.02, p: 0.1, t: 0, h: 0.02 }],
592
+ [{ w: "triangle", f: 240, v: 0.9, d: 0.1, h: 0.02, p: 0.1, t: 0 }],
593
+ [{ w: "n0", f: 440, v: 0.2, r: 0.01, t: 0 }],
594
+ [{ w: "triangle", f: 270, v: 0.9, d: 0.1, h: 0.02, p: 0.1, t: 0 }],
595
+ [{ w: "n0", f: 440, v: 0.2, d: 0.04, r: 0.04, t: 0 }],
596
+ /*45*/
597
+ [{ w: "triangle", f: 300, v: 0.9, d: 0.1, h: 0.02, p: 0.1, t: 0 }],
598
+ [{ w: "n0", f: 440, v: 0.2, d: 0.1, r: 0.1, h: 0.02, t: 0 }],
599
+ [{ w: "triangle", f: 320, v: 0.9, d: 0.1, h: 0.02, p: 0.1, t: 0 }],
600
+ [{ w: "triangle", f: 360, v: 0.9, d: 0.1, h: 0.02, p: 0.1, t: 0 }],
601
+ [{ w: "n0", f: 150, v: 0.2, d: 0.1, r: 0.1, h: 0.05, t: 0, p: 0.1 }],
602
+ /*50*/
603
+ [{ w: "triangle", f: 400, v: 0.9, d: 0.1, h: 0.02, p: 0.1, t: 0 }],
604
+ [{ w: "n0", f: 150, v: 0.2, d: 0.1, r: 0.01, h: 0.05, t: 0, p: 0.1 }],
605
+ [{ w: "n0", f: 150, v: 0.2, d: 0.1, r: 0.01, h: 0.05, t: 0, p: 0.1 }],
606
+ [{ w: "n0", f: 440, v: 0.3, d: 0.1, p: 0.9, t: 0, r: 0.1 }],
607
+ [{ w: "n0", f: 200, v: 0.2, d: 0.05, p: 0.9, t: 0 }],
608
+ /*55*/
609
+ [{ w: "n0", f: 440, v: 0.3, d: 0.12, p: 0.9, t: 0 }],
610
+ [{ w: "sine", f: 800, v: 0.4, d: 0.06, t: 0 }],
611
+ [{ w: "n0", f: 150, v: 0.2, d: 0.1, r: 0.01, h: 0.05, t: 0, p: 0.1 }],
612
+ [{ w: "n0", f: 33, v: 0.3, d: 0.2, p: 0.9, t: 0 }],
613
+ [{ w: "n0", f: 300, v: 0.3, d: 0.14, p: 0.9, t: 0 }],
614
+ /*60*/
615
+ [{ w: "sine", f: 200, d: 0.06, t: 0 }],
616
+ [{ w: "sine", f: 150, d: 0.06, t: 0 }],
617
+ [{ w: "sine", f: 300, t: 0 }],
618
+ [{ w: "sine", f: 300, d: 0.06, t: 0 }],
619
+ [{ w: "sine", f: 250, d: 0.06, t: 0 }],
620
+ /*65*/
621
+ [{ w: "square", f: 300, v: 0.3, d: 0.06, p: 0.8, t: 0 }],
622
+ [{ w: "square", f: 260, v: 0.3, d: 0.06, p: 0.8, t: 0 }],
623
+ [{ w: "sine", f: 850, v: 0.5, d: 0.07, t: 0 }],
624
+ [{ w: "sine", f: 790, v: 0.5, d: 0.07, t: 0 }],
625
+ [{ w: "n0", f: 440, v: 0.3, a: 0.05, t: 0 }],
626
+ /*70*/
627
+ [{ w: "n0", f: 440, v: 0.3, a: 0.05, t: 0 }],
628
+ [{ w: "triangle", f: 1800, v: 0.4, p: 0.9, t: 0, h: 0.03 }],
629
+ [{ w: "triangle", f: 1800, v: 0.3, p: 0.9, t: 0, h: 0.13 }],
630
+ [{ w: "n0", f: 330, v: 0.3, a: 0.02, t: 0, r: 0.01 }],
631
+ [{ w: "n0", f: 330, v: 0.3, a: 0.02, t: 0, h: 0.04, r: 0.01 }],
632
+ /*75*/
633
+ [{ w: "n0", f: 440, v: 0.3, t: 0 }],
634
+ [{ w: "sine", f: 800, t: 0 }],
635
+ [{ w: "sine", f: 700, t: 0 }],
636
+ [{ w: "n0", f: 330, v: 0.3, t: 0 }],
637
+ [{ w: "n0", f: 330, v: 0.3, t: 0, h: 0.1, r: 0.01, p: 0.7 }],
638
+ /*80*/
639
+ [{ w: "sine", t: 0, f: 1200, v: 0.3, r: 0.01 }],
640
+ [{ w: "sine", t: 0, f: 1200, v: 0.3, d: 0.2, r: 0.2 }]
641
+ ],
642
+ /*@@gui*/
643
+ _guiInit: () => {
644
+ this.canvas && (this.ctx = this.canvas.getContext("2d"), this.ctx.fillStyle = "#000", this.ctx.fillRect(0, 0, 300, 32), this.canvas.addEventListener("dragover", this.dragOver.bind(this), !1), this.canvas.addEventListener("dragleave", this.dragLeave.bind(this), !1), this.canvas.addEventListener("drop", this.execDrop.bind(this), !1), this.canvas.addEventListener("click", this.click.bind(this), !1), this.canvas.addEventListener("mousedown", this.pointerdown.bind(this), !1), this.canvas.addEventListener("mousemove", this.pointermove.bind(this), !1), this.canvas.addEventListener("touchstart", this.pointerdown.bind(this), !1), this.canvas.addEventListener("touchend", this.pointerup.bind(this), !1), this.canvas.addEventListener("touchcancel", this.pointerup.bind(this), !1), this.canvas.addEventListener("touchmove", this.pointermove.bind(this), !1));
645
+ },
646
+ _guiUpdate: () => {
647
+ if (this.canvas) {
648
+ this.ctx.fillStyle = "#000", this.ctx.fillRect(0, 0, 300, 32);
649
+ var t = 8, e = 20;
650
+ if (this.song ? (t = 4, e = 24) : (this.ctx.fillStyle = "#fff", this.ctx.fillText("TinySynth", 8, 20)), this.graph) {
651
+ this.ctx.fillStyle = "#800", this.ctx.fillRect(80, t, 132, 4), this.ctx.fillRect(80, e, 132, 4), this.ctx.fillStyle = "#f00";
652
+ for (let s = this.notetab.length - 1; s >= 0; --s) {
653
+ const a = this.notetab[s];
654
+ (!a.f || this.rhythm[a.ch]) && (this.ctx.fillRect(80 + a.n, t, 4, 4), this.ctx.fillRect(80 + a.ch * 8, e, 6, 4));
655
+ }
656
+ }
657
+ this.perfmon && (this.ctx.fillStyle = "#fff", this.ctx.fillRect(180, 30, 28, -12), this.ctx.fillStyle = "#000", this.ctx.fillText(this.notetab.length, 185, 28)), this.ctx.fillStyle = "#fff", this.ctx.fillRect(250, 15, 32, 2), this.ctx.fillStyle = "#fff", this.ctx.strokeStyle = "#000", this.ctx.beginPath(), this.ctx.arc(250 + this.masterVol * 32, 16, 6, 0, 6.28, 0), this.ctx.moveTo(220, 12), this.ctx.lineTo(224, 12), this.ctx.lineTo(230, 6), this.ctx.lineTo(230, 26), this.ctx.lineTo(224, 20), this.ctx.lineTo(220, 20), this.ctx.fill(), this.ctx.stroke(), this.ctx.strokeStyle = "#fff", this.ctx.lineWidth = 2, this.ctx.beginPath(), this.ctx.arc(230, 16, 4, -1, 1, !1), this.ctx.stroke(), this.ctx.beginPath(), this.ctx.arc(230, 16, 8, -1, 1, !1), this.ctx.stroke(), this.masterVol == 0 && (this.ctx.strokeStyle = "#000", this.ctx.lineWidth = 4, this.ctx.beginPath(), this.ctx.moveTo(220, 7), this.ctx.lineTo(238, 25), this.ctx.stroke(), this.ctx.strokeStyle = "#fff", this.ctx.lineWidth = 2, this.ctx.stroke()), this.song && (this.ctx.fillStyle = "#fff", this.ctx.fillRect(4, 2, 28, 28), this.ctx.fillRect(80, 15, 128, 2), this.ctx.fillStyle = "#000", this.playing ? (this.ctx.fillRect(12, 10, 4, 12), this.ctx.fillRect(22, 10, 4, 12)) : (this.ctx.beginPath(), this.ctx.moveTo(12, 9), this.ctx.lineTo(25, 16), this.ctx.lineTo(12, 23), this.ctx.fill()), this.ctx.fillStyle = "#fff", this.ctx.fillText(this.toTime(this.playTick), 38, 14), this.ctx.fillText(this.toTime(this.maxTick), 38, 28), this.ctx.strokeStyle = "#000", this.ctx.beginPath(), this.ctx.arc(80 + this.playTick / this.maxTick * 128, 16, 6, 0, 6.28, 0), this.ctx.fill(), this.ctx.stroke()), this.waitdrop && (this.ctx.fillStyle = "rgba(0,0,0,0.7)", this.ctx.fillRect(0, 0, 300, 32), this.ctx.fillStyle = "#fff", this.ctx.fillText("Drop MIDI File Here", 100, 20));
658
+ }
659
+ },
660
+ toTime: (t) => {
661
+ t = t * 4 * 60 / this.song.timebase / this.song.tempo | 0;
662
+ const e = t / 60 | 0, s = t % 60;
663
+ return ("00" + e).substr(-2) + ":" + ("00" + s).substr(-2);
664
+ },
665
+ preventScroll: (t) => {
666
+ t.preventDefault();
667
+ },
668
+ pointerup: (t) => {
669
+ document.body.removeEventListener("touchstart", this.preventScroll, !1);
670
+ },
671
+ getPos: (t) => {
672
+ var e = t.target.getBoundingClientRect();
673
+ return e.right != e.left ? { x: (t.clientX - e.left) * 300 / (e.right - e.left), y: t.clientY - e.top } : { x: 0, y: 0 };
674
+ },
675
+ pointerdown: (t) => {
676
+ let e = t;
677
+ if (t.touches && (e = t.touches[0]), this.downpos = this.getPos(e), t.touches || e.buttons & 1) {
678
+ if (this.song && this.downpos.x >= 80 && this.downpos.x <= 208) {
679
+ const s = (this.downpos.x - 80) / 128 * this.maxTick;
680
+ this.locateMIDI(s), document.body.addEventListener("touchstart", this.preventScroll, !1);
681
+ }
682
+ if (this.downpos.x >= 250 && this.downpos.x < 282) {
683
+ const s = (this.downpos.x - 250) / 32;
684
+ this.setMasterVol(s), document.body.addEventListener("touchstart", this.preventScroll, !1);
685
+ }
686
+ }
687
+ },
688
+ pointermove: (t) => {
689
+ let e = t;
690
+ if (t.touches && (e = t.touches[0]), t.touches || e.buttons & 1) {
691
+ const s = this.getPos(e);
692
+ if (this.song && s.x >= 70 && s.x <= 208) {
693
+ s.x < 80 && (s.x = 80);
694
+ const a = (s.x - 80) / 128 * this.maxTick;
695
+ this.locateMIDI(a);
696
+ }
697
+ if (s.x >= 250 && s.x < 282) {
698
+ const a = (s.x - 250) / 32;
699
+ this.setMasterVol(a);
700
+ }
701
+ }
702
+ },
703
+ click: (t) => {
704
+ const e = this.getPos(t);
705
+ e.x < 40 && this.song && (this.playing ? this.stopMIDI() : this.song && this.playMIDI()), e.x >= 215 && e.x < 243 && this.downpos.x >= 215 && this.downpos.x < 243 && (this.masterVol > 0 ? (this.lastMasterVol = this.masterVol, this.masterVol = 0) : this.masterVol = this.lastMasterVol);
706
+ },
707
+ dragLeave: (t) => {
708
+ this.waitdrop = 0;
709
+ },
710
+ dragOver: (t) => {
711
+ this.waitdrop = 1, t.stopPropagation(), t.preventDefault(), t.dataTransfer.dropEffect = "copy";
712
+ },
713
+ execDrop: (t) => {
714
+ this.waitdrop = 0;
715
+ const e = t.dataTransfer.files;
716
+ if (this.disabledrop == 0) {
717
+ var s = new FileReader();
718
+ s.onload = (function(a) {
719
+ this.loadMIDI(s.result);
720
+ }).bind(this), s.readAsArrayBuffer(e[0]);
721
+ }
722
+ t.stopPropagation(), t.preventDefault();
723
+ },
724
+ /*@@guiEND*/
725
+ ready: () => new Promise((t) => {
726
+ const e = setInterval(() => {
727
+ this.isReady && (clearInterval(e), console.log("Initialized"), t());
728
+ }, 100);
729
+ }),
730
+ init: () => {
731
+ this.pg = [], this.vol = [], this.ex = [], this.bend = [], this.rpnidx = [], this.brange = [], this.sustain = [], this.notetab = [], this.rhythm = [], this.masterTuningC = 0, this.masterTuningF = 0, this.tuningC = [], this.tuningF = [], this.maxTick = 0, this.playTick = 0, this.playing = 0, this.releaseRatio = 3.5;
732
+ for (let t = 0; t < 16; ++t)
733
+ this.pg[t] = 0, this.vol[t] = 300 * 100 / 16129, this.bend[t] = 0, this.brange[t] = 256, this.tuningC[t] = 0, this.tuningF[t] = 0, this.rhythm[t] = 0;
734
+ this.rhythm[9] = 1, this.preroll = 0.2, this.relcnt = 0, setInterval(
735
+ (function() {
736
+ if (++this.relcnt >= 3) {
737
+ this.relcnt = 0;
738
+ for (let e = this.notetab.length - 1; e >= 0; --e) {
739
+ var t = this.notetab[e];
740
+ this.actx.currentTime > t.e && (this._pruneNote(t), this.notetab.splice(e, 1));
741
+ }
742
+ }
743
+ if (this.playing && this.song.ev.length > 0) {
744
+ let e = this.song.ev[this.playIndex];
745
+ for (; this.actx.currentTime + this.preroll > this.playTime; )
746
+ if (e.m[0] == 65361 ? (this.song.tempo = e.m[1], this.tick2Time = 240 / this.song.tempo / this.song.timebase) : this.send(e.m, this.playTime), ++this.playIndex, this.playIndex >= this.song.ev.length)
747
+ if (this.loop)
748
+ e = this.song.ev[this.playIndex = 0], this.playTick = e.t;
749
+ else {
750
+ this.playTick = this.maxTick, this.playing = 0;
751
+ break;
752
+ }
753
+ else
754
+ e = this.song.ev[this.playIndex], this.playTime += (e.t - this.playTick) * this.tick2Time, this.playTick = e.t;
755
+ }
756
+ }).bind(this),
757
+ 60
758
+ ), console.log("internalcontext:" + this.internalcontext), this.internalcontext && (b.AudioContext = b.AudioContext || b.webkitAudioContext, this.setAudioContext(new AudioContext())), this.isReady = 1;
759
+ },
760
+ setMasterVol: (t) => {
761
+ t != null && (this.masterVol = t), this.out && (this.out.gain.value = this.masterVol);
762
+ },
763
+ setReverbLev: (t) => {
764
+ t != null && (this.reverbLev = t);
765
+ var e = parseFloat(this.reverbLev);
766
+ this.rev && !isNaN(e) && (this.rev.gain.value = e * 8);
767
+ },
768
+ setLoop: (t) => {
769
+ this.loop = t;
770
+ },
771
+ setVoices: (t) => {
772
+ this.voices = t;
773
+ },
774
+ getPlayStatus: () => ({ play: this.playing, maxTick: this.maxTick, curTick: this.playTick }),
775
+ locateMIDI: (t) => {
776
+ let e, s = this.playing;
777
+ for (this.stopMIDI(), e = 0; e < this.song.ev.length && t > this.song.ev[e].t; ++e) {
778
+ var a = this.song.ev[e], r = a.m[0] & 15;
779
+ switch (a.m[0] & 240) {
780
+ case 176:
781
+ switch (a.m[1]) {
782
+ case 1:
783
+ this.setModulation(r, a.m[2]);
784
+ break;
785
+ case 7:
786
+ this.setChVol(r, a.m[2]);
787
+ break;
788
+ case 10:
789
+ this.setPan(r, a.m[2]);
790
+ break;
791
+ case 11:
792
+ this.setExpression(r, a.m[2]);
793
+ break;
794
+ case 64:
795
+ this.setSustain(r, a.m[2]);
796
+ break;
797
+ }
798
+ break;
799
+ case 192:
800
+ this.pg[a.m[0] & 15] = a.m[1];
801
+ break;
802
+ }
803
+ a.m[0] == 65361 && (this.song.tempo = a.m[1]);
804
+ }
805
+ this.song.ev[e] ? (this.playIndex = e, this.playTick = this.song.ev[e].t) : (this.playIndex = 0, this.playTick = this.maxTick), s && this.playMIDI();
806
+ },
807
+ getTimbreName: (t, e) => t == 0 ? this.program[e].name : this.drummap[e - 35].name,
808
+ loadMIDIfromSrc: () => {
809
+ this.loadMIDIUrl(this.src);
810
+ },
811
+ loadMIDIUrl: (t) => {
812
+ if (t) {
813
+ var e = new XMLHttpRequest();
814
+ e.open("GET", t, !0), e.responseType = "arraybuffer", e.loadMIDI = this.loadMIDI.bind(this), e.onload = function(s) {
815
+ this.status == 200 && this.loadMIDI(this.response);
816
+ }, e.send();
817
+ }
818
+ },
819
+ reset: () => {
820
+ for (let t = 0; t < 16; ++t)
821
+ this.setProgram(t, 0), this.setBendRange(t, 256), this.setModulation(t, 0), this.setChVol(t, 100), this.setPan(t, 64), this.resetAllControllers(t), this.allSoundOff(t), this.rhythm[t] = 0, this.tuningC[t] = 0, this.tuningF[t] = 0;
822
+ this.masterTuningC = 0, this.masterTuningF = 0, this.rhythm[9] = 1;
823
+ },
824
+ stopMIDI: () => {
825
+ this.playing = 0;
826
+ for (var t = 0; t < 16; ++t)
827
+ this.allSoundOff(t);
828
+ },
829
+ playMIDI: () => {
830
+ if (!this.song)
831
+ return;
832
+ const t = this.actx.createOscillator();
833
+ t.connect(this.actx.destination), t.frequency.value = 0, t.start(0), t.stop(this.actx.currentTime + 1e-3), this.playTick >= this.maxTick && (this.playTick = 0, this.playIndex = 0), this.playTime = this.actx.currentTime + 0.1, this.tick2Time = 240 / this.song.tempo / this.song.timebase, this.playing = 1;
834
+ },
835
+ loadMIDI: (t) => {
836
+ function e(d, v) {
837
+ return (d[v] << 8) + d[v + 1];
838
+ }
839
+ function s(d, v) {
840
+ return (d[v] << 16) + (d[v + 1] << 8) + d[v + 2];
841
+ }
842
+ function a(d, v) {
843
+ return (d[v] << 24) + (d[v + 1] << 16) + (d[v + 2] << 8) + d[v + 3];
844
+ }
845
+ function r(d, v, g) {
846
+ return String.fromCharCode.apply(null, d.slice(v, v + g));
847
+ }
848
+ function o(d, v) {
849
+ var g, u;
850
+ for (g = 0, i = 1; (u = d[v]) & 128; )
851
+ g = (g << 7) + (u & 127), ++i, ++v;
852
+ return (g << 7) + u;
853
+ }
854
+ function w(d, v, g, u) {
855
+ var p = g[u];
856
+ switch (i = 1, !(p & 128) && (p = f, i = 0), f = p, p & 240) {
857
+ case 192:
858
+ case 208:
859
+ d.ev.push({ t: v, m: [p, g[u + i]] }), i += 1;
860
+ break;
861
+ case 240:
862
+ switch (p) {
863
+ case 240:
864
+ case 247:
865
+ var S = o(g, u + 1);
866
+ c = 1 + i;
867
+ var P = Array.from(g.slice(u + c, u + c + S));
868
+ P.unshift(240), d.ev.push({ t: v, m: P }), i += S + 1;
869
+ break;
870
+ case 255:
871
+ var S = o(g, u + 2);
872
+ switch (c = 2 + i, i = S + i + 2, g[u + 1]) {
873
+ case 2:
874
+ d.copyright += r(g, u + c, i - 3);
875
+ break;
876
+ case 1:
877
+ case 3:
878
+ case 4:
879
+ case 9:
880
+ d.text = r(g, u + c, i - c);
881
+ break;
882
+ case 47:
883
+ return 1;
884
+ case 81:
885
+ var L = Math.floor(6e7 / s(g, u + 3));
886
+ d.ev.push({ t: v, m: [65361, L] });
887
+ break;
888
+ }
889
+ break;
890
+ }
891
+ break;
892
+ default:
893
+ d.ev.push({ t: v, m: [p, g[u + i], g[u + i + 1]] }), i += 2;
894
+ }
895
+ return 0;
896
+ }
897
+ this.stopMIDI();
898
+ var n = new Uint8Array(t), i = 0, c = 0, f = 144, l = 0, x = n.slice(0, 4);
899
+ if (x.toString() == "77,84,104,100") {
900
+ var y = a(n, 4);
901
+ e(n, 8);
902
+ var h = e(n, 10);
903
+ this.maxTick = 0;
904
+ var C = e(n, 12) * 4;
905
+ l = y + 8, this.song = { copyright: "", text: "", tempo: 120, timebase: C, ev: [] };
906
+ for (let d = 0; d < h; ++d) {
907
+ if (x = n.slice(l, l + 4), y = a(n, l + 4), x.toString() == "77,84,114,107") {
908
+ var T = 0, k = 0;
909
+ for (this.notetab.length = 0; ; ) {
910
+ T += o(n, l + 8 + k), k += i;
911
+ var R = w(this.song, T, n, l + 8 + k);
912
+ if (k += i, R)
913
+ break;
914
+ }
915
+ T > this.maxTick && (this.maxTick = T);
916
+ }
917
+ l += y + 8;
918
+ }
919
+ this.song.ev.sort(function(d, v) {
920
+ return d.t - v.t;
921
+ }), this.reset(), this.locateMIDI(0);
922
+ }
923
+ },
924
+ setQuality: (t) => {
925
+ t != null && (this.quality = t);
926
+ for (let e = 0; e < 128; ++e)
927
+ this.setTimbre(0, e, this.program0[e]);
928
+ for (let e = 0; e < this.drummap0.length; ++e)
929
+ this.setTimbre(1, e + 35, this.drummap0[e]);
930
+ if (this.quality) {
931
+ for (let e = 0; e < this.program1.length; ++e)
932
+ this.setTimbre(0, e, this.program1[e]);
933
+ for (let e = 0; e < this.drummap.length; ++e)
934
+ this.drummap1[e] && this.setTimbre(1, e + 35, this.drummap1[e]);
935
+ }
936
+ },
937
+ setTimbre: (t, e, s) => {
938
+ const a = { g: 0, w: "sine", t: 1, f: 0, v: 0.5, a: 0, h: 0.01, d: 0.01, s: 0, r: 0.05, p: 1, q: 1, k: 0 };
939
+ function r(o) {
940
+ for (e = 0; e < o.length; ++e)
941
+ for (let w in a)
942
+ (!o[e].hasOwnProperty(w) || typeof o[e][w] > "u") && (o[e][w] = a[w]);
943
+ return o;
944
+ }
945
+ t && e >= 35 && e <= 81 && (this.drummap[e - 35].p = r(s)), t == 0 && e >= 0 && e <= 127 && (this.program[e].p = r(s));
946
+ },
947
+ _pruneNote: (t) => {
948
+ for (let e = t.o.length - 1; e >= 0; --e) {
949
+ if (t.o[e].frequency ? t.o[e].frequency.cancelScheduledValues(0) : t.o[e].playbackRate.cancelScheduledValues(0), t.g[e].gain.cancelScheduledValues(0), t.o[e].stop(), t.o[e].detune)
950
+ try {
951
+ this.chmod[t.ch].disconnect(t.o[e].detune);
952
+ } catch {
953
+ }
954
+ t.g[e].gain.value = 0;
955
+ }
956
+ },
957
+ _limitVoices: (t, e) => {
958
+ this.notetab.sort(function(a, r) {
959
+ return a.f != r.f ? a.f - r.f : a.e != r.e ? r.e - a.e : r.t - a.t;
960
+ });
961
+ for (let a = this.notetab.length - 1; a >= 0; --a) {
962
+ var s = this.notetab[a];
963
+ (this.actx.currentTime > s.e || a >= this.voices - 1) && (this._pruneNote(s), this.notetab.splice(a, 1));
964
+ }
965
+ },
966
+ _note: (t, e, s, a, r) => {
967
+ let o, w, n;
968
+ const i = [], c = [], f = [], l = [], x = [], y = 440 * Math.pow(2, (s - 69 + this.masterTuningC + this.tuningC[e] + (this.masterTuningF + this.tuningF[e]) / 8192) / 12);
969
+ this._limitVoices(e, s);
970
+ for (let h = 0; h < r.length; ++h) {
971
+ n = r[h];
972
+ const C = t + n.a + n.h;
973
+ switch (n.g == 0 ? (o = this.chvol[e], w = a * a / 16384, l[h] = y * n.t + n.f) : n.g > 10 ? (o = c[n.g - 11].gain, w = 1, l[h] = l[n.g - 11] * n.t + n.f) : i[n.g - 1].frequency ? (o = i[n.g - 1].frequency, w = l[n.g - 1], l[h] = l[n.g - 1] * n.t + n.f) : (o = i[n.g - 1].playbackRate, w = l[n.g - 1] / 440, l[h] = l[n.g - 1] * n.t + n.f), n.w[0]) {
974
+ case "n":
975
+ i[h] = this.actx.createBufferSource(), i[h].buffer = this.noiseBuf[n.w], i[h].loop = !0, i[h].playbackRate.value = l[h] / 440, n.p != 1 && this._setParamTarget(i[h].playbackRate, l[h] / 440 * n.p, t, n.q), i[h].detune && (this.chmod[e].connect(i[h].detune), i[h].detune.value = this.bend[e]);
976
+ break;
977
+ default:
978
+ i[h] = this.actx.createOscillator(), i[h].frequency.value = l[h], n.p != 1 && this._setParamTarget(i[h].frequency, l[h] * n.p, t, n.q), n.w[0] == "w" ? i[h].setPeriodicWave(this.wave[n.w]) : i[h].type = n.w, i[h].detune && (this.chmod[e].connect(i[h].detune), i[h].detune.value = this.bend[e]);
979
+ break;
980
+ }
981
+ c[h] = this.actx.createGain(), x[h] = n.r, i[h].connect(c[h]), c[h].connect(o), f[h] = w * n.v, n.k && (f[h] *= Math.pow(2, (s - 60) / 12 * n.k)), n.a ? (c[h].gain.value = 0, c[h].gain.setValueAtTime(0, t), c[h].gain.linearRampToValueAtTime(f[h], t + n.a)) : c[h].gain.setValueAtTime(f[h], t), this._setParamTarget(c[h].gain, n.s * f[h], C, n.d), i[h].start(t), this.rhythm[e] && (i[h].onended = () => {
982
+ try {
983
+ i[h].detune && this.chmod[e].disconnect(i[h].detune);
984
+ } catch {
985
+ }
986
+ }, i[h].stop(t + r[0].d * this.releaseRatio));
987
+ }
988
+ this.rhythm[e] || this.notetab.push({ t, e: 99999, ch: e, n: s, o: i, g: c, t2: t + n.a, v: f, r: x, f: 0 });
989
+ },
990
+ _setParamTarget: (t, e, s, a) => {
991
+ a != 0 ? t.setTargetAtTime(e, s, a) : t.setValueAtTime(e, s);
992
+ },
993
+ _releaseNote: (t, e) => {
994
+ if (t.ch != 9)
995
+ for (let s = t.g.length - 1; s >= 0; --s)
996
+ t.g[s].gain.cancelScheduledValues(e), e == t.t2 ? t.g[s].gain.setValueAtTime(t.v[s], e) : e < t.t2 && t.g[s].gain.setValueAtTime(t.v[s] * (e - t.t) / (t.t2 - t.t), e), this._setParamTarget(t.g[s].gain, 0, e, t.r[s]);
997
+ t.e = e + t.r[0] * this.releaseRatio, t.f = 1;
998
+ },
999
+ setModulation: (t, e, s) => {
1000
+ this.chmod[t].gain.setValueAtTime(e * 100 / 127, this._tsConv(s));
1001
+ },
1002
+ setChVol: (t, e, s) => {
1003
+ this.vol[t] = 3 * e * e / 16129, this.chvol[t].gain.setValueAtTime(this.vol[t] * this.ex[t], this._tsConv(s));
1004
+ },
1005
+ setPan: (t, e, s) => {
1006
+ this.chpan[t] && this.chpan[t].pan.setValueAtTime((e - 64) / 64, this._tsConv(s));
1007
+ },
1008
+ setExpression: (t, e, s) => {
1009
+ this.ex[t] = e * e / 16129, this.chvol[t].gain.setValueAtTime(this.vol[t] * this.ex[t], this._tsConv(s));
1010
+ },
1011
+ setSustain: (t, e, s) => {
1012
+ if (this.sustain[t] = e, s = this._tsConv(s), e < 64)
1013
+ for (let a = this.notetab.length - 1; a >= 0; --a) {
1014
+ const r = this.notetab[a];
1015
+ s >= r.t && r.ch == t && r.f == 1 && this._releaseNote(r, s);
1016
+ }
1017
+ },
1018
+ allSoundOff: (t) => {
1019
+ for (let e = this.notetab.length - 1; e >= 0; --e) {
1020
+ const s = this.notetab[e];
1021
+ s.ch == t && (this._pruneNote(s), this.notetab.splice(e, 1));
1022
+ }
1023
+ },
1024
+ resetAllControllers: (t) => {
1025
+ this.bend[t] = 0, this.ex[t] = 1, this.rpnidx[t] = 16383, this.sustain[t] = 0, this.chvol[t] && (this.chvol[t].gain.value = this.vol[t] * this.ex[t], this.chmod[t].gain.value = 0);
1026
+ },
1027
+ setBendRange: (t, e) => {
1028
+ this.brange[t] = e;
1029
+ },
1030
+ setProgram: (t, e) => {
1031
+ this.debug && console.log("Pg(" + t + ")=" + e), this.pg[t] = e;
1032
+ },
1033
+ _tsConv: (t) => (t == null || t <= 0 ? (t = 0, this.actx && (t = this.actx.currentTime)) : this.tsmode && (t = t * 1e-3 - this.tsdiff), t),
1034
+ setBend: (t, e, s) => {
1035
+ s = this._tsConv(s);
1036
+ const a = this.brange[t] * 100 / 127;
1037
+ this.bend[t] = (e - 8192) * a / 8192;
1038
+ for (let r = this.notetab.length - 1; r >= 0; --r) {
1039
+ const o = this.notetab[r];
1040
+ if (o.ch == t)
1041
+ for (let w = o.o.length - 1; w >= 0; --w)
1042
+ o.o[w].frequency && o.o[w].detune && o.o[w].detune.setValueAtTime(this.bend[t], s);
1043
+ }
1044
+ },
1045
+ noteOff: (t, e, s) => {
1046
+ if (!this.rhythm[t]) {
1047
+ s = this._tsConv(s);
1048
+ for (let a = this.notetab.length - 1; a >= 0; --a) {
1049
+ const r = this.notetab[a];
1050
+ s >= r.t && r.ch == t && r.n == e && r.f == 0 && (r.f = 1, this.sustain[t] < 64 && this._releaseNote(r, s));
1051
+ }
1052
+ }
1053
+ },
1054
+ noteOn: (t, e, s, a) => {
1055
+ if (s == 0) {
1056
+ this.noteOff(t, e, a);
1057
+ return;
1058
+ }
1059
+ if (a = this._tsConv(a), this.rhythm[t]) {
1060
+ e >= 35 && e <= 81 && this._note(a, t, e, s, this.drummap[e - 35].p);
1061
+ return;
1062
+ }
1063
+ this._note(a, t, e, s, this.program[this.pg[t]].p);
1064
+ },
1065
+ setTsMode: (t) => {
1066
+ this.tsmode = t;
1067
+ },
1068
+ send: (t, e) => {
1069
+ const s = t[0] & 15, a = t[0] & -16;
1070
+ if (!(a < 128 || a >= 256))
1071
+ switch (this.audioContext.state == "suspended" && this.audioContext.resume(), a) {
1072
+ case 176:
1073
+ switch (t[1]) {
1074
+ case 1:
1075
+ this.setModulation(s, t[2], e);
1076
+ break;
1077
+ case 7:
1078
+ this.setChVol(s, t[2], e);
1079
+ break;
1080
+ case 10:
1081
+ this.setPan(s, t[2], e);
1082
+ break;
1083
+ case 11:
1084
+ this.setExpression(s, t[2], e);
1085
+ break;
1086
+ case 64:
1087
+ this.setSustain(s, t[2], e);
1088
+ break;
1089
+ case 98:
1090
+ case 99:
1091
+ this.rpnidx[s] = 16383;
1092
+ break;
1093
+ case 100:
1094
+ this.rpnidx[s] = this.rpnidx[s] & 16256 | t[2];
1095
+ break;
1096
+ case 101:
1097
+ this.rpnidx[s] = this.rpnidx[s] & 127 | t[2] << 7;
1098
+ break;
1099
+ case 6:
1100
+ switch (this.rpnidx[s]) {
1101
+ case 0:
1102
+ this.brange[s] = (t[2] << 7) + (this.brange[s] & 127);
1103
+ break;
1104
+ case 1:
1105
+ this.tuningF[s] = (t[2] << 7) + (this.tuningF[s] + 8192 & 127) - 8192;
1106
+ break;
1107
+ case 2:
1108
+ this.tuningC[s] = t[2] - 64;
1109
+ break;
1110
+ }
1111
+ break;
1112
+ case 38:
1113
+ switch (this.rpnidx[s]) {
1114
+ case 0:
1115
+ this.brange[s] = this.brange[s] & 16256 | t[2];
1116
+ break;
1117
+ case 1:
1118
+ this.tuningF[s] = this.tuningF[s] + 8192 & 16256 | t[2] - 8192;
1119
+ break;
1120
+ }
1121
+ break;
1122
+ case 120:
1123
+ case 123:
1124
+ case 124:
1125
+ case 125:
1126
+ case 126:
1127
+ case 127:
1128
+ this.allSoundOff(s);
1129
+ break;
1130
+ case 121:
1131
+ this.resetAllControllers(s);
1132
+ break;
1133
+ }
1134
+ break;
1135
+ case 192:
1136
+ this.setProgram(s, t[1]);
1137
+ break;
1138
+ case 224:
1139
+ this.setBend(s, t[1] + (t[2] << 7), e);
1140
+ break;
1141
+ case 144:
1142
+ this.noteOn(s, t[1], t[2], e);
1143
+ break;
1144
+ case 128:
1145
+ this.noteOff(s, t[1], e);
1146
+ break;
1147
+ case 240:
1148
+ if (t[0] == 255) {
1149
+ this.reset();
1150
+ break;
1151
+ }
1152
+ if (t[0] != 254 && this.debug) {
1153
+ var r = [];
1154
+ for (let o = 0; o < t.length; ++o)
1155
+ r.push(t[o].toString(16));
1156
+ }
1157
+ if (t[0] == 240 && (t[1] == 127 && t[3] == 4 && (t[4] == 3 && t.length >= 8 && (this.masterTuningF = t[6] * 128 + t[5] - 8192), t[4] == 4 && t.length >= 8 && (this.masterTuningC = t[6] - 64)), t[1] == 65 && t[3] == 66 && t[4] == 18 && t[5] == 64 && (t[6] & 240) == 16 && t[7] == 21)) {
1158
+ const o = [9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15][t[6] & 15];
1159
+ this.rhythm[o] = t[8];
1160
+ }
1161
+ break;
1162
+ }
1163
+ },
1164
+ _createWave: (t) => {
1165
+ const e = new Float32Array(t.length), s = new Float32Array(t.length);
1166
+ for (let a = 1; a < t.length; ++a)
1167
+ e[a] = t[a];
1168
+ return this.actx.createPeriodicWave(s, e);
1169
+ },
1170
+ getAudioContext: () => this.actx,
1171
+ setAudioContext: (t, e) => {
1172
+ this.audioContext = this.actx = t, this.dest = e, e || (this.dest = t.destination), this.tsdiff = performance.now() * 1e-3 - this.actx.currentTime, console.log("TSDiff:" + this.tsdiff), this.out = this.actx.createGain(), this.comp = this.actx.createDynamicsCompressor();
1173
+ var s = this.actx.sampleRate * 0.5 | 0;
1174
+ this.convBuf = this.actx.createBuffer(2, s, this.actx.sampleRate), this.noiseBuf = {}, this.noiseBuf.n0 = this.actx.createBuffer(1, s, this.actx.sampleRate), this.noiseBuf.n1 = this.actx.createBuffer(1, s, this.actx.sampleRate);
1175
+ var a = this.convBuf.getChannelData(0), r = this.convBuf.getChannelData(1), o = this.noiseBuf.n0.getChannelData(0), w = this.noiseBuf.n1.getChannelData(0);
1176
+ for (let i = 0; i < s; ++i)
1177
+ i / s < Math.random() && (a[i] = Math.exp(-3 * i / s) * (Math.random() - 0.5) * 0.5, r[i] = Math.exp(-3 * i / s) * (Math.random() - 0.5) * 0.5), o[i] = Math.random() * 2 - 1;
1178
+ for (let i = 0; i < 64; ++i) {
1179
+ const c = Math.random() * 10 + 1, f = Math.random() * 10 + 1;
1180
+ for (let l = 0; l < s; ++l) {
1181
+ var n = Math.sin(l / s * 2 * Math.PI * 440 * c) * Math.sin(l / s * 2 * Math.PI * 440 * f);
1182
+ w[l] += n / 8;
1183
+ }
1184
+ }
1185
+ this.useReverb && (this.conv = this.actx.createConvolver(), this.conv.buffer = this.convBuf, this.rev = this.actx.createGain(), this.rev.gain.value = this.reverbLev, this.out.connect(this.conv), this.conv.connect(this.rev), this.rev.connect(this.comp)), this.setMasterVol(), this.out.connect(this.comp), this.comp.connect(this.dest), this.chvol = [], this.chmod = [], this.chpan = [], this.wave = { w9999: this._createWave("w9999") }, this.lfo = this.actx.createOscillator(), this.lfo.frequency.value = 5, this.lfo.start(0);
1186
+ for (let i = 0; i < 16; ++i)
1187
+ this.chvol[i] = this.actx.createGain(), this.actx.createStereoPanner ? (this.chpan[i] = this.actx.createStereoPanner(), this.chvol[i].connect(this.chpan[i]), this.chpan[i].connect(this.out)) : (this.chpan[i] = null, this.chvol[i].connect(this.out)), this.chmod[i] = this.actx.createGain(), this.lfo.connect(this.chmod[i]), this.pg[i] = 0, this.resetAllControllers(i);
1188
+ this.setReverbLev(), this.reset(), this.send([144, 60, 1]), this.send([144, 60, 0]);
1189
+ }
1190
+ });
1191
+ }
1192
+ if (b && b.customElements) {
1193
+ class q extends HTMLElement {
1194
+ constructor() {
1195
+ super();
1196
+ }
1197
+ connectedCallback() {
1198
+ const e = document.createElement("div");
1199
+ e.innerHTML = `<canvas
1200
+ id='wa-canvas' width='300' height='32'
1201
+ touch-action='none' tabindex='0'
1202
+ style='
1203
+ position:relative;
1204
+ margin:0;
1205
+ border:none;
1206
+ width:300px;
1207
+ height:32px;
1208
+ '
1209
+ ></canvas>
1210
+ <div id='wa-logo'
1211
+ style='
1212
+ display:none;
1213
+ position:absolute;
1214
+ top:5px;
1215
+ left:5px;
1216
+ color:#fff;
1217
+ font-size:8px;
1218
+ background:rgba(0,0,0,0.5);
1219
+ '
1220
+ >TinySynth</div>`, this.getAttr = (a, r) => {
1221
+ let o = this.getAttribute(a);
1222
+ if (o == "" || o == null) return r;
1223
+ switch (typeof r) {
1224
+ case "number":
1225
+ return o == "true" ? 1 : (o = +o, isNaN(o) ? 0 : o);
1226
+ }
1227
+ return o;
1228
+ }, this.canvas = e.children[0], this.appendChild(e), I.bind(this)(this);
1229
+ const s = this.properties;
1230
+ for (let a in s) {
1231
+ const r = s[a];
1232
+ r.observer ? (this["_" + a] = r.value, Object.defineProperty(this, a, {
1233
+ get: () => this["_" + a],
1234
+ set: (o) => {
1235
+ this["_" + a] = o, this[r.observer]();
1236
+ }
1237
+ })) : this[a] = r;
1238
+ }
1239
+ for (let a in s) {
1240
+ const r = s[a];
1241
+ this[a] = this.getAttr(a, r.value);
1242
+ }
1243
+ this.setQuality(1), this.init(), this._guiInit.bind(this)(), setInterval(this._guiUpdate.bind(this), 100);
1244
+ }
1245
+ }
1246
+ b.customElements.define("webaudio-tinysynth", q);
1247
+ }
1248
+ class A {
1249
+ constructor(t) {
1250
+ I.bind(this)(this);
1251
+ for (let e in this.properties)
1252
+ this[e] = this.properties[e].value;
1253
+ this.setQuality(1), t && (t.useReverb != null && (this.useReverb = t.useReverb), t.quality != null && this.setQuality(t.quality), t.voices != null && this.setVoices(t.voices)), this.init();
1254
+ }
1255
+ }
1256
+ m.exports = A;
1257
+ })(D);
1258
+ }(M)), M.exports;
1259
+ }
1260
+ var O = _();
1261
+ const E = /* @__PURE__ */ V(O), H = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1262
+ __proto__: null,
1263
+ default: E
1264
+ }, Symbol.toStringTag, { value: "Module" }));
1265
+ export {
1266
+ H as w
1267
+ };