rlo-engine 1.0.3 → 1.1.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.
- package/README.md +15 -4
- package/dist/Core/AudioMath.d.ts +29 -0
- package/dist/Core/AudioMath.d.ts.map +1 -0
- package/dist/Core/AudioMath.js +64 -0
- package/dist/Core/AudioMath.js.map +1 -0
- package/dist/Core/InstrumentMap.d.ts +36 -0
- package/dist/Core/InstrumentMap.d.ts.map +1 -0
- package/dist/Core/InstrumentMap.js +62 -0
- package/dist/Core/InstrumentMap.js.map +1 -0
- package/dist/Core/RLOCore.d.ts +49 -0
- package/dist/Core/RLOCore.d.ts.map +1 -0
- package/dist/Core/RLOCore.js +188 -0
- package/dist/Core/RLOCore.js.map +1 -0
- package/dist/Core/SequenceBuilder.d.ts +23 -0
- package/dist/Core/SequenceBuilder.d.ts.map +1 -0
- package/dist/Core/SequenceBuilder.js +31 -0
- package/dist/Core/SequenceBuilder.js.map +1 -0
- package/dist/Instruments/Analog/AnalogSynthBase.d.ts +17 -7
- package/dist/Instruments/Analog/AnalogSynthBase.d.ts.map +1 -1
- package/dist/Instruments/Analog/AnalogSynthBase.js +27 -16
- package/dist/Instruments/Analog/AnalogSynthBase.js.map +1 -1
- package/dist/Instruments/Analog/BassSynth.d.ts +12 -5
- package/dist/Instruments/Analog/BassSynth.d.ts.map +1 -1
- package/dist/Instruments/Analog/BassSynth.js +17 -10
- package/dist/Instruments/Analog/BassSynth.js.map +1 -1
- package/dist/Instruments/Analog/ChiptuneSynth.d.ts +11 -4
- package/dist/Instruments/Analog/ChiptuneSynth.d.ts.map +1 -1
- package/dist/Instruments/Analog/ChiptuneSynth.js +12 -5
- package/dist/Instruments/Analog/ChiptuneSynth.js.map +1 -1
- package/dist/Instruments/Analog/FMSynth.d.ts +11 -4
- package/dist/Instruments/Analog/FMSynth.d.ts.map +1 -1
- package/dist/Instruments/Analog/FMSynth.js +14 -7
- package/dist/Instruments/Analog/FMSynth.js.map +1 -1
- package/dist/Instruments/Analog/FormantSynth.d.ts +11 -4
- package/dist/Instruments/Analog/FormantSynth.d.ts.map +1 -1
- package/dist/Instruments/Analog/FormantSynth.js +12 -5
- package/dist/Instruments/Analog/FormantSynth.js.map +1 -1
- package/dist/Instruments/Analog/LeadSynth.d.ts +11 -4
- package/dist/Instruments/Analog/LeadSynth.d.ts.map +1 -1
- package/dist/Instruments/Analog/LeadSynth.js +14 -7
- package/dist/Instruments/Analog/LeadSynth.js.map +1 -1
- package/dist/Instruments/Analog/OrganSynth.d.ts +11 -4
- package/dist/Instruments/Analog/OrganSynth.d.ts.map +1 -1
- package/dist/Instruments/Analog/OrganSynth.js +17 -10
- package/dist/Instruments/Analog/OrganSynth.js.map +1 -1
- package/dist/Instruments/Analog/PadSynth.js +7 -7
- package/dist/Instruments/Analog/PadSynth.js.map +1 -1
- package/dist/Instruments/Analog/ReeseBassSynth.d.ts +11 -4
- package/dist/Instruments/Analog/ReeseBassSynth.d.ts.map +1 -1
- package/dist/Instruments/Analog/ReeseBassSynth.js +13 -6
- package/dist/Instruments/Analog/ReeseBassSynth.js.map +1 -1
- package/dist/Instruments/Analog/StringSynth.js +4 -4
- package/dist/Instruments/Analog/StringSynth.js.map +1 -1
- package/dist/Instruments/Analog/WoodwindSynth.d.ts +11 -4
- package/dist/Instruments/Analog/WoodwindSynth.d.ts.map +1 -1
- package/dist/Instruments/Analog/WoodwindSynth.js +19 -12
- package/dist/Instruments/Analog/WoodwindSynth.js.map +1 -1
- package/dist/Instruments/CoreSynthBase.d.ts +31 -24
- package/dist/Instruments/CoreSynthBase.d.ts.map +1 -1
- package/dist/Instruments/CoreSynthBase.js +53 -34
- package/dist/Instruments/CoreSynthBase.js.map +1 -1
- package/dist/Instruments/Decay/AdditiveSynth.d.ts +12 -5
- package/dist/Instruments/Decay/AdditiveSynth.d.ts.map +1 -1
- package/dist/Instruments/Decay/AdditiveSynth.js +9 -2
- package/dist/Instruments/Decay/AdditiveSynth.js.map +1 -1
- package/dist/Instruments/Decay/BrassSynth.d.ts +11 -4
- package/dist/Instruments/Decay/BrassSynth.d.ts.map +1 -1
- package/dist/Instruments/Decay/BrassSynth.js +22 -15
- package/dist/Instruments/Decay/BrassSynth.js.map +1 -1
- package/dist/Instruments/Decay/ChromaticPercussionSynth.d.ts +12 -5
- package/dist/Instruments/Decay/ChromaticPercussionSynth.d.ts.map +1 -1
- package/dist/Instruments/Decay/ChromaticPercussionSynth.js +16 -9
- package/dist/Instruments/Decay/ChromaticPercussionSynth.js.map +1 -1
- package/dist/Instruments/Decay/DecaySynthBase.d.ts +14 -8
- package/dist/Instruments/Decay/DecaySynthBase.d.ts.map +1 -1
- package/dist/Instruments/Decay/DecaySynthBase.js +22 -15
- package/dist/Instruments/Decay/DecaySynthBase.js.map +1 -1
- package/dist/Instruments/Decay/ElectricGuitarSynth.d.ts +12 -5
- package/dist/Instruments/Decay/ElectricGuitarSynth.d.ts.map +1 -1
- package/dist/Instruments/Decay/ElectricGuitarSynth.js +19 -12
- package/dist/Instruments/Decay/ElectricGuitarSynth.js.map +1 -1
- package/dist/Instruments/Decay/EthnicSynth.d.ts +12 -5
- package/dist/Instruments/Decay/EthnicSynth.d.ts.map +1 -1
- package/dist/Instruments/Decay/EthnicSynth.js +13 -6
- package/dist/Instruments/Decay/EthnicSynth.js.map +1 -1
- package/dist/Instruments/Decay/GuitarSynth.d.ts +12 -5
- package/dist/Instruments/Decay/GuitarSynth.d.ts.map +1 -1
- package/dist/Instruments/Decay/GuitarSynth.js +14 -7
- package/dist/Instruments/Decay/GuitarSynth.js.map +1 -1
- package/dist/Instruments/Decay/KarplusSynth.d.ts +7 -0
- package/dist/Instruments/Decay/KarplusSynth.d.ts.map +1 -1
- package/dist/Instruments/Decay/KarplusSynth.js +16 -8
- package/dist/Instruments/Decay/KarplusSynth.js.map +1 -1
- package/dist/Instruments/Decay/PianoSynth.d.ts +12 -5
- package/dist/Instruments/Decay/PianoSynth.d.ts.map +1 -1
- package/dist/Instruments/Decay/PianoSynth.js +19 -12
- package/dist/Instruments/Decay/PianoSynth.js.map +1 -1
- package/dist/Instruments/Decay/SlapBassSynth.d.ts +12 -5
- package/dist/Instruments/Decay/SlapBassSynth.d.ts.map +1 -1
- package/dist/Instruments/Decay/SlapBassSynth.js +13 -6
- package/dist/Instruments/Decay/SlapBassSynth.js.map +1 -1
- package/dist/Instruments/ISynthInstrument.d.ts +6 -0
- package/dist/Instruments/ISynthInstrument.d.ts.map +1 -1
- package/dist/Instruments/Speciality/DrumSynth.d.ts +7 -0
- package/dist/Instruments/Speciality/DrumSynth.d.ts.map +1 -1
- package/dist/Instruments/Speciality/DrumSynth.js +30 -21
- package/dist/Instruments/Speciality/DrumSynth.js.map +1 -1
- package/dist/Instruments/Speciality/SoundEffectsSynth.d.ts +7 -0
- package/dist/Instruments/Speciality/SoundEffectsSynth.d.ts.map +1 -1
- package/dist/Instruments/Speciality/SoundEffectsSynth.js +20 -12
- package/dist/Instruments/Speciality/SoundEffectsSynth.js.map +1 -1
- package/dist/Instruments/Synthesizer.d.ts +5 -0
- package/dist/Instruments/Synthesizer.d.ts.map +1 -1
- package/dist/Instruments/Synthesizer.js +7 -1
- package/dist/Instruments/Synthesizer.js.map +1 -1
- package/dist/Players/RLOGameEngine.d.ts +35 -0
- package/dist/Players/RLOGameEngine.d.ts.map +1 -0
- package/dist/Players/RLOGameEngine.js +98 -0
- package/dist/Players/RLOGameEngine.js.map +1 -0
- package/dist/Players/RLOMusicPlayer.d.ts +35 -0
- package/dist/Players/RLOMusicPlayer.d.ts.map +1 -0
- package/dist/Players/RLOMusicPlayer.js +167 -0
- package/dist/Players/RLOMusicPlayer.js.map +1 -0
- package/dist/RLO-Transpiler.d.ts +37 -15
- package/dist/RLO-Transpiler.d.ts.map +1 -1
- package/dist/RLO-Transpiler.js +139 -117
- package/dist/RLO-Transpiler.js.map +1 -1
- package/dist/compiler.d.ts +50 -31
- package/dist/compiler.d.ts.map +1 -1
- package/dist/compiler.js +165 -230
- package/dist/compiler.js.map +1 -1
- package/dist/crush.d.ts +1 -5
- package/dist/crush.d.ts.map +1 -1
- package/dist/crush.js +10 -3
- package/dist/crush.js.map +1 -1
- package/dist/index.d.ts +15 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/midi-parser.d.ts +14 -0
- package/dist/midi-parser.d.ts.map +1 -1
- package/dist/midi-parser.js +21 -0
- package/dist/midi-parser.js.map +1 -1
- package/dist/rlo-engine.min.js +441 -439
- package/dist/rlo-engine.min.js.map +1 -1
- package/dist/rlo-engine.min.umd.js +1 -1
- package/dist/rlo-engine.min.umd.js.map +1 -1
- package/dist/types.d.ts +21 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -1
- package/dist/vite.config.d.ts.map +1 -1
- package/dist/vite.config.js +16 -3
- package/dist/vite.config.js.map +1 -1
- package/dist/vite.config.js13k.d.ts.map +1 -1
- package/dist/vite.config.js13k.js +1 -0
- package/dist/vite.config.js13k.js.map +1 -1
- package/package.json +1 -1
- package/dist/Instruments/InstrumentFactory.d.ts +0 -2
- package/dist/Instruments/InstrumentFactory.d.ts.map +0 -1
- package/dist/Instruments/InstrumentFactory.js +0 -4
- package/dist/Instruments/InstrumentFactory.js.map +0 -1
- package/dist/RLO-Player.d.ts +0 -298
- package/dist/RLO-Player.d.ts.map +0 -1
- package/dist/RLO-Player.js +0 -724
- package/dist/RLO-Player.js.map +0 -1
package/dist/rlo-engine.min.js
CHANGED
|
@@ -1,655 +1,657 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
function t(t2, s2 = false) {
|
|
2
|
+
const i2 = t2.notes.length / 5, e2 = s2 ? new Float32Array(i2) : new Uint8Array(i2), h2 = new Uint16Array(i2), n2 = new Uint16Array(i2), o2 = new Uint8Array(i2), a2 = new Uint8Array(i2);
|
|
3
|
+
let c2 = 0;
|
|
4
|
+
for (let r2 = 0, u2 = 0; r2 < i2; r2++, u2 += 5) {
|
|
5
|
+
const i3 = t2.notes[u2 + 1], l2 = t2.notes[u2];
|
|
6
|
+
e2[r2] = s2 ? l2 : l2 > 0 ? Math.max(0, Math.min(255, Math.round(12 * Math.log2(l2 / 440) + 69))) : 0;
|
|
7
|
+
const d2 = Math.max(0, Math.round(1e3 * i3));
|
|
8
|
+
h2[r2] = Math.min(65535, d2 - c2), n2[r2] = Math.min(65535, Math.max(0, Math.round(1e3 * t2.notes[u2 + 2]))), o2[r2] = Math.max(0, Math.min(255, Math.round(255 * t2.notes[u2 + 3]))), a2[r2] = t2.notes[u2 + 4], c2 += h2[r2];
|
|
9
|
+
}
|
|
10
|
+
return { durationSecs: t2.durationSecs, f: e2, t: h2, d: n2, v: o2, i: a2 };
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
for (let t3 = 0; t3 < 2; t3++) {
|
|
16
|
-
const s3 = n2.getChannelData(t3);
|
|
17
|
-
let i3 = 0;
|
|
18
|
-
for (let t4 = 0; t4 < h2; t4++) i3 += 0.3 * (2 * Math.random() - 1 - i3), s3[t4] = i3 * Math.exp(t4 / h2 * -e2) * (1 - t4 / h2);
|
|
19
|
-
}
|
|
20
|
-
return i2 ? this.M = n2 : this.p = n2;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
_s.p = null;
|
|
24
|
-
_s.M = null;
|
|
25
|
-
let s = _s;
|
|
26
|
-
class i {
|
|
27
|
-
static S(t2, s2 = false) {
|
|
28
|
-
const i2 = t2.notes.length / 5, h2 = s2 ? new Float32Array(i2) : new Uint8Array(i2), e2 = new Uint16Array(i2), n2 = new Uint16Array(i2), r2 = new Uint8Array(i2), o2 = new Uint8Array(i2);
|
|
29
|
-
let a2 = 0;
|
|
30
|
-
for (let c2 = 0, u2 = 0; c2 < i2; c2++, u2 += 5) {
|
|
31
|
-
const i3 = t2.notes[u2 + 1], l2 = t2.notes[u2];
|
|
32
|
-
h2[c2] = s2 ? l2 : l2 > 0 ? Math.max(0, Math.min(255, Math.round(12 * Math.log2(l2 / 440) + 69))) : 0;
|
|
33
|
-
const d2 = Math.max(0, Math.round(1e3 * i3));
|
|
34
|
-
e2[c2] = Math.min(65535, d2 - a2), n2[c2] = Math.min(65535, Math.max(0, Math.round(1e3 * t2.notes[u2 + 2]))), r2[c2] = Math.max(0, Math.min(255, Math.round(255 * t2.notes[u2 + 3]))), o2[c2] = t2.notes[u2 + 4], a2 += e2[c2];
|
|
35
|
-
}
|
|
36
|
-
return { durationSecs: t2.durationSecs, f: h2, t: e2, d: n2, v: r2, i: o2 };
|
|
37
|
-
}
|
|
38
|
-
static U(t2, s2 = false) {
|
|
39
|
-
const i2 = 1 === new Uint8Array(new Uint16Array([1]).buffer)[0], h2 = this.S(t2, s2), e2 = h2.f.length, n2 = new ArrayBuffer(12 + (s2 ? 10 : 7) * e2), r2 = new DataView(n2);
|
|
40
|
-
if (r2.setUint8(0, 82), r2.setUint8(1, 76), r2.setUint8(2, 79), r2.setUint8(3, s2 ? 70 : 50), r2.setFloat32(4, h2.durationSecs, true), r2.setUint32(8, e2, true), i2) new Uint16Array(n2, 12, e2).set(h2.t), new Uint16Array(n2, 12 + 2 * e2, e2).set(h2.d), s2 && new Float32Array(n2, 12 + 4 * e2, e2).set(h2.f);
|
|
41
|
-
else for (let t3 = 0; t3 < e2; t3++) r2.setUint16(12 + 2 * t3, h2.t[t3], true), r2.setUint16(12 + 2 * e2 + 2 * t3, h2.d[t3], true), s2 && r2.setFloat32(12 + 4 * e2 + 4 * t3, h2.f[t3], true);
|
|
42
|
-
return s2 ? (new Uint8Array(n2, 12 + 8 * e2, e2).set(h2.v), new Uint8Array(n2, 12 + 9 * e2, e2).set(h2.i)) : (new Uint8Array(n2, 12 + 4 * e2, e2).set(h2.f), new Uint8Array(n2, 12 + 5 * e2, e2).set(h2.v), new Uint8Array(n2, 12 + 6 * e2, e2).set(h2.i)), n2;
|
|
43
|
-
}
|
|
44
|
-
static R(t2) {
|
|
45
|
-
const s2 = new DataView(t2), i2 = String.fromCharCode(s2.getUint8(0), s2.getUint8(1), s2.getUint8(2), s2.getUint8(3));
|
|
46
|
-
if ("RLO2" !== i2 && "RLOF" !== i2) throw Error("Invalid RLO Binary format. Please recompile tracks.");
|
|
47
|
-
const h2 = "RLOF" === i2, e2 = s2.getFloat32(4, true), n2 = s2.getUint32(8, true), r2 = h2 ? null : new Uint8Array(t2, 12 + 4 * n2, n2), o2 = new Uint8Array(t2, 12 + (h2 ? 8 : 5) * n2, n2), a2 = new Uint8Array(t2, 12 + (h2 ? 9 : 6) * n2, n2), c2 = Array(5 * n2);
|
|
48
|
-
let u2 = 0;
|
|
49
|
-
for (let t3 = 0, i3 = 0; t3 < n2; t3++, i3 += 5) {
|
|
50
|
-
const e3 = s2.getUint16(12 + 2 * t3, true), l2 = s2.getUint16(12 + 2 * n2 + 2 * t3, true), d2 = h2 ? s2.getFloat32(12 + 4 * n2 + 4 * t3, true) : r2[t3];
|
|
51
|
-
u2 += e3 / 1e3, c2[i3] = h2 ? d2 : d2 > 0 ? 440 * Math.pow(2, (d2 - 69) / 12) : 0, c2[i3 + 1] = u2, c2[i3 + 2] = l2 / 1e3, c2[i3 + 3] = o2[t3] / 255, c2[i3 + 4] = a2[t3];
|
|
52
|
-
}
|
|
53
|
-
return { durationSecs: e2, notes: c2 };
|
|
54
|
-
}
|
|
12
|
+
function s(s2, i2 = false) {
|
|
13
|
+
const e2 = 1 === new Uint8Array(new Uint16Array([1]).buffer)[0], h2 = t(s2, i2), n2 = h2.f.length, o2 = new ArrayBuffer(12 + (i2 ? 10 : 7) * n2), a2 = new DataView(o2);
|
|
14
|
+
if (a2.setUint8(0, 82), a2.setUint8(1, 76), a2.setUint8(2, 79), a2.setUint8(3, i2 ? 70 : 50), a2.setFloat32(4, h2.durationSecs, true), a2.setUint32(8, n2, true), e2) new Uint16Array(o2, 12, n2).set(h2.t), new Uint16Array(o2, 12 + 2 * n2, n2).set(h2.d), i2 && new Float32Array(o2, 12 + 4 * n2, n2).set(h2.f);
|
|
15
|
+
else for (let t2 = 0; t2 < n2; t2++) a2.setUint16(12 + 2 * t2, h2.t[t2], true), a2.setUint16(12 + 2 * n2 + 2 * t2, h2.d[t2], true), i2 && a2.setFloat32(12 + 4 * n2 + 4 * t2, h2.f[t2], true);
|
|
16
|
+
return i2 ? (new Uint8Array(o2, 12 + 8 * n2, n2).set(h2.v), new Uint8Array(o2, 12 + 9 * n2, n2).set(h2.i)) : (new Uint8Array(o2, 12 + 4 * n2, n2).set(h2.f), new Uint8Array(o2, 12 + 5 * n2, n2).set(h2.v), new Uint8Array(o2, 12 + 6 * n2, n2).set(h2.i)), o2;
|
|
55
17
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
18
|
+
function i(t2) {
|
|
19
|
+
const s2 = new DataView(t2), i2 = String.fromCharCode(s2.getUint8(0), s2.getUint8(1), s2.getUint8(2), s2.getUint8(3));
|
|
20
|
+
if ("RLO2" !== i2 && "RLOF" !== i2) throw Error("Invalid RLO Binary format. Please recompile tracks.");
|
|
21
|
+
const e2 = "RLOF" === i2, h2 = s2.getFloat32(4, true), n2 = s2.getUint32(8, true), o2 = e2 ? null : new Uint8Array(t2, 12 + 4 * n2, n2), a2 = new Uint8Array(t2, 12 + (e2 ? 8 : 5) * n2, n2), c2 = new Uint8Array(t2, 12 + (e2 ? 9 : 6) * n2, n2), r2 = new Float32Array(5 * n2);
|
|
22
|
+
let u2 = 0;
|
|
23
|
+
for (let t3 = 0, i3 = 0; t3 < n2; t3++, i3 += 5) {
|
|
24
|
+
const h3 = s2.getUint16(12 + 2 * t3, true), l2 = s2.getUint16(12 + 2 * n2 + 2 * t3, true), d2 = e2 ? s2.getFloat32(12 + 4 * n2 + 4 * t3, true) : o2[t3];
|
|
25
|
+
u2 += h3 / 1e3, r2[i3] = e2 ? d2 : d2 > 0 ? 440 * Math.pow(2, (d2 - 69) / 12) : 0, r2[i3 + 1] = u2, r2[i3 + 2] = l2 / 1e3, r2[i3 + 3] = a2[t3] / 255, r2[i3 + 4] = c2[t3];
|
|
26
|
+
}
|
|
27
|
+
return { durationSecs: h2, notes: r2 };
|
|
63
28
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
for (let e2 = 0; e2 < 129; e2++) if (null !== s2[e2]) {
|
|
72
|
-
const n2 = Math.abs(t3 - e2);
|
|
73
|
-
n2 < h2 && (h2 = n2, i2 = s2[e2]);
|
|
74
|
-
}
|
|
75
|
-
s2[t3] = i2;
|
|
29
|
+
class e {
|
|
30
|
+
constructor(t2, s2, i2) {
|
|
31
|
+
this.h = t2, this.o = s2, this.u = i2;
|
|
32
|
+
}
|
|
33
|
+
l(t2, s2, i2, e2, h2) {
|
|
34
|
+
const n2 = 0.6 * h2 * Math.min(1, 1600 / i2), o2 = this.u[t2] || this.u[0];
|
|
35
|
+
o2 && o2.l(this.h, this.o, s2, i2, e2, n2);
|
|
76
36
|
}
|
|
77
|
-
return s2;
|
|
78
|
-
}
|
|
79
|
-
function r(t2, s2) {
|
|
80
|
-
const i2 = [...t2];
|
|
81
|
-
return s2.forEach((t3) => {
|
|
82
|
-
for (let s3 = t3.start; s3 <= t3.end; s3++) i2[s3] = t3.synth;
|
|
83
|
-
}), i2;
|
|
84
37
|
}
|
|
85
|
-
let
|
|
38
|
+
let h = class {
|
|
86
39
|
constructor(t2, s2 = []) {
|
|
87
|
-
this.
|
|
40
|
+
this.p = false, this._ = null, this.S = null, this.m = 0, this.M = 0, this.T = 0, this.k = [], this.V = 0.5, this.U = null, this.playbackRate = 1, this.R = null, this.h = t2, this.N = s2;
|
|
88
41
|
}
|
|
89
|
-
get
|
|
42
|
+
get q() {
|
|
90
43
|
return this.h.currentTime;
|
|
91
44
|
}
|
|
92
45
|
setVolume(t2) {
|
|
93
|
-
this.
|
|
46
|
+
this.V = t2;
|
|
94
47
|
}
|
|
95
48
|
seek(t2) {
|
|
96
|
-
this.
|
|
49
|
+
this.T > 0 && (this.U = Math.max(0, t2) % this.T);
|
|
97
50
|
}
|
|
98
51
|
stop() {
|
|
99
|
-
this.
|
|
100
|
-
const t2 = this.
|
|
101
|
-
this.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
});
|
|
52
|
+
this.p = false, this.m++, this._ && clearTimeout(this._);
|
|
53
|
+
const t2 = this.k;
|
|
54
|
+
for (this.k = []; t2.length; ) try {
|
|
55
|
+
t2.pop().disconnect();
|
|
56
|
+
} catch (t3) {
|
|
57
|
+
}
|
|
107
58
|
}
|
|
108
59
|
dispose() {
|
|
109
|
-
this.stop()
|
|
60
|
+
this.stop();
|
|
110
61
|
}
|
|
111
|
-
|
|
62
|
+
O() {
|
|
112
63
|
return this.h.createGain();
|
|
113
64
|
}
|
|
114
|
-
|
|
115
|
-
t2.setValueAtTime(i2 > 0 ? 0 : s2, this.
|
|
65
|
+
I(t2, s2, i2) {
|
|
66
|
+
t2.setValueAtTime(i2 > 0 ? 0 : s2, this.q), i2 > 0 && t2.linearRampToValueAtTime(s2, this.q + i2);
|
|
116
67
|
}
|
|
117
|
-
|
|
68
|
+
L(t2 = this.h) {
|
|
118
69
|
const s2 = t2.createDynamicsCompressor();
|
|
119
70
|
return s2.threshold.value = -24, s2.knee.value = 12, s2.ratio.value = 8, s2.attack.value = 1e-3, s2.release.value = 0.25, s2;
|
|
120
71
|
}
|
|
121
|
-
|
|
122
|
-
const s2 = this.
|
|
123
|
-
return this
|
|
124
|
-
}
|
|
125
|
-
playSequence(
|
|
126
|
-
let
|
|
127
|
-
"object" == typeof
|
|
128
|
-
const
|
|
129
|
-
this.
|
|
130
|
-
const { destination:
|
|
131
|
-
this.
|
|
132
|
-
let
|
|
133
|
-
const d2 =
|
|
134
|
-
if (!this.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
this.
|
|
139
|
-
|
|
140
|
-
|
|
72
|
+
j(t2 = 0) {
|
|
73
|
+
const s2 = this.O();
|
|
74
|
+
return this.I(s2.gain, this.V, t2), s2.connect(this.h.destination), this.k.push(s2), { destination: s2 };
|
|
75
|
+
}
|
|
76
|
+
playSequence(t2, s2 = true, i2 = 0) {
|
|
77
|
+
let h2 = true, n2 = i2;
|
|
78
|
+
"object" == typeof s2 ? (h2 = s2.loop ?? true, n2 = s2.fadeInTime ?? 0, this.playbackRate = s2.playbackRate ?? this.playbackRate, void 0 !== s2.volume && this.setVolume(s2.volume)) : h2 = s2, this.stop(), "suspended" === this.h.state && this.h.resume(), this.p = true;
|
|
79
|
+
const o2 = ++this.m;
|
|
80
|
+
this.T = t2.durationSecs;
|
|
81
|
+
const { destination: a2 } = this.j(n2), c2 = new e(this.h, a2, this.N);
|
|
82
|
+
this.M = -0.05 * this.playbackRate;
|
|
83
|
+
let r2 = this.q, u2 = 0, l2 = 0;
|
|
84
|
+
const d2 = t2.notes, p2 = d2.length, y2 = () => {
|
|
85
|
+
if (!this.p || this.m !== o2) return;
|
|
86
|
+
if (0 === p2) return;
|
|
87
|
+
const s3 = this.q, i3 = s3 - r2;
|
|
88
|
+
if (r2 = s3, null !== this.U) {
|
|
89
|
+
for (this.M = this.U, u2 = 0, l2 = 0; l2 < p2 && d2[l2 + 1] < this.U; ) l2 += 5;
|
|
90
|
+
this.U = null;
|
|
91
|
+
const t3 = a2;
|
|
92
|
+
t3.gain && (t3.gain.cancelScheduledValues(s3), t3.gain.setValueAtTime(1e-3, s3), t3.gain.exponentialRampToValueAtTime(this.V, s3 + 0.5));
|
|
93
|
+
} else this.M += i3 * this.playbackRate;
|
|
94
|
+
const e2 = t2.durationSecs;
|
|
141
95
|
for (; l2 < p2; ) {
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
144
|
-
{
|
|
145
|
-
const
|
|
146
|
-
|
|
96
|
+
const t3 = u2 + d2[l2 + 1];
|
|
97
|
+
if (t3 >= this.M + 0.5 * this.playbackRate) break;
|
|
98
|
+
if (this.M - t3 <= 0.15 * this.playbackRate) {
|
|
99
|
+
const i4 = s3 + Math.max(0, (t3 - this.M) / this.playbackRate);
|
|
100
|
+
c2.l(d2[l2 + 4], i4, d2[l2], d2[l2 + 2] / this.playbackRate, d2[l2 + 3]);
|
|
147
101
|
}
|
|
102
|
+
l2 += 5;
|
|
148
103
|
}
|
|
149
|
-
l2 >= p2 ?
|
|
104
|
+
l2 >= p2 ? h2 && (l2 = 0, u2 += e2, y2()) : this._ = setTimeout(y2, 50);
|
|
150
105
|
};
|
|
151
|
-
|
|
106
|
+
y2();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const _n = class _n {
|
|
110
|
+
static J(t2, s2 = "studio") {
|
|
111
|
+
if ("concert" === s2 && this.X) return this.X;
|
|
112
|
+
if ("studio" === s2 && this.P) return this.P;
|
|
113
|
+
const i2 = "studio" === s2, e2 = t2.sampleRate * (i2 ? 0.2 : 1.5), h2 = i2 ? 8 : 4, n2 = t2.createBuffer(2, e2, t2.sampleRate);
|
|
114
|
+
for (let t3 = 0; t3 < 2; t3++) {
|
|
115
|
+
const s3 = n2.getChannelData(t3);
|
|
116
|
+
let i3 = 0;
|
|
117
|
+
for (let t4 = 0; t4 < e2; t4++) i3 += 0.3 * (2 * Math.random() - 1 - i3), s3[t4] = i3 * Math.exp(t4 / e2 * -h2) * (1 - t4 / e2);
|
|
118
|
+
}
|
|
119
|
+
return i2 ? this.P = n2 : this.X = n2;
|
|
152
120
|
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
121
|
+
};
|
|
122
|
+
_n.X = null;
|
|
123
|
+
_n.P = null;
|
|
124
|
+
let n = _n;
|
|
125
|
+
let o = class extends h {
|
|
126
|
+
constructor(t2, s2 = []) {
|
|
127
|
+
super(t2, s2), this.$ = null, this.H = null, this.K = null, this.W = /* @__PURE__ */ new Map(), this.Y = 20, this.Z = "concert", n.J(this.h, "concert"), n.J(this.h, "studio"), this.tt = () => {
|
|
128
|
+
document.hidden ? this.h.suspend() : this.p && this.h.resume();
|
|
129
|
+
}, "undefined" != typeof document && document.addEventListener("visibilitychange", this.tt);
|
|
158
130
|
}
|
|
159
131
|
setReverbMode(t2) {
|
|
160
|
-
this.
|
|
132
|
+
this.Z = t2, this.H && this.K && (this.H.buffer = n.J(this.h, t2), this.K.gain.setTargetAtTime("studio" === t2 ? 0.05 : 0.2, this.q, 0.1));
|
|
161
133
|
}
|
|
162
134
|
dispose() {
|
|
163
|
-
super.dispose(), "undefined" != typeof document && document.removeEventListener("visibilitychange", this.
|
|
135
|
+
super.dispose(), "undefined" != typeof document && document.removeEventListener("visibilitychange", this.tt), this.W.clear();
|
|
164
136
|
}
|
|
165
137
|
setVolume(t2) {
|
|
166
|
-
super.setVolume(t2), this
|
|
138
|
+
super.setVolume(t2), this.$ && this.$.gain.setTargetAtTime(t2, this.q, 0.1);
|
|
167
139
|
}
|
|
168
140
|
getCurrentTime() {
|
|
169
|
-
return 0 !== this.
|
|
141
|
+
return 0 !== this.T && this.p ? Math.max(0, this.M) % this.T : 0;
|
|
170
142
|
}
|
|
171
143
|
getTotalDuration() {
|
|
172
|
-
return this.
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
this.
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
return this.
|
|
180
|
-
}
|
|
181
|
-
async play(t2, s2 = 0,
|
|
182
|
-
let
|
|
183
|
-
if ("object" == typeof s2 ? (n2 = s2.fadeInTime ?? 0,
|
|
144
|
+
return this.T;
|
|
145
|
+
}
|
|
146
|
+
j(t2 = 0) {
|
|
147
|
+
this.H = this.h.createConvolver(), this.H.buffer = n.J(this.h, this.Z), this.$ = this.O(), this.k.push(this.H, this.$), this.I(this.$.gain, this.V, t2), this.K = this.O(), this.K.gain.value = "studio" === this.Z ? 0.05 : 0.2, this.k.push(this.K);
|
|
148
|
+
const s2 = this.h.createBiquadFilter();
|
|
149
|
+
s2.type = "lowpass", s2.frequency.value = Math.min(this.h.sampleRate / 2 - 1, 6500), this.k.push(s2);
|
|
150
|
+
const i2 = this.L();
|
|
151
|
+
return this.k.push(i2), this.$.connect(s2).connect(i2).connect(this.h.destination), this.$.connect(this.H).connect(this.K).connect(s2), { destination: this.$ };
|
|
152
|
+
}
|
|
153
|
+
async play(t2, s2 = 0, e2 = true) {
|
|
154
|
+
let h2, n2 = 0, o2 = {};
|
|
155
|
+
if ("object" == typeof s2 ? (n2 = s2.fadeInTime ?? 0, o2 = s2) : (n2 = s2, o2 = { fadeInTime: n2, loop: e2 }), "string" == typeof t2) if (this.W.has(t2)) h2 = this.W.get(t2);
|
|
184
156
|
else {
|
|
185
157
|
const s3 = await fetch(t2);
|
|
186
|
-
if (t2.toLowerCase().endsWith(".json")) {
|
|
158
|
+
if (void 0 !== window.__ENABLE_TRANSPILER__ && !window.__ENABLE_TRANSPILER__ || t2.toLowerCase().endsWith(".json")) {
|
|
187
159
|
const t3 = await s3.text();
|
|
188
|
-
|
|
160
|
+
h2 = JSON.parse(t3);
|
|
189
161
|
} else {
|
|
190
|
-
const t3 = await s3.arrayBuffer(),
|
|
191
|
-
if (
|
|
162
|
+
const t3 = await s3.arrayBuffer(), e3 = new DataView(t3);
|
|
163
|
+
if (e3.byteLength >= 3 && 82 === e3.getUint8(0) && 76 === e3.getUint8(1) && 79 === e3.getUint8(2)) h2 = i(t3);
|
|
192
164
|
else {
|
|
193
|
-
const s4 = new window.DecompressionStream("gzip"),
|
|
194
|
-
|
|
165
|
+
const s4 = new window.DecompressionStream("gzip"), e4 = s4.writable.getWriter();
|
|
166
|
+
e4.write(t3), e4.close(), h2 = i(await new Response(s4.readable).arrayBuffer());
|
|
195
167
|
}
|
|
196
168
|
}
|
|
197
|
-
if (this.
|
|
198
|
-
const t3 = this.
|
|
199
|
-
t3 && this.
|
|
169
|
+
if (this.W.set(t2, h2), this.W.size > this.Y) {
|
|
170
|
+
const t3 = this.W.keys().next().value;
|
|
171
|
+
t3 && this.W.delete(t3);
|
|
200
172
|
}
|
|
201
173
|
}
|
|
202
|
-
else
|
|
203
|
-
this.playSequence(
|
|
174
|
+
else h2 = t2;
|
|
175
|
+
this.playSequence(h2, o2);
|
|
204
176
|
}
|
|
205
177
|
stop() {
|
|
206
|
-
if (this
|
|
207
|
-
const t2 = this.
|
|
208
|
-
this
|
|
178
|
+
if (this.$) {
|
|
179
|
+
const t2 = this.q;
|
|
180
|
+
this.$.gain.cancelScheduledValues(t2), this.$.gain.setValueAtTime(0, t2), this.$ = null, this.K = null, this.H = null;
|
|
209
181
|
}
|
|
210
182
|
super.stop();
|
|
211
183
|
}
|
|
212
|
-
},
|
|
213
|
-
constructor(
|
|
214
|
-
super(
|
|
215
|
-
const
|
|
216
|
-
this.
|
|
184
|
+
}, a = class extends h {
|
|
185
|
+
constructor(t2, s2 = []) {
|
|
186
|
+
super(t2, s2), this.st = this.O(), this.st.gain.value = this.V;
|
|
187
|
+
const i2 = this.L();
|
|
188
|
+
this.st.connect(i2).connect(this.h.destination), this.it = this.O(), this.it.connect(this.st), this.et = this.O(), this.et.connect(this.st), this.ht = new e(this.h, this.et, this.N);
|
|
217
189
|
}
|
|
218
190
|
setVolume(t2) {
|
|
219
|
-
super.setVolume(t2), this.
|
|
191
|
+
super.setVolume(t2), this.st.gain.setTargetAtTime(t2, this.q, 0.1);
|
|
220
192
|
}
|
|
221
193
|
setMusicVolume(t2) {
|
|
222
|
-
this.
|
|
194
|
+
this.it.gain.setTargetAtTime(t2, this.q, 0.1);
|
|
223
195
|
}
|
|
224
196
|
setSFXVolume(t2) {
|
|
225
|
-
this.
|
|
197
|
+
this.et.gain.setTargetAtTime(t2, this.q, 0.1);
|
|
226
198
|
}
|
|
227
|
-
|
|
228
|
-
const s2 = this.
|
|
229
|
-
return s2.connect(this.
|
|
199
|
+
j(t2 = 0) {
|
|
200
|
+
const s2 = this.O();
|
|
201
|
+
return s2.connect(this.it), this.k.push(s2), this.I(s2.gain, 1, t2), { destination: s2 };
|
|
230
202
|
}
|
|
231
|
-
playSFX(t2, s2, i2,
|
|
203
|
+
playSFX(t2, s2, i2, e2 = 1, h2 = 0) {
|
|
232
204
|
"suspended" === this.h.state && this.h.resume();
|
|
233
|
-
let n2 = 1,
|
|
234
|
-
"object" == typeof
|
|
205
|
+
let n2 = 1, o2 = h2;
|
|
206
|
+
"object" == typeof e2 ? (n2 = e2.velocity ?? 1, o2 = e2.timeOffset ?? 0) : n2 = e2, this.ht.l(t2, this.q + o2, function(t3) {
|
|
235
207
|
if ("number" == typeof t3) return t3;
|
|
236
208
|
const s3 = t3.match(/^([a-gA-G])([#b]?)(\d)$/);
|
|
237
209
|
if (!s3) return 0;
|
|
238
|
-
const [, i3,
|
|
210
|
+
const [, i3, e3, h3] = s3;
|
|
239
211
|
let n3 = { C: -9, D: -7, E: -5, F: -4, G: -2, A: 0, B: 2 }[i3.toUpperCase()];
|
|
240
|
-
return "#" ===
|
|
212
|
+
return "#" === e3 && n3++, "b" === e3 && n3--, n3 += 12 * (parseInt(h3, 10) - 4), +(440 * Math.pow(2, n3 / 12)).toFixed(2);
|
|
241
213
|
}(s2), i2, n2);
|
|
242
214
|
}
|
|
243
215
|
playSFXSequence(t2, s2 = 0) {
|
|
244
216
|
"suspended" === this.h.state && this.h.resume();
|
|
245
|
-
const i2 = this.
|
|
246
|
-
for (let t3 = 0; t3 <
|
|
217
|
+
const i2 = this.q + s2, e2 = t2.notes, h2 = e2.length;
|
|
218
|
+
for (let t3 = 0; t3 < h2; t3 += 5) this.ht.l(e2[t3 + 4], i2 + e2[t3 + 1], e2[t3], e2[t3 + 2], e2[t3 + 3]);
|
|
247
219
|
}
|
|
248
220
|
playMusic(t2, s2 = true, i2 = 0) {
|
|
249
|
-
let
|
|
250
|
-
"object" == typeof s2 && void 0 !== s2.volume && (this.setMusicVolume(s2.volume),
|
|
221
|
+
let e2 = s2;
|
|
222
|
+
"object" == typeof s2 && void 0 !== s2.volume && (this.setMusicVolume(s2.volume), e2 = { ...s2 }, delete e2.volume), this.playSequence(t2, e2, i2);
|
|
251
223
|
}
|
|
252
224
|
stopMusic() {
|
|
253
225
|
super.stop();
|
|
254
226
|
}
|
|
255
227
|
};
|
|
256
|
-
|
|
228
|
+
const c = { l: () => {
|
|
229
|
+
} };
|
|
230
|
+
function r(t2) {
|
|
231
|
+
const s2 = Array(129).fill(null);
|
|
232
|
+
return t2.forEach((t3) => {
|
|
233
|
+
t3.ids.forEach((i2) => s2[i2] = t3.synth);
|
|
234
|
+
}), s2;
|
|
235
|
+
}
|
|
236
|
+
function u(t2) {
|
|
237
|
+
const s2 = Array(129).fill(null);
|
|
238
|
+
t2.forEach((t3) => {
|
|
239
|
+
for (let i2 = t3.start; i2 <= t3.end; i2++) s2[i2] = t3.synth;
|
|
240
|
+
});
|
|
241
|
+
for (let t3 = 0; t3 < 129; t3++) if (null === s2[t3]) {
|
|
242
|
+
let i2 = null, e2 = 1 / 0;
|
|
243
|
+
for (let h2 = 0; h2 < 129; h2++) if (null !== s2[h2]) {
|
|
244
|
+
const n2 = Math.abs(t3 - h2);
|
|
245
|
+
n2 < e2 && (e2 = n2, i2 = s2[h2]);
|
|
246
|
+
}
|
|
247
|
+
s2[t3] = i2;
|
|
248
|
+
}
|
|
249
|
+
return s2;
|
|
250
|
+
}
|
|
251
|
+
function l(t2, s2) {
|
|
252
|
+
const i2 = [...t2];
|
|
253
|
+
return s2.forEach((t3) => {
|
|
254
|
+
for (let s3 = t3.start; s3 <= t3.end; s3++) i2[s3] = t3.synth;
|
|
255
|
+
}), i2;
|
|
256
|
+
}
|
|
257
257
|
class d {
|
|
258
|
-
|
|
259
|
-
const
|
|
260
|
-
return
|
|
258
|
+
nt(t2, s2, i2, e2) {
|
|
259
|
+
const h2 = t2.createOscillator();
|
|
260
|
+
return h2.type = s2, i2 && (h2.frequency.value = Math.min(22e3, i2)), e2 && h2.connect(e2), h2;
|
|
261
261
|
}
|
|
262
|
-
|
|
263
|
-
const
|
|
264
|
-
return
|
|
262
|
+
O(t2, s2, i2) {
|
|
263
|
+
const e2 = t2.createGain();
|
|
264
|
+
return e2.gain.value = s2, i2 && e2.connect(i2), e2;
|
|
265
265
|
}
|
|
266
|
-
|
|
266
|
+
ot(t2, s2) {
|
|
267
267
|
const i2 = t2.createBiquadFilter();
|
|
268
|
-
return i2.type =
|
|
268
|
+
return i2.type = s2, i2;
|
|
269
269
|
}
|
|
270
|
-
|
|
271
|
-
const
|
|
272
|
-
return
|
|
270
|
+
ct(t2, s2, i2) {
|
|
271
|
+
const e2 = t2.createStereoPanner();
|
|
272
|
+
return e2.pan.value = s2, i2 && e2.connect(i2), e2;
|
|
273
273
|
}
|
|
274
|
-
|
|
274
|
+
rt(t2, s2, ...i2) {
|
|
275
275
|
i2.forEach((i3) => {
|
|
276
276
|
i3.start(t2), i3.stop(s2);
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
|
-
|
|
279
|
+
ut(t2, s2, i2) {
|
|
280
280
|
t2.setValueAtTime(Math.min(22e3, s2), i2);
|
|
281
281
|
}
|
|
282
|
-
|
|
282
|
+
lt(t2, s2, i2) {
|
|
283
283
|
t2.linearRampToValueAtTime(Math.min(22e3, s2), i2);
|
|
284
284
|
}
|
|
285
|
-
|
|
285
|
+
dt(t2, s2, i2) {
|
|
286
286
|
t2.exponentialRampToValueAtTime(Math.min(22e3, s2), i2);
|
|
287
287
|
}
|
|
288
|
-
|
|
289
|
-
const
|
|
290
|
-
this.
|
|
288
|
+
yt(t2, s2, i2, e2, h2, n2, o2, a2 = 0) {
|
|
289
|
+
const c2 = this.O(t2, 0, e2);
|
|
290
|
+
this.ut(c2.gain, a2 > 0 ? 0 : n2, h2), a2 > 0 && this.lt(c2.gain, n2, h2 + a2), this.dt(c2.gain, 1e-3, h2 + o2), this.rt(h2, h2 + o2, this.nt(t2, s2, i2, c2));
|
|
291
291
|
}
|
|
292
|
-
|
|
293
|
-
const
|
|
294
|
-
return this.
|
|
292
|
+
_t(t2, s2, i2, e2, h2, n2) {
|
|
293
|
+
const o2 = this.ot(t2, s2);
|
|
294
|
+
return this.ut(o2.frequency, i2, h2), this.dt(o2.frequency, e2, h2 + n2), o2;
|
|
295
295
|
}
|
|
296
|
-
|
|
297
|
-
return [this.
|
|
296
|
+
wt(t2, s2, i2, e2, h2, n2) {
|
|
297
|
+
return [this.nt(t2, s2, i2, this.ct(t2, -h2, n2)), this.nt(t2, s2, i2 * e2, this.ct(t2, h2, n2))];
|
|
298
298
|
}
|
|
299
|
-
St(t2, s2, i2,
|
|
300
|
-
const
|
|
301
|
-
return this.
|
|
299
|
+
St(t2, s2, i2, e2, h2, n2, o2, a2 = 0) {
|
|
300
|
+
const c2 = this.O(t2, 0, o2);
|
|
301
|
+
return this.ut(c2.gain, 0, e2), a2 > 0 && this.ut(c2.gain, 0, e2 + a2), this.lt(c2.gain, i2, e2 + a2 + h2), this.rt(e2, n2, this.nt(t2, "sine", s2, c2)), c2;
|
|
302
302
|
}
|
|
303
|
-
|
|
303
|
+
ft(t2, s2, i2, ...e2) {
|
|
304
304
|
{
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
305
|
+
const h2 = this.nt(t2, "sine", 0);
|
|
306
|
+
h2.onended = () => {
|
|
307
|
+
e2.forEach((t3) => {
|
|
308
308
|
try {
|
|
309
|
-
t3.disconnect();
|
|
309
|
+
t3 && "function" == typeof t3.disconnect && t3.disconnect();
|
|
310
310
|
} catch (t4) {
|
|
311
311
|
}
|
|
312
312
|
});
|
|
313
|
-
},
|
|
313
|
+
}, h2.start(s2), h2.stop(i2);
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
class p extends d {
|
|
318
318
|
constructor() {
|
|
319
|
-
super(...arguments), this.
|
|
319
|
+
super(...arguments), this.Mt = { Tt: 0.5, xt: 0.02, kt: 0.2, Vt: 4 };
|
|
320
320
|
}
|
|
321
|
-
l(t2, s2, i2,
|
|
322
|
-
const
|
|
323
|
-
this.
|
|
324
|
-
const u2 = i2 +
|
|
325
|
-
l2.connect(s2), this.
|
|
321
|
+
l(t2, s2, i2, e2, h2, n2) {
|
|
322
|
+
const o2 = t2.createGain(), a2 = this.At(), c2 = Math.max(1e-3, n2 * a2.Tt), r2 = Math.max(0.02, Math.min(h2, a2.Vt));
|
|
323
|
+
this.ut(o2.gain, 0, i2), this.lt(o2.gain, c2, i2 + a2.xt), this.gt(o2.gain, c2, i2, a2.xt, r2, a2.kt);
|
|
324
|
+
const u2 = i2 + r2 + a2.kt + 0.1, l2 = this.Dt(t2, s2, o2, i2, e2, n2, r2, u2) || o2;
|
|
325
|
+
l2.connect(s2), this.ft(t2, i2, u2 + 2, l2);
|
|
326
326
|
}
|
|
327
|
-
|
|
328
|
-
return this.
|
|
327
|
+
At() {
|
|
328
|
+
return this.Mt;
|
|
329
329
|
}
|
|
330
|
-
|
|
331
|
-
this.
|
|
330
|
+
gt(t2, s2, i2, e2, h2, n2) {
|
|
331
|
+
this.dt(t2, 1e-3, i2 + h2 + n2);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
class y extends p {
|
|
335
335
|
constructor() {
|
|
336
|
-
super(...arguments), this.
|
|
336
|
+
super(...arguments), this.Mt = { Tt: 0.8, xt: 0.015, kt: 0.1, Vt: 5 };
|
|
337
337
|
}
|
|
338
|
-
|
|
339
|
-
const
|
|
340
|
-
return this.
|
|
338
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
339
|
+
const c2 = this._t(t2, "lowpass", h2 + 800 + 1e3 * n2, h2 + 200, e2, Math.min(o2, 1)), r2 = this.nt(t2, "triangle", h2, i2), u2 = this.O(t2, 0), l2 = this.nt(t2, "sine", 2.003 * h2, u2), d2 = this.nt(t2, "sine", 3.007 * h2, u2), p2 = this.ct(t2, Math.max(-0.8, Math.min(0.8, (h2 - 261.6) / 800)));
|
|
340
|
+
return this.ut(u2.gain, 0, e2), this.lt(u2.gain, Math.max(1e-3, 0.15 * n2), e2 + 0.01), this.dt(u2.gain, 1e-3, e2 + Math.min(o2, 0.5)), u2.connect(p2), this.yt(t2, "sine", 60, p2, e2, Math.max(1e-3, 0.4 * n2), 0.05, 5e-3), i2.connect(p2).connect(c2), this.rt(e2, a2, r2, l2, d2), c2;
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
class
|
|
343
|
+
class _ extends p {
|
|
344
344
|
constructor() {
|
|
345
|
-
super(...arguments), this.
|
|
345
|
+
super(...arguments), this.Mt = { Tt: 0.7, xt: 5e-3, kt: 0.5, Vt: 6 };
|
|
346
346
|
}
|
|
347
|
-
|
|
348
|
-
const
|
|
349
|
-
this.
|
|
350
|
-
const
|
|
351
|
-
this.
|
|
352
|
-
const
|
|
353
|
-
|
|
347
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
348
|
+
const c2 = this.nt(t2, "sine", 0, i2);
|
|
349
|
+
this.ut(c2.frequency, 1.1 * h2, e2), this.dt(c2.frequency, h2, e2 + 0.02);
|
|
350
|
+
const r2 = this.O(t2, 0, s2);
|
|
351
|
+
this.ut(r2.gain, Math.max(1e-3, 0.25 * n2), e2), this.dt(r2.gain, 1e-3, e2 + o2);
|
|
352
|
+
const u2 = this.nt(t2, "sine", 2.76 * h2, r2);
|
|
353
|
+
r2.connect(s2), this.rt(e2, a2, c2, u2);
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
class
|
|
356
|
+
class w extends d {
|
|
357
357
|
constructor() {
|
|
358
|
-
super(...arguments), this.
|
|
358
|
+
super(...arguments), this.Mt = { Tt: 0.5, xt: 0.05, Ut: 0.1, Vt: 10 };
|
|
359
359
|
}
|
|
360
|
-
l(t2, s2, i2,
|
|
361
|
-
const
|
|
362
|
-
this.
|
|
363
|
-
const
|
|
364
|
-
this.
|
|
365
|
-
const
|
|
366
|
-
|
|
360
|
+
l(t2, s2, i2, e2, h2, n2) {
|
|
361
|
+
const o2 = t2.createGain(), a2 = this.At(h2), c2 = Math.max(1e-3, n2 * a2.Tt), r2 = a2.Vt ? Math.min(h2, a2.Vt) : h2;
|
|
362
|
+
this.ut(o2.gain, 0, i2), this.lt(o2.gain, c2, i2 + a2.xt);
|
|
363
|
+
const u2 = Math.max(a2.xt, r2);
|
|
364
|
+
this.ut(o2.gain, c2, i2 + u2), this.lt(o2.gain, 1e-3, i2 + u2 + a2.Ut);
|
|
365
|
+
const l2 = i2 + u2 + a2.Ut, d2 = this.Dt(t2, o2, i2, e2, n2, u2, a2.Ut, l2) || o2;
|
|
366
|
+
d2.connect(s2), this.ft(t2, i2, l2 + 0.1, d2);
|
|
367
367
|
}
|
|
368
|
-
|
|
369
|
-
return this.
|
|
368
|
+
At(t2) {
|
|
369
|
+
return this.Mt;
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
class
|
|
372
|
+
class S extends w {
|
|
373
373
|
constructor() {
|
|
374
|
-
super(...arguments), this.
|
|
374
|
+
super(...arguments), this.Mt = { Tt: 0.4, xt: 0.01, Ut: 0.05 };
|
|
375
375
|
}
|
|
376
|
-
|
|
377
|
-
const
|
|
378
|
-
return this.St(t2, 6.5, 0.3, i2, 0,
|
|
376
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
377
|
+
const c2 = this.nt(t2, "sine", e2, s2), r2 = this.O(t2, 0.5, s2), u2 = this.nt(t2, "sine", 2 * e2, r2), l2 = this.O(t2, 0.25, s2), d2 = this.nt(t2, "sine", 3 * e2, l2), p2 = this.O(t2, 0.7);
|
|
378
|
+
return this.St(t2, 6.5, 0.3, i2, 0, a2, p2.gain), s2.connect(p2), this.yt(t2, "square", 4e3, p2, i2, Math.max(1e-3, 0.1 * h2), 0.015), this.rt(i2, a2, c2, u2, d2), p2;
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
class
|
|
381
|
+
class f extends p {
|
|
382
382
|
constructor() {
|
|
383
|
-
super(...arguments), this.
|
|
383
|
+
super(...arguments), this.Mt = { Tt: 0.6, xt: 0.02, kt: 0.2, Vt: 4 };
|
|
384
384
|
}
|
|
385
|
-
|
|
386
|
-
const
|
|
387
|
-
return this.
|
|
385
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
386
|
+
const c2 = this._t(t2, "lowpass", 2e3 + 1e3 * n2, 200, e2, o2), r2 = this.nt(t2, "sawtooth", 0, i2);
|
|
387
|
+
return this.ut(r2.frequency, 1.02 * h2, e2), this.dt(r2.frequency, h2, e2 + 0.05), i2.connect(c2), this.yt(t2, "square", 3500, s2, e2, Math.max(1e-3, 0.25 * n2), 0.015), this.rt(e2, a2, r2), c2;
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
class
|
|
390
|
+
class m extends p {
|
|
391
391
|
constructor() {
|
|
392
|
-
super(...arguments), this.
|
|
392
|
+
super(...arguments), this.Mt = { Tt: 0.5, xt: 0.02, kt: 0.2, Vt: 4 };
|
|
393
393
|
}
|
|
394
|
-
|
|
395
|
-
this.
|
|
394
|
+
gt(t2, s2, i2, e2, h2, n2) {
|
|
395
|
+
this.dt(t2, Math.max(1e-3, 0.4 * s2), i2 + Math.min(0.5, h2)), this.dt(t2, 1e-3, i2 + h2 + n2);
|
|
396
396
|
}
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
return this.
|
|
397
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
398
|
+
const c2 = this._t(t2, "lowpass", 2500 + 1500 * n2, 600, e2, o2), [r2, u2] = this.wt(t2, "sawtooth", 0, 1, 0, i2);
|
|
399
|
+
return this.ut(r2.frequency, 1.02 * h2, e2), this.dt(r2.frequency, h2, e2 + 0.05), this.ut(u2.frequency, 1.022 * h2, e2), this.dt(u2.frequency, 1.002 * h2, e2 + 0.05), this.St(t2, 5, 0.015 * h2, e2, 0.2, a2, r2.frequency, 0.4).connect(u2.frequency), i2.connect(c2), this.yt(t2, "square", 3500, s2, e2, Math.max(1e-3, 0.25 * n2), 0.015), this.rt(e2, a2, r2, u2), c2;
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
class
|
|
402
|
+
class M extends p {
|
|
403
403
|
constructor() {
|
|
404
|
-
super(...arguments), this.
|
|
404
|
+
super(...arguments), this.Mt = { Tt: 0.8, xt: 0.05, kt: 0.1, Vt: 4 };
|
|
405
405
|
}
|
|
406
|
-
|
|
407
|
-
const
|
|
408
|
-
this.
|
|
409
|
-
const
|
|
410
|
-
return this.
|
|
406
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
407
|
+
const c2 = this._t(t2, "lowpass", 300 + 500 * n2, 100, e2, o2), r2 = this.nt(t2, "sawtooth", 0, i2);
|
|
408
|
+
this.ut(r2.frequency, 0.92 * h2, e2), this.dt(r2.frequency, h2, e2 + 0.04);
|
|
409
|
+
const u2 = this.O(t2, 0.6, i2), l2 = this.nt(t2, "sine", 0, u2);
|
|
410
|
+
return this.ut(l2.frequency, h2 / 2 * 0.92, e2), this.dt(l2.frequency, h2 / 2, e2 + 0.04), i2.connect(c2), this.rt(e2, a2, r2, l2), c2;
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
class
|
|
414
|
-
|
|
413
|
+
class T extends w {
|
|
414
|
+
bt(t2) {
|
|
415
415
|
return { v: 0.3, a: t2 < 0.4 ? 0.05 : 0.2, r: t2 < 0.4 ? 0.1 : 0.5 };
|
|
416
416
|
}
|
|
417
|
-
|
|
418
|
-
const [
|
|
419
|
-
this.St(t2, 4.5, 0.012 *
|
|
420
|
-
const
|
|
421
|
-
return s2.connect(
|
|
417
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
418
|
+
const [c2, r2] = this.wt(t2, "sawtooth", e2, 1.005, 0.6, s2);
|
|
419
|
+
this.St(t2, 4.5, 0.012 * e2, i2, 0.3, a2, c2.frequency).connect(r2.frequency);
|
|
420
|
+
const u2 = this._t(t2, "lowpass", e2 + 1200 + 1e3 * h2, e2 + 800, i2, n2 + o2);
|
|
421
|
+
return s2.connect(u2), this.rt(i2, a2, c2, r2), u2;
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
class x extends
|
|
424
|
+
class x extends w {
|
|
425
425
|
constructor() {
|
|
426
|
-
super(...arguments), this.
|
|
426
|
+
super(...arguments), this.Mt = { Tt: 0.5, xt: 0.1, Ut: 0.1 };
|
|
427
427
|
}
|
|
428
|
-
|
|
429
|
-
const
|
|
430
|
-
this.
|
|
431
|
-
const
|
|
432
|
-
this.
|
|
433
|
-
const
|
|
434
|
-
return this.
|
|
428
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
429
|
+
const c2 = this.nt(t2, "square", 0, s2);
|
|
430
|
+
this.ut(c2.frequency, 0.95 * e2, i2), this.dt(c2.frequency, e2, i2 + 0.05);
|
|
431
|
+
const r2 = this.O(t2, 0, s2);
|
|
432
|
+
this.ut(r2.gain, 0, i2), this.lt(r2.gain, Math.max(1e-3, 0.25 * h2), i2 + 0.05), this.dt(r2.gain, 1e-3, i2 + 0.2);
|
|
433
|
+
const u2 = this.nt(t2, "sawtooth", 2 * e2, r2), l2 = this.ot(t2, "lowpass");
|
|
434
|
+
return this.ut(l2.frequency, e2 + 400, i2), this.lt(l2.frequency, e2 + 1500 + 1e3 * h2, i2 + 0.1), this.dt(l2.frequency, e2 + 400, i2 + n2 + o2), s2.connect(l2), this.rt(i2, a2, c2), this.rt(i2, i2 + 0.2, u2), l2;
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
|
-
class
|
|
437
|
+
class k extends w {
|
|
438
438
|
constructor() {
|
|
439
|
-
super(...arguments), this.
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
const
|
|
443
|
-
this.
|
|
444
|
-
const
|
|
445
|
-
this.
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
const
|
|
449
|
-
return
|
|
439
|
+
super(...arguments), this.Mt = { Tt: 0.7, xt: 0.05, Ut: 0.1 };
|
|
440
|
+
}
|
|
441
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
442
|
+
const c2 = this.nt(t2, "sine", e2, s2), r2 = this.O(t2, 0, s2);
|
|
443
|
+
this.ut(r2.gain, 0.3, i2), this.dt(r2.gain, 0.05, i2 + 0.2);
|
|
444
|
+
const u2 = this.nt(t2, "triangle", e2, r2), l2 = this.ot(t2, "lowpass");
|
|
445
|
+
this.ut(l2.frequency, e2 + 800, i2);
|
|
446
|
+
const d2 = this.St(t2, 5.5, 0.015 * e2, i2, 0.4, a2, c2.frequency);
|
|
447
|
+
d2.connect(u2.frequency);
|
|
448
|
+
const p2 = this.O(t2, 1), y2 = this.O(t2, 0.15, p2.gain);
|
|
449
|
+
return d2.connect(y2), s2.connect(p2).connect(l2), this.rt(i2, a2, c2, u2), l2;
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
class
|
|
452
|
+
class V extends w {
|
|
453
453
|
constructor() {
|
|
454
|
-
super(...arguments), this.
|
|
454
|
+
super(...arguments), this.Mt = { Tt: 0.4, xt: 0.05, Ut: 0.1 };
|
|
455
455
|
}
|
|
456
|
-
|
|
457
|
-
const
|
|
458
|
-
this.
|
|
459
|
-
const
|
|
460
|
-
this.
|
|
456
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
457
|
+
const c2 = this.nt(t2, "sawtooth", 0);
|
|
458
|
+
this.ut(c2.frequency, e2, i2), this.St(t2, 5, 0.02 * e2, i2, 0.2, a2, c2.frequency);
|
|
459
|
+
const r2 = this._t(t2, "lowpass", e2, 3 * e2, i2, 0.05);
|
|
460
|
+
this.dt(r2.frequency, 1.5 * e2, i2 + n2), r2.Q.value = 3, c2.connect(r2).connect(s2), this.rt(i2, a2, c2);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
class
|
|
464
|
-
|
|
463
|
+
class A extends w {
|
|
464
|
+
bt(t2) {
|
|
465
465
|
return { v: 0.4, a: t2 < 0.4 ? 0.05 : 0.3, r: t2 < 0.4 ? 0.1 : 0.8 };
|
|
466
466
|
}
|
|
467
|
-
|
|
468
|
-
const [
|
|
469
|
-
return this.
|
|
467
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
468
|
+
const [c2, r2] = this.wt(t2, "triangle", e2, 1.01, 0.7, s2), u2 = this.ot(t2, "lowpass");
|
|
469
|
+
return this.ut(u2.frequency, e2 + 400, i2), this.lt(u2.frequency, e2 + 1e3 + 500 * h2, i2 + n2), this.St(t2, 0.5, 10, i2, 0, a2, r2.frequency), this.St(t2, 0.1, 400, i2, 0, a2, u2.frequency), s2.connect(u2), this.rt(i2, a2, c2, r2), u2;
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
class
|
|
473
|
-
l(t2, s2, i2,
|
|
474
|
-
const
|
|
475
|
-
this.
|
|
476
|
-
const
|
|
477
|
-
this.St(t2, 15, 0.5, i2, 0, i2 +
|
|
472
|
+
class g extends d {
|
|
473
|
+
l(t2, s2, i2, e2, h2, n2) {
|
|
474
|
+
const o2 = this.O(t2, 0), a2 = this.nt(t2, "sawtooth", 0, o2);
|
|
475
|
+
this.ut(a2.frequency, e2, i2), this.dt(a2.frequency, Math.max(1, e2 / 2), i2 + Math.max(0.05, h2));
|
|
476
|
+
const c2 = this.O(t2, 0.5, s2);
|
|
477
|
+
this.St(t2, 15, 0.5, i2, 0, i2 + h2 + 0.2, c2.gain), o2.connect(c2), this.ut(o2.gain, 0, i2), this.lt(o2.gain, Math.max(1e-3, 0.5 * n2), i2 + 0.05), this.dt(o2.gain, 1e-3, i2 + h2 + 0.2), this.rt(i2, i2 + h2 + 0.2, a2), this.ft(t2, i2, i2 + h2 + 0.3, o2, c2);
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
|
-
class
|
|
480
|
+
class D extends p {
|
|
481
481
|
constructor() {
|
|
482
|
-
super(...arguments), this.
|
|
482
|
+
super(...arguments), this.Mt = { Tt: 0.6, xt: 0.02, kt: 0.1, Vt: 4 };
|
|
483
483
|
}
|
|
484
|
-
|
|
485
|
-
const
|
|
486
|
-
this.
|
|
487
|
-
const
|
|
488
|
-
|
|
484
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
485
|
+
const c2 = this.nt(t2, "square", 0, i2);
|
|
486
|
+
this.ut(c2.frequency, 1.05 * h2, e2), this.dt(c2.frequency, h2, e2 + 0.08);
|
|
487
|
+
const r2 = this._t(t2, "bandpass", 2.5 * h2, h2, e2, o2);
|
|
488
|
+
r2.Q.value = 2, r2.connect(i2), this.rt(e2, a2, c2);
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
const
|
|
492
|
-
static
|
|
493
|
-
if (!
|
|
494
|
-
const s2 = 1 * t2.sampleRate, i2 = t2.createBuffer(1, s2, t2.sampleRate),
|
|
495
|
-
for (let t3 = 0; t3 < s2; t3++)
|
|
496
|
-
|
|
491
|
+
const _U = class _U extends d {
|
|
492
|
+
static Ft(t2) {
|
|
493
|
+
if (!_U.vt || _U.vt.sampleRate !== t2.sampleRate) {
|
|
494
|
+
const s2 = 1 * t2.sampleRate, i2 = t2.createBuffer(1, s2, t2.sampleRate), e2 = i2.getChannelData(0);
|
|
495
|
+
for (let t3 = 0; t3 < s2; t3++) e2[t3] = 2 * Math.random() - 1;
|
|
496
|
+
_U.vt = i2;
|
|
497
497
|
}
|
|
498
|
-
return
|
|
498
|
+
return _U.vt;
|
|
499
499
|
}
|
|
500
|
-
l(t2, s2, i2,
|
|
501
|
-
if (
|
|
502
|
-
const
|
|
503
|
-
this.
|
|
500
|
+
l(t2, s2, i2, e2, h2, n2) {
|
|
501
|
+
if (e2 < 70) {
|
|
502
|
+
const e3 = this.O(t2, 0, s2), h3 = this.nt(t2, "sine", 0, e3);
|
|
503
|
+
this.ut(h3.frequency, 150, i2), this.dt(h3.frequency, 30, i2 + 0.1), this.ut(e3.gain, Math.max(1e-3, 1.5 * n2), i2), this.dt(e3.gain, 1e-3, i2 + 0.5), this.rt(i2, i2 + 0.5, h3), this.ft(t2, i2, i2 + 0.6, e3);
|
|
504
504
|
} else {
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
const
|
|
508
|
-
if (
|
|
509
|
-
const s3 = this.
|
|
510
|
-
this.
|
|
511
|
-
} else this.
|
|
512
|
-
this.
|
|
505
|
+
const h3 = e2 < 90, o2 = t2.createBufferSource();
|
|
506
|
+
o2.buffer = _U.Ft(t2);
|
|
507
|
+
const a2 = this.O(t2, 0, s2), c2 = this.ot(t2, h3 ? "bandpass" : "highpass"), r2 = this.ct(t2, h3 ? 0 : 0.6 * Math.random() - 0.3);
|
|
508
|
+
if (c2.frequency.value = h3 ? 1500 : 5e3, this.ut(a2.gain, Math.max(1e-3, n2), i2), this.dt(a2.gain, 1e-3, i2 + (h3 ? 0.2 : 0.05)), o2.connect(c2).connect(a2).connect(r2), this.rt(i2, i2 + (h3 ? 0.2 : 0.05), o2), h3) {
|
|
509
|
+
const s3 = this.nt(t2, "triangle", 0, a2);
|
|
510
|
+
this.ut(s3.frequency, 300, i2), this.dt(s3.frequency, 100, i2 + 0.1), this.rt(i2, i2 + 0.2, s3);
|
|
511
|
+
} else this.yt(t2, "square", 7e3, r2, i2, Math.max(1e-3, 0.2 * n2), 0.05);
|
|
512
|
+
this.ft(t2, i2, i2 + 0.4, c2, a2, r2);
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
};
|
|
516
|
-
|
|
517
|
-
let
|
|
518
|
-
class
|
|
516
|
+
_U.vt = null;
|
|
517
|
+
let U = _U;
|
|
518
|
+
class b extends w {
|
|
519
519
|
constructor() {
|
|
520
|
-
super(...arguments), this.
|
|
520
|
+
super(...arguments), this.Mt = { Tt: 0.6, xt: 0.01, Ut: 0.1 };
|
|
521
521
|
}
|
|
522
|
-
|
|
523
|
-
const
|
|
524
|
-
this.
|
|
525
|
-
const
|
|
526
|
-
this.
|
|
522
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
523
|
+
const c2 = this.nt(t2, "sine", e2, s2), r2 = 2 * e2, u2 = 4 * r2, l2 = this.O(t2, 0, c2.frequency);
|
|
524
|
+
this.ut(l2.gain, u2 * h2, i2), this.dt(l2.gain, 0.01, i2 + n2);
|
|
525
|
+
const d2 = this.nt(t2, "sine", r2, l2);
|
|
526
|
+
this.rt(i2, a2, c2, d2);
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
|
-
class
|
|
529
|
+
class v extends p {
|
|
530
530
|
constructor() {
|
|
531
|
-
super(...arguments), this.
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
const
|
|
535
|
-
[1, 2.76, 5.4, 8.9, 13.3].forEach((s3,
|
|
536
|
-
const
|
|
537
|
-
if (
|
|
538
|
-
const s4 = Math.max(1e-3, n2 * (1 / (
|
|
539
|
-
this.
|
|
531
|
+
super(...arguments), this.Mt = { Tt: 0.6, xt: 5e-3, kt: 0.5, Vt: 5 };
|
|
532
|
+
}
|
|
533
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
534
|
+
const c2 = [1, 0.6, 0.4, 0.2, 0.1];
|
|
535
|
+
[1, 2.76, 5.4, 8.9, 13.3].forEach((s3, a3) => {
|
|
536
|
+
const r2 = h2 * s3;
|
|
537
|
+
if (r2 < 22e3) {
|
|
538
|
+
const s4 = Math.max(1e-3, n2 * (1 / (a3 + 1.5))), h3 = Math.max(0.1, o2 * c2[a3]);
|
|
539
|
+
this.yt(t2, "sine", r2, i2, e2, s4, h3, 5e-3);
|
|
540
540
|
}
|
|
541
541
|
});
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
class
|
|
545
|
-
l(t2, s2, i2,
|
|
546
|
-
const
|
|
547
|
-
for (let t3 = 0; t3 <
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
const u2 = t2.createDelay(
|
|
551
|
-
u2.delayTime.value =
|
|
552
|
-
const
|
|
553
|
-
|
|
554
|
-
const
|
|
555
|
-
|
|
556
|
-
const
|
|
557
|
-
this.
|
|
544
|
+
class F extends d {
|
|
545
|
+
l(t2, s2, i2, e2, h2, n2) {
|
|
546
|
+
const o2 = 1 / e2, a2 = t2.createBuffer(1, Math.max(1, t2.sampleRate * o2), t2.sampleRate), c2 = a2.getChannelData(0);
|
|
547
|
+
for (let t3 = 0; t3 < c2.length; t3++) c2[t3] = (2 * Math.random() - 1) * n2;
|
|
548
|
+
const r2 = t2.createBufferSource();
|
|
549
|
+
r2.buffer = a2;
|
|
550
|
+
const u2 = t2.createDelay(o2);
|
|
551
|
+
u2.delayTime.value = o2;
|
|
552
|
+
const l2 = this.ot(t2, "lowpass");
|
|
553
|
+
l2.frequency.value = Math.min(22e3, 6 * e2);
|
|
554
|
+
const d2 = this.O(t2, 0.98);
|
|
555
|
+
r2.connect(u2).connect(l2).connect(d2).connect(u2);
|
|
556
|
+
const p2 = this.O(t2, 0, s2);
|
|
557
|
+
this.ut(p2.gain, 1, i2), this.dt(p2.gain, 1e-3, i2 + h2), u2.connect(p2), this.rt(i2, i2 + h2, r2), this.ft(t2, i2, i2 + h2 + 3, p2, u2, l2, d2);
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
class
|
|
560
|
+
class R extends w {
|
|
561
561
|
constructor() {
|
|
562
|
-
super(...arguments), this.
|
|
562
|
+
super(...arguments), this.Mt = { Tt: 0.7, xt: 0.05, Ut: 0.2 };
|
|
563
563
|
}
|
|
564
|
-
|
|
565
|
-
const
|
|
566
|
-
this.
|
|
567
|
-
const [
|
|
568
|
-
|
|
564
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
565
|
+
const c2 = this.ot(t2, "lowpass");
|
|
566
|
+
this.ut(c2.frequency, 2 * e2, i2), this.St(t2, 6, 3 * e2, i2, 0, a2, c2.frequency);
|
|
567
|
+
const [r2, u2] = this.wt(t2, "sawtooth", e2 / 2, 1.015, 0.4, c2);
|
|
568
|
+
c2.connect(s2), this.rt(i2, a2, r2, u2);
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
class
|
|
571
|
+
class N extends w {
|
|
572
572
|
constructor() {
|
|
573
|
-
super(...arguments), this.
|
|
573
|
+
super(...arguments), this.Mt = { Tt: 0.8, xt: 0.1, Ut: 0.4 };
|
|
574
574
|
}
|
|
575
|
-
|
|
576
|
-
const
|
|
577
|
-
this.St(t2, 5, 0.015 *
|
|
575
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
576
|
+
const c2 = this.nt(t2, "sawtooth", e2);
|
|
577
|
+
this.St(t2, 5, 0.015 * e2, i2, 0.2, a2, c2.frequency), [730, 1090, 2440].forEach((i3) => {
|
|
578
578
|
if (i3 < 22e3) {
|
|
579
|
-
const
|
|
580
|
-
|
|
579
|
+
const e3 = this.ot(t2, "bandpass");
|
|
580
|
+
e3.frequency.value = i3, e3.Q.value = 12, c2.connect(e3).connect(s2);
|
|
581
581
|
}
|
|
582
|
-
}), this.
|
|
582
|
+
}), this.rt(i2, a2, c2);
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
|
-
class
|
|
585
|
+
class q extends w {
|
|
586
586
|
constructor() {
|
|
587
|
-
super(...arguments), this.
|
|
587
|
+
super(...arguments), this.Mt = { Tt: 0.4, xt: 5e-3, Ut: 0.05 };
|
|
588
588
|
}
|
|
589
|
-
|
|
590
|
-
const
|
|
591
|
-
this.
|
|
589
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
590
|
+
const c2 = this.nt(t2, "square", 0, s2);
|
|
591
|
+
this.ut(c2.frequency, 2 * e2, i2), this.ut(c2.frequency, e2, i2 + 0.02), this.rt(i2, a2, c2);
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
class
|
|
594
|
+
class O extends p {
|
|
595
595
|
constructor() {
|
|
596
|
-
super(...arguments), this.
|
|
596
|
+
super(...arguments), this.Mt = { Tt: 0.9, xt: 5e-3, kt: 0.15, Vt: 3 };
|
|
597
597
|
}
|
|
598
|
-
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
const
|
|
602
|
-
return this.
|
|
598
|
+
Dt(t2, s2, i2, e2, h2, n2, o2, a2) {
|
|
599
|
+
const c2 = this._t(t2, "lowpass", 8 * h2 + 3e3 * n2, h2 + 100, e2, 0.1);
|
|
600
|
+
c2.Q.value = 3;
|
|
601
|
+
const r2 = this.nt(t2, "sawtooth", h2, i2), u2 = this.nt(t2, "sine", h2 / 2, i2);
|
|
602
|
+
return this.yt(t2, "square", 3.5 * h2, c2, e2, Math.max(1e-3, 0.4 * n2), 0.04), i2.connect(c2), this.rt(e2, a2, r2, u2), c2;
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
const
|
|
606
|
-
class
|
|
605
|
+
const I = u([{ synth: new y(), start: 0, end: 7 }, { synth: new _(), start: 8, end: 15 }, { synth: new S(), start: 16, end: 23 }, { synth: new f(), start: 24, end: 26 }, { synth: new m(), start: 27, end: 31 }, { synth: new M(), start: 32, end: 39 }, { synth: new T(), start: 40, end: 55 }, { synth: new x(), start: 56, end: 71 }, { synth: new k(), start: 72, end: 79 }, { synth: new V(), start: 83, end: 87 }, { synth: new A(), start: 88, end: 95 }, { synth: new g(), start: 96, end: 103 }, { synth: new g(), start: 120, end: 127 }, { synth: new D(), start: 104, end: 111 }, { synth: new U(), start: 112, end: 119 }, { synth: new U(), start: 128, end: 128 }]), L = u([{ synth: new q(), start: 0, end: 127 }, { synth: new U(), start: 128, end: 128 }]);
|
|
606
|
+
class j extends h {
|
|
607
607
|
constructor(t2, s2) {
|
|
608
|
-
super(t2, s2 ||
|
|
608
|
+
super(t2, s2 || I);
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
|
-
class
|
|
611
|
+
class C extends o {
|
|
612
612
|
constructor(t2, s2) {
|
|
613
|
-
super(t2, s2 ||
|
|
613
|
+
super(t2, s2 || I);
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
class
|
|
616
|
+
class B extends a {
|
|
617
617
|
constructor(t2, s2) {
|
|
618
|
-
super(t2, s2 ||
|
|
618
|
+
super(t2, s2 || I);
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
621
|
export {
|
|
622
|
-
|
|
623
|
-
|
|
622
|
+
v as AdditiveSynth,
|
|
623
|
+
M as BassSynth,
|
|
624
624
|
x as BrassSynth,
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
625
|
+
q as ChiptuneSynth,
|
|
626
|
+
_ as ChromaticPercussionSynth,
|
|
627
|
+
U as DrumSynth,
|
|
628
|
+
m as ElectricGuitarSynth,
|
|
629
|
+
D as EthnicSynth,
|
|
630
|
+
b as FMSynth,
|
|
631
|
+
N as FormantSynth,
|
|
632
|
+
f as GuitarSynth,
|
|
633
|
+
F as KarplusSynth,
|
|
634
|
+
V as LeadSynth,
|
|
635
|
+
I as MasterInstrumentMap,
|
|
636
|
+
S as OrganSynth,
|
|
637
|
+
A as PadSynth,
|
|
638
638
|
y as PianoSynth,
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
639
|
+
j as RLOCore,
|
|
640
|
+
B as RLOGameEngine,
|
|
641
|
+
C as RLOMusicPlayer,
|
|
642
|
+
R as ReeseBassSynth,
|
|
643
|
+
L as RetroInstrumentMap,
|
|
644
|
+
c as SilentSynth,
|
|
645
|
+
O as SlapBassSynth,
|
|
646
|
+
g as SoundEffectsSynth,
|
|
647
|
+
I as StandardInstrumentMap,
|
|
648
|
+
T as StringSynth,
|
|
649
|
+
k as WoodwindSynth,
|
|
650
|
+
r as createDirectMap,
|
|
651
|
+
u as createInstrumentMap,
|
|
652
|
+
i as decodeBinary,
|
|
653
|
+
s as encodeToBinary,
|
|
654
|
+
t as encodeToSoA,
|
|
655
|
+
l as extendInstrumentMap
|
|
654
656
|
};
|
|
655
657
|
//# sourceMappingURL=rlo-engine.min.js.map
|