@marmooo/midy 0.1.6 → 0.1.7
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/esm/midy-GM1.d.ts +5 -4
- package/esm/midy-GM1.d.ts.map +1 -1
- package/esm/midy-GM1.js +45 -16
- package/esm/midy-GM2.d.ts +5 -2
- package/esm/midy-GM2.d.ts.map +1 -1
- package/esm/midy-GM2.js +176 -66
- package/esm/midy-GMLite.d.ts +5 -4
- package/esm/midy-GMLite.d.ts.map +1 -1
- package/esm/midy-GMLite.js +45 -16
- package/esm/midy.d.ts +5 -2
- package/esm/midy.d.ts.map +1 -1
- package/esm/midy.js +177 -67
- package/package.json +5 -1
- package/script/midy-GM1.d.ts +5 -4
- package/script/midy-GM1.d.ts.map +1 -1
- package/script/midy-GM1.js +48 -19
- package/script/midy-GM2.d.ts +5 -2
- package/script/midy-GM2.d.ts.map +1 -1
- package/script/midy-GM2.js +179 -69
- package/script/midy-GMLite.d.ts +5 -4
- package/script/midy-GMLite.d.ts.map +1 -1
- package/script/midy-GMLite.js +48 -19
- package/script/midy.d.ts +5 -2
- package/script/midy.d.ts.map +1 -1
- package/script/midy.js +180 -70
- package/esm/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.6/+esm.d.ts +0 -149
- package/esm/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.6/+esm.d.ts.map +0 -1
- package/esm/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.6/+esm.js +0 -180
- package/esm/deps/cdn.jsdelivr.net/npm/midi-file@1.2.4/+esm.d.ts +0 -84
- package/esm/deps/cdn.jsdelivr.net/npm/midi-file@1.2.4/+esm.d.ts.map +0 -1
- package/esm/deps/cdn.jsdelivr.net/npm/midi-file@1.2.4/+esm.js +0 -216
- package/script/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.6/+esm.d.ts +0 -149
- package/script/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.6/+esm.d.ts.map +0 -1
- package/script/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.6/+esm.js +0 -190
- package/script/deps/cdn.jsdelivr.net/npm/midi-file@1.2.4/+esm.d.ts +0 -84
- package/script/deps/cdn.jsdelivr.net/npm/midi-file@1.2.4/+esm.d.ts.map +0 -1
- package/script/deps/cdn.jsdelivr.net/npm/midi-file@1.2.4/+esm.js +0 -221
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.
|
|
3
|
-
* Original file: /npm/@marmooo/soundfont-parser@0.0.6/esm/mod.js
|
|
4
|
-
*
|
|
5
|
-
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
|
6
|
-
*/
|
|
7
|
-
class e {
|
|
8
|
-
constructor(e, t) { Object.defineProperty(this, "data", { enumerable: !0, configurable: !0, writable: !0, value: e }), Object.defineProperty(this, "offset", { enumerable: !0, configurable: !0, writable: !0, value: t }); }
|
|
9
|
-
readString(e) { const t = this.data.subarray(this.offset, this.offset += e), n = String.fromCharCode(...Array.from(t)), r = n.indexOf("\0"); return r > 0 ? n.substring(0, r) : n; }
|
|
10
|
-
readWORD() { return this.data[this.offset++] | this.data[this.offset++] << 8; }
|
|
11
|
-
readDWORD(e = !1) { return e ? (this.data[this.offset++] << 24 | this.data[this.offset++] << 16 | this.data[this.offset++] << 8 | this.data[this.offset++]) >>> 0 : (this.data[this.offset++] | this.data[this.offset++] << 8 | this.data[this.offset++] << 16 | this.data[this.offset++] << 24) >>> 0; }
|
|
12
|
-
readByte() { return this.data[this.offset++]; }
|
|
13
|
-
readAt(e) { return this.data[this.offset + e]; }
|
|
14
|
-
readUInt8() { return this.readByte(); }
|
|
15
|
-
readInt8() { return this.readByte() << 24 >> 24; }
|
|
16
|
-
readUInt16() { return this.readWORD(); }
|
|
17
|
-
readInt16() { return this.readWORD() << 16 >> 16; }
|
|
18
|
-
readUInt32() { return this.readDWORD(); }
|
|
19
|
-
}
|
|
20
|
-
function t(t, n, a) { const o = new e(t, n), s = o.readString(4), i = o.readDWORD(a); return new r(s, i, o.offset); }
|
|
21
|
-
function n(e, n = 0, r, { padding: a = !0, bigEndian: o = !1 } = {}) { const s = [], i = r + n; let l = n; for (; l < i;) {
|
|
22
|
-
const r = t(e, l, o);
|
|
23
|
-
l = r.offset + r.size, a && 1 == (l - n & 1) && l++, s.push(r);
|
|
24
|
-
} return s; }
|
|
25
|
-
class r {
|
|
26
|
-
constructor(e, t, n) { Object.defineProperty(this, "type", { enumerable: !0, configurable: !0, writable: !0, value: e }), Object.defineProperty(this, "size", { enumerable: !0, configurable: !0, writable: !0, value: t }), Object.defineProperty(this, "offset", { enumerable: !0, configurable: !0, writable: !0, value: n }); }
|
|
27
|
-
}
|
|
28
|
-
const a = ["startAddrsOffset", "endAddrsOffset", "startloopAddrsOffset", "endloopAddrsOffset", "startAddrsCoarseOffset", "modLfoToPitch", "vibLfoToPitch", "modEnvToPitch", "initialFilterFc", "initialFilterQ", "modLfoToFilterFc", "modEnvToFilterFc", "endAddrsCoarseOffset", "modLfoToVolume", void 0, "chorusEffectsSend", "reverbEffectsSend", "pan", void 0, void 0, void 0, "delayModLFO", "freqModLFO", "delayVibLFO", "freqVibLFO", "delayModEnv", "attackModEnv", "holdModEnv", "decayModEnv", "sustainModEnv", "releaseModEnv", "keynumToModEnvHold", "keynumToModEnvDecay", "delayVolEnv", "attackVolEnv", "holdVolEnv", "decayVolEnv", "sustainVolEnv", "releaseVolEnv", "keynumToVolEnvHold", "keynumToVolEnvDecay", "instrument", void 0, "keyRange", "velRange", "startloopAddrsCoarseOffset", "keynum", "velocity", "initialAttenuation", void 0, "endloopAddrsCoarseOffset", "coarseTune", "fineTune", "sampleID", "sampleModes", void 0, "scaleTuning", "exclusiveClass", "overridingRootKey"];
|
|
29
|
-
class o {
|
|
30
|
-
constructor(e, t) { Object.defineProperty(this, "major", { enumerable: !0, configurable: !0, writable: !0, value: e }), Object.defineProperty(this, "minor", { enumerable: !0, configurable: !0, writable: !0, value: t }); }
|
|
31
|
-
static parse(e) { const t = e.readInt8(), n = e.readInt8(); return new o(t, n); }
|
|
32
|
-
}
|
|
33
|
-
class s {
|
|
34
|
-
constructor(e, t, n, r, a, o, s, i, l, d, u) { Object.defineProperty(this, "comment", { enumerable: !0, configurable: !0, writable: !0, value: e }), Object.defineProperty(this, "copyright", { enumerable: !0, configurable: !0, writable: !0, value: t }), Object.defineProperty(this, "creationDate", { enumerable: !0, configurable: !0, writable: !0, value: n }), Object.defineProperty(this, "engineer", { enumerable: !0, configurable: !0, writable: !0, value: r }), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: a }), Object.defineProperty(this, "product", { enumerable: !0, configurable: !0, writable: !0, value: o }), Object.defineProperty(this, "software", { enumerable: !0, configurable: !0, writable: !0, value: s }), Object.defineProperty(this, "version", { enumerable: !0, configurable: !0, writable: !0, value: i }), Object.defineProperty(this, "soundEngine", { enumerable: !0, configurable: !0, writable: !0, value: l }), Object.defineProperty(this, "romName", { enumerable: !0, configurable: !0, writable: !0, value: d }), Object.defineProperty(this, "romVersion", { enumerable: !0, configurable: !0, writable: !0, value: u }); }
|
|
35
|
-
static parse(t, n) { function r(e) { for (let t = 0; t < n.length; t++)
|
|
36
|
-
if (n[t].type === e)
|
|
37
|
-
return n[t]; } function a(n) { return new e(t, n.offset); } function i(e) { const t = r(e); return t ? a(t).readString(t.size) : null; } function l(e) { const t = r(e); return t ? o.parse(a(t)) : null; } const d = i("ICMT"), u = i("ICOP"), f = i("ICRD"), c = i("IENG"), b = i("INAM"), m = i("IPRD"), p = i("ISFT"), h = l("ifil"), v = i("isng"), g = i("irom"), w = l("iver"); return new s(d, u, f, c, b, m, p, h, v, g, w); }
|
|
38
|
-
}
|
|
39
|
-
class i {
|
|
40
|
-
constructor(e, t) { Object.defineProperty(this, "generatorIndex", { enumerable: !0, configurable: !0, writable: !0, value: e }), Object.defineProperty(this, "modulatorIndex", { enumerable: !0, configurable: !0, writable: !0, value: t }); }
|
|
41
|
-
static parse(e) { const t = e.readWORD(), n = e.readWORD(); return new i(t, n); }
|
|
42
|
-
}
|
|
43
|
-
class l {
|
|
44
|
-
constructor(e, t, n, r, a, o, s) { Object.defineProperty(this, "presetName", { enumerable: !0, configurable: !0, writable: !0, value: e }), Object.defineProperty(this, "preset", { enumerable: !0, configurable: !0, writable: !0, value: t }), Object.defineProperty(this, "bank", { enumerable: !0, configurable: !0, writable: !0, value: n }), Object.defineProperty(this, "presetBagIndex", { enumerable: !0, configurable: !0, writable: !0, value: r }), Object.defineProperty(this, "library", { enumerable: !0, configurable: !0, writable: !0, value: a }), Object.defineProperty(this, "genre", { enumerable: !0, configurable: !0, writable: !0, value: o }), Object.defineProperty(this, "morphology", { enumerable: !0, configurable: !0, writable: !0, value: s }); }
|
|
45
|
-
get isEnd() { return "EOP" === this.presetName; }
|
|
46
|
-
static parse(e) { const t = e.readString(20), n = e.readWORD(), r = e.readWORD(), a = e.readWORD(), o = e.readDWORD(), s = e.readDWORD(), i = e.readDWORD(); return new l(t, n, r, a, o, s, i); }
|
|
47
|
-
}
|
|
48
|
-
class d {
|
|
49
|
-
constructor(e, t) { Object.defineProperty(this, "lo", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), Object.defineProperty(this, "hi", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), this.lo = e, this.hi = t; }
|
|
50
|
-
in(e) { return this.lo <= e && e <= this.hi; }
|
|
51
|
-
static parse(e) { const t = e.readByte(), n = e.readByte(); return new d(t, n); }
|
|
52
|
-
}
|
|
53
|
-
class u {
|
|
54
|
-
constructor(e, t, n, r, a) { Object.defineProperty(this, "sourceOper", { enumerable: !0, configurable: !0, writable: !0, value: e }), Object.defineProperty(this, "destinationOper", { enumerable: !0, configurable: !0, writable: !0, value: t }), Object.defineProperty(this, "value", { enumerable: !0, configurable: !0, writable: !0, value: n }), Object.defineProperty(this, "amountSourceOper", { enumerable: !0, configurable: !0, writable: !0, value: r }), Object.defineProperty(this, "transOper", { enumerable: !0, configurable: !0, writable: !0, value: a }); }
|
|
55
|
-
get isEnd() { return 0 === this.sourceOper && 0 === this.destinationOper && 0 === this.value && 0 === this.amountSourceOper && 0 === this.transOper; }
|
|
56
|
-
static parse(e) { const t = e.readWORD(), n = e.readWORD(), r = e.readInt16(), a = e.readWORD(), o = e.readWORD(); return new u(t, n, r, a, o); }
|
|
57
|
-
}
|
|
58
|
-
class f {
|
|
59
|
-
constructor(e, t) { Object.defineProperty(this, "code", { enumerable: !0, configurable: !0, writable: !0, value: e }), Object.defineProperty(this, "value", { enumerable: !0, configurable: !0, writable: !0, value: t }); }
|
|
60
|
-
get type() { return a[this.code]; }
|
|
61
|
-
get isEnd() { return 0 === this.code && 0 === this.value; }
|
|
62
|
-
static parse(e) { const t = e.readWORD(); let n; switch (a[t]) {
|
|
63
|
-
case "keyRange":
|
|
64
|
-
case "velRange":
|
|
65
|
-
n = d.parse(e);
|
|
66
|
-
break;
|
|
67
|
-
default: n = e.readInt16();
|
|
68
|
-
} return new f(t, n); }
|
|
69
|
-
}
|
|
70
|
-
class c {
|
|
71
|
-
constructor() { Object.defineProperty(this, "instrumentName", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), Object.defineProperty(this, "instrumentBagIndex", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }); }
|
|
72
|
-
get isEnd() { return "EOI" === this.instrumentName; }
|
|
73
|
-
static parse(e) { const t = new c; return t.instrumentName = e.readString(20), t.instrumentBagIndex = e.readWORD(), t; }
|
|
74
|
-
}
|
|
75
|
-
class b {
|
|
76
|
-
constructor(e, t, n, r, a, o, s, i, l, d) { Object.defineProperty(this, "sampleName", { enumerable: !0, configurable: !0, writable: !0, value: e }), Object.defineProperty(this, "start", { enumerable: !0, configurable: !0, writable: !0, value: t }), Object.defineProperty(this, "end", { enumerable: !0, configurable: !0, writable: !0, value: n }), Object.defineProperty(this, "loopStart", { enumerable: !0, configurable: !0, writable: !0, value: r }), Object.defineProperty(this, "loopEnd", { enumerable: !0, configurable: !0, writable: !0, value: a }), Object.defineProperty(this, "sampleRate", { enumerable: !0, configurable: !0, writable: !0, value: o }), Object.defineProperty(this, "originalPitch", { enumerable: !0, configurable: !0, writable: !0, value: s }), Object.defineProperty(this, "pitchCorrection", { enumerable: !0, configurable: !0, writable: !0, value: i }), Object.defineProperty(this, "sampleLink", { enumerable: !0, configurable: !0, writable: !0, value: l }), Object.defineProperty(this, "sampleType", { enumerable: !0, configurable: !0, writable: !0, value: d }); }
|
|
77
|
-
get isEnd() { return "EOS" === this.sampleName; }
|
|
78
|
-
static parse(e, t) { const n = e.readString(20), r = e.readDWORD(), a = e.readDWORD(); let o = e.readDWORD(), s = e.readDWORD(); const i = e.readDWORD(), l = e.readByte(), d = e.readInt8(), u = e.readWORD(), f = e.readWORD(); return t || (o -= r, s -= r), new b(n, r, a, o, s, i, l, d, u, f); }
|
|
79
|
-
}
|
|
80
|
-
class m {
|
|
81
|
-
constructor(e, t, n) { Object.defineProperty(this, "min", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), Object.defineProperty(this, "max", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), Object.defineProperty(this, "value", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), this.min = e, this.value = t, this.max = n; }
|
|
82
|
-
clamp() { return Math.max(this.min, Math.min(this.value, this.max)); }
|
|
83
|
-
}
|
|
84
|
-
function p(e, r = {}) { const a = n(e, 0, e.length, r); if (1 !== a.length)
|
|
85
|
-
throw new Error("wrong chunk length"); const o = a[0]; if (null === o)
|
|
86
|
-
throw new Error("chunk not found"); function i(e, t, n) { const r = h(e, t, "LIST", "pdta"); if (9 !== r.length)
|
|
87
|
-
throw new Error("invalid pdta chunk"); return { presetHeaders: w(r[0], t), presetZone: y(r[1], t), presetModulators: P(r[2], t), presetGenerators: R(r[3], t), instruments: O(r[4], t), instrumentZone: E(r[5], t), instrumentModulators: D(r[6], t), instrumentGenerators: j(r[7], t), sampleHeaders: k(r[8], t, n) }; } const l = function (e, n, r = {}) { const a = h(e, n, "RIFF", "sfbk", r); if (3 !== a.length)
|
|
88
|
-
throw new Error("invalid sfbk structure"); const o = function (e, t) { const n = h(e, t, "LIST", "INFO"); return s.parse(t, n); }(a[0], n), l = 3 === o.version.major; return l && "LIST" !== a[2].type && (a[2] = t(n, a[2].offset - 9, !1)), { info: o, samplingData: v(a[1], n), ...i(a[2], n, l) }; }(o, e, r), d = 3 === l.info.version.major; return { ...l, samples: T(l.sampleHeaders, l.samplingData.offsetMSB, l.samplingData.offsetLSB, e, d) }; }
|
|
89
|
-
function h(t, r, a, o, s = {}) { if (t.type !== a)
|
|
90
|
-
throw new Error("invalid chunk type:" + t.type); const i = new e(r, t.offset), l = i.readString(4); if (l !== o)
|
|
91
|
-
throw new Error("invalid signature:" + l); return n(r, i.offset, t.size - 4, s); }
|
|
92
|
-
function v(e, t) { const n = h(e, t, "LIST", "sdta"); return { offsetMSB: n[0].offset, offsetLSB: n[1]?.offset }; }
|
|
93
|
-
function g(t, n, r, a, o, s) { const i = []; if (t.type !== r)
|
|
94
|
-
throw new Error("invalid chunk type:" + t.type); const l = new e(n, t.offset), d = t.offset + t.size; for (; l.offset < d;) {
|
|
95
|
-
const e = a.parse(l, s);
|
|
96
|
-
if (o && o(e))
|
|
97
|
-
break;
|
|
98
|
-
i.push(e);
|
|
99
|
-
} return i; }
|
|
100
|
-
const w = (e, t) => g(e, t, "phdr", l, (e => e.isEnd)), y = (e, t) => g(e, t, "pbag", i), O = (e, t) => g(e, t, "inst", c, (e => e.isEnd)), E = (e, t) => g(e, t, "ibag", i), P = (e, t) => g(e, t, "pmod", u, (e => e.isEnd)), D = (e, t) => g(e, t, "imod", u, (e => e.isEnd)), R = (e, t) => g(e, t, "pgen", f, (e => e.isEnd)), j = (e, t) => g(e, t, "igen", f), k = (e, t, n) => g(e, t, "shdr", b, (e => e.isEnd), n);
|
|
101
|
-
function T(e, t, n, r, a) { return e.map((e => { let { start: n, end: o } = e; return a || (n *= 2, o *= 2), new Uint8Array(r.subarray(t + n, t + o)); })); }
|
|
102
|
-
const I = new Map(a.map(((e, t) => [e, t]))), M = ["keyRange", "velRange"], F = new Set(["startAddrsOffset", "endAddrsOffset", "startloopAddrsOffset", "endloopAddrsOffset", "startAddrsCoarseOffset", "endAddrsCoarseOffset", "startloopAddrsCoarseOffset", "endloopAddrsCoarseOffset", "sampleModes", "exclusiveClass", "overridingRootKey", "keynum", "velocity"].map((e => I.get(e)))), A = [["keynum", "keyRange"], ["velocity", "velRange"]];
|
|
103
|
-
function L(e) { return M.includes(e); }
|
|
104
|
-
function V(e) { const t = {}; for (let n = 0; n < e.length; n++) {
|
|
105
|
-
const r = e[n], a = r.type;
|
|
106
|
-
if (void 0 !== a && !F.has(r.code))
|
|
107
|
-
if (L(a))
|
|
108
|
-
t[a] = r.value;
|
|
109
|
-
else {
|
|
110
|
-
const e = a, n = W[e];
|
|
111
|
-
t[e] = new m(n.min, r.value, n.max);
|
|
112
|
-
}
|
|
113
|
-
} return t; }
|
|
114
|
-
function S(e) { const t = {}; for (let n = 0; n < e.length; n++) {
|
|
115
|
-
const r = e[n], a = r.type;
|
|
116
|
-
if (void 0 !== a)
|
|
117
|
-
if (L(a))
|
|
118
|
-
t[a] = r.value;
|
|
119
|
-
else {
|
|
120
|
-
const e = a, n = W[e];
|
|
121
|
-
t[e] = new m(n.min, r.value, n.max);
|
|
122
|
-
}
|
|
123
|
-
} for (let e = 0; e < A.length; e++) {
|
|
124
|
-
const [n, r] = A[e], a = t[n];
|
|
125
|
-
a instanceof m && 0 <= a.value && (t[r] = new d(a.value, a.value));
|
|
126
|
-
} return t; }
|
|
127
|
-
const C = -32768, x = 32767, W = { startAddrsOffset: new m(0, 0, x), endAddrsOffset: new m(C, 0, 0), startloopAddrsOffset: new m(C, 0, x), endloopAddrsOffset: new m(C, 0, x), startAddrsCoarseOffset: new m(0, 0, x), modLfoToPitch: new m(-12e3, 0, 12e3), vibLfoToPitch: new m(-12e3, 0, 12e3), modEnvToPitch: new m(-12e3, 0, 12e3), initialFilterFc: new m(1500, 13500, 13500), initialFilterQ: new m(0, 0, 960), modLfoToFilterFc: new m(-12e3, 0, 12e3), modEnvToFilterFc: new m(-12e3, 0, 12e3), endAddrsCoarseOffset: new m(C, 0, 0), modLfoToVolume: new m(-960, 0, 960), chorusEffectsSend: new m(0, 0, 1e3), reverbEffectsSend: new m(0, 0, 1e3), pan: new m(-500, 0, 500), delayModLFO: new m(-12e3, -12e3, 5e3), freqModLFO: new m(-16e3, 0, 4500), delayVibLFO: new m(-12e3, -12e3, 5e3), freqVibLFO: new m(-16e3, 0, 4500), delayModEnv: new m(-12e3, -12e3, 5e3), attackModEnv: new m(-12e3, -12e3, 8e3), holdModEnv: new m(-12e3, -12e3, 5e3), decayModEnv: new m(-12e3, -12e3, 8e3), sustainModEnv: new m(0, 0, 1e3), releaseModEnv: new m(-12e3, -12e3, 8e3), keynumToModEnvHold: new m(-1200, 0, 1200), keynumToModEnvDecay: new m(-1200, 0, 1200), delayVolEnv: new m(-12e3, -12e3, 5e3), attackVolEnv: new m(-12e3, -12e3, 8e3), holdVolEnv: new m(-12e3, -12e3, 5e3), decayVolEnv: new m(-12e3, -12e3, 8e3), sustainVolEnv: new m(0, 0, 1440), releaseVolEnv: new m(-12e3, -12e3, 8e3), keynumToVolEnvHold: new m(-1200, 0, 1200), keynumToVolEnvDecay: new m(-1200, 0, 1200), instrument: new m(-1, -1, x), keyRange: new d(0, 127), velRange: new d(0, 127), startloopAddrsCoarseOffset: new m(C, 0, x), keynum: new m(-1, -1, 127), velocity: new m(-1, -1, 127), initialAttenuation: new m(0, 0, 1440), endloopAddrsCoarseOffset: new m(C, 0, x), coarseTune: new m(-120, 0, 120), fineTune: new m(-99, 0, 99), sampleID: new m(-1, -1, x), sampleModes: new m(0, 0, 3), scaleTuning: new m(0, 100, 100), exclusiveClass: new m(0, 0, 127), overridingRootKey: new m(-1, -1, 127) };
|
|
128
|
-
class B {
|
|
129
|
-
constructor(e) { Object.defineProperty(this, "parsed", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), this.parsed = e; }
|
|
130
|
-
getGenerators(e, t, n, r) { const a = new Array(r - n); for (let o = n; o < r; o++) {
|
|
131
|
-
const r = t[o].generatorIndex, s = t[o + 1].generatorIndex;
|
|
132
|
-
a[o - n] = e.slice(r, s);
|
|
133
|
-
} return a; }
|
|
134
|
-
getPresetGenerators(e) { const t = this.parsed.presetHeaders[e], n = this.parsed.presetHeaders[e + 1], r = n ? n.presetBagIndex : this.parsed.presetZone.length - 1; return this.getGenerators(this.parsed.presetGenerators, this.parsed.presetZone, t.presetBagIndex, r); }
|
|
135
|
-
getInstrumentGenerators(e) { const t = this.parsed.instruments[e], n = this.parsed.instruments[e + 1], r = n ? n.instrumentBagIndex : this.parsed.instrumentZone.length - 1; return this.getGenerators(this.parsed.instrumentGenerators, this.parsed.instrumentZone, t.instrumentBagIndex, r); }
|
|
136
|
-
findInstrumentZone(e, t, n) { const r = this.getInstrumentGenerators(e); let a; for (let e = 0; e < r.length; e++) {
|
|
137
|
-
const o = S(r[e]);
|
|
138
|
-
if (void 0 !== o.sampleID) {
|
|
139
|
-
if ((!o.keyRange || o.keyRange.in(t)) && (!o.velRange || o.velRange.in(n)))
|
|
140
|
-
return a ? { ...a, ...o } : o;
|
|
141
|
-
}
|
|
142
|
-
else
|
|
143
|
-
a = o;
|
|
144
|
-
} }
|
|
145
|
-
findInstrument(e, t, n) { const r = this.getPresetGenerators(e); let a; for (let e = 0; e < r.length; e++) {
|
|
146
|
-
const o = V(r[e]);
|
|
147
|
-
if (void 0 === o.instrument) {
|
|
148
|
-
a = o;
|
|
149
|
-
continue;
|
|
150
|
-
}
|
|
151
|
-
if (o.keyRange && !o.keyRange.in(t))
|
|
152
|
-
continue;
|
|
153
|
-
if (o.velRange && !o.velRange.in(n))
|
|
154
|
-
continue;
|
|
155
|
-
const s = this.findInstrumentZone(o.instrument.value, t, n);
|
|
156
|
-
if (s)
|
|
157
|
-
return a ? this.getInstrument({ ...a, ...o }, s) : this.getInstrument(o, s);
|
|
158
|
-
} return null; }
|
|
159
|
-
getInstrument(e, t) { const n = { ...W, ...t }, r = Object.keys(e); for (let t = 0; t < r.length; t++) {
|
|
160
|
-
const a = r[t];
|
|
161
|
-
if (L(a))
|
|
162
|
-
continue;
|
|
163
|
-
const o = n[a], s = e[a];
|
|
164
|
-
n[a] = new m(o.min, o.value + s.value, o.max);
|
|
165
|
-
} return n; }
|
|
166
|
-
getInstrumentKey(e, t, n, r) { const a = this.parsed.presetHeaders.findIndex((n => n.preset === t && n.bank === e)); if (a < 0)
|
|
167
|
-
return console.warn("preset not found: bank=%s instrument=%s", e, t), null; const o = this.findInstrument(a, n, r); if (!o)
|
|
168
|
-
return console.warn("instrument not found: bank=%s instrument=%s", e, t), null; const s = {}, i = Object.keys(o); for (let e = 0; e < i.length; e++) {
|
|
169
|
-
const t = i[e];
|
|
170
|
-
L(t) ? s[t] = o[t] : s[t] = o[t].clamp();
|
|
171
|
-
} const l = H(s.holdModEnv + (n - 60) * s.keynumToModEnvHold), d = H(s.decayModEnv + (n - 60) * s.keynumToModEnvDecay), u = H(s.holdVolEnv + (n - 60) * s.keynumToVolEnvHold), f = H(s.decayVolEnv + (n - 60) * s.keynumToVolEnvDecay), c = this.parsed.samples[s.sampleID], b = this.parsed.sampleHeaders[s.sampleID], m = s.coarseTune + s.fineTune / 100, p = -1 === s.overridingRootKey ? b.originalPitch : s.overridingRootKey, h = m + b.pitchCorrection / 100 - p, v = s.scaleTuning / 100; return { start: 32768 * s.startAddrsCoarseOffset + s.startAddrsOffset, end: 32768 * s.endAddrsCoarseOffset + s.endAddrsOffset, loopStart: b.loopStart + 32768 * s.startloopAddrsCoarseOffset + s.startloopAddrsOffset, loopEnd: b.loopEnd + 32768 * s.endloopAddrsCoarseOffset + s.endloopAddrsOffset, modLfoToPitch: s.modLfoToPitch, vibLfoToPitch: s.vibLfoToPitch, modEnvToPitch: s.modEnvToPitch, initialFilterFc: s.initialFilterFc, initialFilterQ: s.initialFilterQ, modLfoToFilterFc: s.modLfoToFilterFc, modEnvToFilterFc: s.modEnvToFilterFc, modLfoToVolume: s.modLfoToVolume, chorusEffectsSend: s.chorusEffectsSend / 1e3, reverbEffectsSend: s.reverbEffectsSend / 1e3, pan: s.pan, delayModLFO: H(s.delayModLFO), freqModLFO: s.freqModLFO, delayVibLFO: H(s.delayVibLFO), freqVibLFO: s.freqVibLFO, modDelay: H(s.delayModEnv), modAttack: H(s.attackModEnv), modHold: l, modDecay: d, modSustain: s.sustainModEnv / 1e3, modRelease: H(s.releaseModEnv), volDelay: H(s.delayVolEnv), volAttack: H(s.attackVolEnv), volHold: u, volDecay: f, volSustain: s.sustainVolEnv / 1e3, volRelease: H(s.releaseVolEnv), initialAttenuation: s.initialAttenuation, playbackRate: e => Math.pow(Math.pow(2, 1 / 12), (e + h) * v), sample: c, sampleRate: b.sampleRate, sampleName: b.sampleName, sampleModes: s.sampleModes, exclusiveClass: s.exclusiveClass }; }
|
|
172
|
-
getPresetNames() { const e = {}, t = this.parsed.presetHeaders; for (let n = 0; n < t.length; n++) {
|
|
173
|
-
const r = t[n];
|
|
174
|
-
e[r.bank] || (e[r.bank] = {}), e[r.bank][r.preset] = r.presetName;
|
|
175
|
-
} return e; }
|
|
176
|
-
}
|
|
177
|
-
function H(e) { return Math.pow(2, e / 1200); }
|
|
178
|
-
export { M as RangeGeneratorNames, B as SoundFont, S as createInstrumentGeneratorObject, V as createPresetGeneratorObject, W as defaultInstrumentZone, L as isRangeGenerator, p as parse, H as timecentToSecond };
|
|
179
|
-
export default null;
|
|
180
|
-
//# sourceMappingURL=/sm/2fff1026e5ca926c33bde270b79b6c4b0445a8dd5401fdf4af3e7cae85b156e4.map
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
declare namespace t {
|
|
2
|
-
export { n as parseMidi };
|
|
3
|
-
export { s as writeMidi };
|
|
4
|
-
}
|
|
5
|
-
declare function I(t: any): {
|
|
6
|
-
header: {
|
|
7
|
-
format: any;
|
|
8
|
-
numTracks: any;
|
|
9
|
-
};
|
|
10
|
-
tracks: {
|
|
11
|
-
deltaTime: any;
|
|
12
|
-
type: string;
|
|
13
|
-
data: any;
|
|
14
|
-
meta: boolean;
|
|
15
|
-
number: any;
|
|
16
|
-
text: string;
|
|
17
|
-
channel: any;
|
|
18
|
-
port: any;
|
|
19
|
-
microsecondsPerBeat: any;
|
|
20
|
-
frameRate: number | undefined;
|
|
21
|
-
hour: number;
|
|
22
|
-
min: any;
|
|
23
|
-
sec: any;
|
|
24
|
-
frame: any;
|
|
25
|
-
subFrame: any;
|
|
26
|
-
numerator: any;
|
|
27
|
-
denominator: number;
|
|
28
|
-
metronome: any;
|
|
29
|
-
thirtyseconds: any;
|
|
30
|
-
key: any;
|
|
31
|
-
scale: any;
|
|
32
|
-
metatypeByte: any;
|
|
33
|
-
running: boolean;
|
|
34
|
-
noteNumber: any;
|
|
35
|
-
velocity: any;
|
|
36
|
-
byte9: boolean;
|
|
37
|
-
amount: any;
|
|
38
|
-
controllerType: any;
|
|
39
|
-
value: any;
|
|
40
|
-
programNumber: any;
|
|
41
|
-
}[][];
|
|
42
|
-
};
|
|
43
|
-
declare function c(t: any, e: any): any[];
|
|
44
|
-
declare function n(t: any): {
|
|
45
|
-
header: {
|
|
46
|
-
format: any;
|
|
47
|
-
numTracks: any;
|
|
48
|
-
};
|
|
49
|
-
tracks: {
|
|
50
|
-
deltaTime: any;
|
|
51
|
-
type: string;
|
|
52
|
-
data: any;
|
|
53
|
-
meta: boolean;
|
|
54
|
-
number: any;
|
|
55
|
-
text: string;
|
|
56
|
-
channel: any;
|
|
57
|
-
port: any;
|
|
58
|
-
microsecondsPerBeat: any;
|
|
59
|
-
frameRate: number | undefined;
|
|
60
|
-
hour: number;
|
|
61
|
-
min: any;
|
|
62
|
-
sec: any;
|
|
63
|
-
frame: any;
|
|
64
|
-
subFrame: any;
|
|
65
|
-
numerator: any;
|
|
66
|
-
denominator: number;
|
|
67
|
-
metronome: any;
|
|
68
|
-
thirtyseconds: any;
|
|
69
|
-
key: any;
|
|
70
|
-
scale: any;
|
|
71
|
-
metatypeByte: any;
|
|
72
|
-
running: boolean;
|
|
73
|
-
noteNumber: any;
|
|
74
|
-
velocity: any;
|
|
75
|
-
byte9: boolean;
|
|
76
|
-
amount: any;
|
|
77
|
-
controllerType: any;
|
|
78
|
-
value: any;
|
|
79
|
-
programNumber: any;
|
|
80
|
-
}[][];
|
|
81
|
-
};
|
|
82
|
-
declare function s(t: any, e: any): any[];
|
|
83
|
-
export { t as default, I as parseMidi, c as writeMidi };
|
|
84
|
-
//# sourceMappingURL=+esm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"+esm.d.ts","sourceRoot":"","sources":["../../../../../src/deps/cdn.jsdelivr.net/npm/midi-file@1.2.4/+esm.js"],"names":[],"mappings":";;;;AAMosI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAggB;AAAm6I,0CAAugB;AAA16K;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAggB;AAAm6I,0CAAugB"}
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
|
|
3
|
-
* Original file: /npm/midi-file@1.2.4/index.js
|
|
4
|
-
*
|
|
5
|
-
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
|
6
|
-
*/
|
|
7
|
-
var t = {};
|
|
8
|
-
function e(t) { for (var e, n = new r(t), i = []; !n.eof();) {
|
|
9
|
-
var a = o();
|
|
10
|
-
i.push(a);
|
|
11
|
-
} return i; function o() { var t = {}; t.deltaTime = n.readVarInt(); var r = n.readUInt8(); if (240 == (240 & r)) {
|
|
12
|
-
if (255 !== r) {
|
|
13
|
-
if (240 == r) {
|
|
14
|
-
t.type = "sysEx";
|
|
15
|
-
a = n.readVarInt();
|
|
16
|
-
return t.data = n.readBytes(a), t;
|
|
17
|
-
}
|
|
18
|
-
if (247 == r) {
|
|
19
|
-
t.type = "endSysEx";
|
|
20
|
-
a = n.readVarInt();
|
|
21
|
-
return t.data = n.readBytes(a), t;
|
|
22
|
-
}
|
|
23
|
-
throw "Unrecognised MIDI event type byte: " + r;
|
|
24
|
-
}
|
|
25
|
-
t.meta = !0;
|
|
26
|
-
var i = n.readUInt8(), a = n.readVarInt();
|
|
27
|
-
switch (i) {
|
|
28
|
-
case 0:
|
|
29
|
-
if (t.type = "sequenceNumber", 2 !== a)
|
|
30
|
-
throw "Expected length for sequenceNumber event is 2, got " + a;
|
|
31
|
-
return t.number = n.readUInt16(), t;
|
|
32
|
-
case 1: return t.type = "text", t.text = n.readString(a), t;
|
|
33
|
-
case 2: return t.type = "copyrightNotice", t.text = n.readString(a), t;
|
|
34
|
-
case 3: return t.type = "trackName", t.text = n.readString(a), t;
|
|
35
|
-
case 4: return t.type = "instrumentName", t.text = n.readString(a), t;
|
|
36
|
-
case 5: return t.type = "lyrics", t.text = n.readString(a), t;
|
|
37
|
-
case 6: return t.type = "marker", t.text = n.readString(a), t;
|
|
38
|
-
case 7: return t.type = "cuePoint", t.text = n.readString(a), t;
|
|
39
|
-
case 32:
|
|
40
|
-
if (t.type = "channelPrefix", 1 != a)
|
|
41
|
-
throw "Expected length for channelPrefix event is 1, got " + a;
|
|
42
|
-
return t.channel = n.readUInt8(), t;
|
|
43
|
-
case 33:
|
|
44
|
-
if (t.type = "portPrefix", 1 != a)
|
|
45
|
-
throw "Expected length for portPrefix event is 1, got " + a;
|
|
46
|
-
return t.port = n.readUInt8(), t;
|
|
47
|
-
case 47:
|
|
48
|
-
if (t.type = "endOfTrack", 0 != a)
|
|
49
|
-
throw "Expected length for endOfTrack event is 0, got " + a;
|
|
50
|
-
return t;
|
|
51
|
-
case 81:
|
|
52
|
-
if (t.type = "setTempo", 3 != a)
|
|
53
|
-
throw "Expected length for setTempo event is 3, got " + a;
|
|
54
|
-
return t.microsecondsPerBeat = n.readUInt24(), t;
|
|
55
|
-
case 84:
|
|
56
|
-
if (t.type = "smpteOffset", 5 != a)
|
|
57
|
-
throw "Expected length for smpteOffset event is 5, got " + a;
|
|
58
|
-
var o = n.readUInt8();
|
|
59
|
-
return t.frameRate = { 0: 24, 32: 25, 64: 29, 96: 30 }[96 & o], t.hour = 31 & o, t.min = n.readUInt8(), t.sec = n.readUInt8(), t.frame = n.readUInt8(), t.subFrame = n.readUInt8(), t;
|
|
60
|
-
case 88:
|
|
61
|
-
if (t.type = "timeSignature", 2 != a && 4 != a)
|
|
62
|
-
throw "Expected length for timeSignature event is 4 or 2, got " + a;
|
|
63
|
-
return t.numerator = n.readUInt8(), t.denominator = 1 << n.readUInt8(), 4 === a ? (t.metronome = n.readUInt8(), t.thirtyseconds = n.readUInt8()) : (t.metronome = 36, t.thirtyseconds = 8), t;
|
|
64
|
-
case 89:
|
|
65
|
-
if (t.type = "keySignature", 2 != a)
|
|
66
|
-
throw "Expected length for keySignature event is 2, got " + a;
|
|
67
|
-
return t.key = n.readInt8(), t.scale = n.readUInt8(), t;
|
|
68
|
-
case 127: return t.type = "sequencerSpecific", t.data = n.readBytes(a), t;
|
|
69
|
-
default: return t.type = "unknownMeta", t.data = n.readBytes(a), t.metatypeByte = i, t;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
var s;
|
|
74
|
-
if (0 == (128 & r)) {
|
|
75
|
-
if (null === e)
|
|
76
|
-
throw "Running status byte encountered before status byte";
|
|
77
|
-
s = r, r = e, t.running = !0;
|
|
78
|
-
}
|
|
79
|
-
else
|
|
80
|
-
s = n.readUInt8(), e = r;
|
|
81
|
-
var I = r >> 4;
|
|
82
|
-
switch (t.channel = 15 & r, I) {
|
|
83
|
-
case 8: return t.type = "noteOff", t.noteNumber = s, t.velocity = n.readUInt8(), t;
|
|
84
|
-
case 9:
|
|
85
|
-
var c = n.readUInt8();
|
|
86
|
-
return t.type = 0 === c ? "noteOff" : "noteOn", t.noteNumber = s, t.velocity = c, 0 === c && (t.byte9 = !0), t;
|
|
87
|
-
case 10: return t.type = "noteAftertouch", t.noteNumber = s, t.amount = n.readUInt8(), t;
|
|
88
|
-
case 11: return t.type = "controller", t.controllerType = s, t.value = n.readUInt8(), t;
|
|
89
|
-
case 12: return t.type = "programChange", t.programNumber = s, t;
|
|
90
|
-
case 13: return t.type = "channelAftertouch", t.amount = s, t;
|
|
91
|
-
case 14: return t.type = "pitchBend", t.value = s + (n.readUInt8() << 7) - 8192, t;
|
|
92
|
-
default: throw "Unrecognised MIDI event type: " + I;
|
|
93
|
-
}
|
|
94
|
-
} } }
|
|
95
|
-
function r(t) { this.buffer = t, this.bufferLen = this.buffer.length, this.pos = 0; }
|
|
96
|
-
r.prototype.eof = function () { return this.pos >= this.bufferLen; }, r.prototype.readUInt8 = function () { var t = this.buffer[this.pos]; return this.pos += 1, t; }, r.prototype.readInt8 = function () { var t = this.readUInt8(); return 128 & t ? t - 256 : t; }, r.prototype.readUInt16 = function () { return (this.readUInt8() << 8) + this.readUInt8(); }, r.prototype.readInt16 = function () { var t = this.readUInt16(); return 32768 & t ? t - 65536 : t; }, r.prototype.readUInt24 = function () { return (this.readUInt8() << 16) + (this.readUInt8() << 8) + this.readUInt8(); }, r.prototype.readInt24 = function () { var t = this.readUInt24(); return 8388608 & t ? t - 16777216 : t; }, r.prototype.readUInt32 = function () { return (this.readUInt8() << 24) + (this.readUInt8() << 16) + (this.readUInt8() << 8) + this.readUInt8(); }, r.prototype.readBytes = function (t) { var e = this.buffer.slice(this.pos, this.pos + t); return this.pos += t, e; }, r.prototype.readString = function (t) { var e = this.readBytes(t); return String.fromCharCode.apply(null, e); }, r.prototype.readVarInt = function () { for (var t = 0; !this.eof();) {
|
|
97
|
-
var e = this.readUInt8();
|
|
98
|
-
if (!(128 & e))
|
|
99
|
-
return t + e;
|
|
100
|
-
t += 127 & e, t <<= 7;
|
|
101
|
-
} return t; }, r.prototype.readChunk = function () { var t = this.readString(4), e = this.readUInt32(); return { id: t, length: e, data: this.readBytes(e) }; };
|
|
102
|
-
var n = function (t) { var n = new r(t), i = n.readChunk(); if ("MThd" != i.id)
|
|
103
|
-
throw "Bad MIDI file. Expected 'MHdr', got: '" + i.id + "'"; for (var a = function (t) { var e = new r(t), n = e.readUInt16(), i = e.readUInt16(), a = { format: n, numTracks: i }, o = e.readUInt16(); 32768 & o ? (a.framesPerSecond = 256 - (o >> 8), a.ticksPerFrame = 255 & o) : a.ticksPerBeat = o; return a; }(i.data), o = [], s = 0; !n.eof() && s < a.numTracks; s++) {
|
|
104
|
-
var I = n.readChunk();
|
|
105
|
-
if ("MTrk" != I.id)
|
|
106
|
-
throw "Bad MIDI file. Expected 'MTrk', got: '" + I.id + "'";
|
|
107
|
-
var c = e(I.data);
|
|
108
|
-
o.push(c);
|
|
109
|
-
} return { header: a, tracks: o }; };
|
|
110
|
-
function i(t, e, r) { var n, i = new o, s = e.length, I = null; for (n = 0; n < s; n++)
|
|
111
|
-
!1 !== r.running && (r.running || e[n].running) || (I = null), I = a(i, e[n], I, r.useByte9ForNoteOff); t.writeChunk("MTrk", i.buffer); }
|
|
112
|
-
function a(t, e, r, n) { var i = e.type, a = e.deltaTime, o = e.text || "", s = e.data || [], I = null; switch (t.writeVarInt(a), i) {
|
|
113
|
-
case "sequenceNumber":
|
|
114
|
-
t.writeUInt8(255), t.writeUInt8(0), t.writeVarInt(2), t.writeUInt16(e.number);
|
|
115
|
-
break;
|
|
116
|
-
case "text":
|
|
117
|
-
t.writeUInt8(255), t.writeUInt8(1), t.writeVarInt(o.length), t.writeString(o);
|
|
118
|
-
break;
|
|
119
|
-
case "copyrightNotice":
|
|
120
|
-
t.writeUInt8(255), t.writeUInt8(2), t.writeVarInt(o.length), t.writeString(o);
|
|
121
|
-
break;
|
|
122
|
-
case "trackName":
|
|
123
|
-
t.writeUInt8(255), t.writeUInt8(3), t.writeVarInt(o.length), t.writeString(o);
|
|
124
|
-
break;
|
|
125
|
-
case "instrumentName":
|
|
126
|
-
t.writeUInt8(255), t.writeUInt8(4), t.writeVarInt(o.length), t.writeString(o);
|
|
127
|
-
break;
|
|
128
|
-
case "lyrics":
|
|
129
|
-
t.writeUInt8(255), t.writeUInt8(5), t.writeVarInt(o.length), t.writeString(o);
|
|
130
|
-
break;
|
|
131
|
-
case "marker":
|
|
132
|
-
t.writeUInt8(255), t.writeUInt8(6), t.writeVarInt(o.length), t.writeString(o);
|
|
133
|
-
break;
|
|
134
|
-
case "cuePoint":
|
|
135
|
-
t.writeUInt8(255), t.writeUInt8(7), t.writeVarInt(o.length), t.writeString(o);
|
|
136
|
-
break;
|
|
137
|
-
case "channelPrefix":
|
|
138
|
-
t.writeUInt8(255), t.writeUInt8(32), t.writeVarInt(1), t.writeUInt8(e.channel);
|
|
139
|
-
break;
|
|
140
|
-
case "portPrefix":
|
|
141
|
-
t.writeUInt8(255), t.writeUInt8(33), t.writeVarInt(1), t.writeUInt8(e.port);
|
|
142
|
-
break;
|
|
143
|
-
case "endOfTrack":
|
|
144
|
-
t.writeUInt8(255), t.writeUInt8(47), t.writeVarInt(0);
|
|
145
|
-
break;
|
|
146
|
-
case "setTempo":
|
|
147
|
-
t.writeUInt8(255), t.writeUInt8(81), t.writeVarInt(3), t.writeUInt24(e.microsecondsPerBeat);
|
|
148
|
-
break;
|
|
149
|
-
case "smpteOffset":
|
|
150
|
-
t.writeUInt8(255), t.writeUInt8(84), t.writeVarInt(5);
|
|
151
|
-
var c = 31 & e.hour | { 24: 0, 25: 32, 29: 64, 30: 96 }[e.frameRate];
|
|
152
|
-
t.writeUInt8(c), t.writeUInt8(e.min), t.writeUInt8(e.sec), t.writeUInt8(e.frame), t.writeUInt8(e.subFrame);
|
|
153
|
-
break;
|
|
154
|
-
case "timeSignature":
|
|
155
|
-
t.writeUInt8(255), t.writeUInt8(88), t.writeVarInt(4), t.writeUInt8(e.numerator);
|
|
156
|
-
var u = 255 & Math.floor(Math.log(e.denominator) / Math.LN2);
|
|
157
|
-
t.writeUInt8(u), t.writeUInt8(e.metronome), t.writeUInt8(e.thirtyseconds || 8);
|
|
158
|
-
break;
|
|
159
|
-
case "keySignature":
|
|
160
|
-
t.writeUInt8(255), t.writeUInt8(89), t.writeVarInt(2), t.writeInt8(e.key), t.writeUInt8(e.scale);
|
|
161
|
-
break;
|
|
162
|
-
case "sequencerSpecific":
|
|
163
|
-
t.writeUInt8(255), t.writeUInt8(127), t.writeVarInt(s.length), t.writeBytes(s);
|
|
164
|
-
break;
|
|
165
|
-
case "unknownMeta":
|
|
166
|
-
null != e.metatypeByte && (t.writeUInt8(255), t.writeUInt8(e.metatypeByte), t.writeVarInt(s.length), t.writeBytes(s));
|
|
167
|
-
break;
|
|
168
|
-
case "sysEx":
|
|
169
|
-
t.writeUInt8(240), t.writeVarInt(s.length), t.writeBytes(s);
|
|
170
|
-
break;
|
|
171
|
-
case "endSysEx":
|
|
172
|
-
t.writeUInt8(247), t.writeVarInt(s.length), t.writeBytes(s);
|
|
173
|
-
break;
|
|
174
|
-
case "noteOff":
|
|
175
|
-
(I = (!1 !== n && e.byte9 || n && 0 == e.velocity ? 144 : 128) | e.channel) !== r && t.writeUInt8(I), t.writeUInt8(e.noteNumber), t.writeUInt8(e.velocity);
|
|
176
|
-
break;
|
|
177
|
-
case "noteOn":
|
|
178
|
-
(I = 144 | e.channel) !== r && t.writeUInt8(I), t.writeUInt8(e.noteNumber), t.writeUInt8(e.velocity);
|
|
179
|
-
break;
|
|
180
|
-
case "noteAftertouch":
|
|
181
|
-
(I = 160 | e.channel) !== r && t.writeUInt8(I), t.writeUInt8(e.noteNumber), t.writeUInt8(e.amount);
|
|
182
|
-
break;
|
|
183
|
-
case "controller":
|
|
184
|
-
(I = 176 | e.channel) !== r && t.writeUInt8(I), t.writeUInt8(e.controllerType), t.writeUInt8(e.value);
|
|
185
|
-
break;
|
|
186
|
-
case "programChange":
|
|
187
|
-
(I = 192 | e.channel) !== r && t.writeUInt8(I), t.writeUInt8(e.programNumber);
|
|
188
|
-
break;
|
|
189
|
-
case "channelAftertouch":
|
|
190
|
-
(I = 208 | e.channel) !== r && t.writeUInt8(I), t.writeUInt8(e.amount);
|
|
191
|
-
break;
|
|
192
|
-
case "pitchBend":
|
|
193
|
-
(I = 224 | e.channel) !== r && t.writeUInt8(I);
|
|
194
|
-
var w = 8192 + e.value, h = 127 & w, f = w >> 7 & 127;
|
|
195
|
-
t.writeUInt8(h), t.writeUInt8(f);
|
|
196
|
-
break;
|
|
197
|
-
default: throw "Unrecognized event type: " + i;
|
|
198
|
-
} return I; }
|
|
199
|
-
function o() { this.buffer = []; }
|
|
200
|
-
o.prototype.writeUInt8 = function (t) { this.buffer.push(255 & t); }, o.prototype.writeInt8 = o.prototype.writeUInt8, o.prototype.writeUInt16 = function (t) { var e = t >> 8 & 255, r = 255 & t; this.writeUInt8(e), this.writeUInt8(r); }, o.prototype.writeInt16 = o.prototype.writeUInt16, o.prototype.writeUInt24 = function (t) { var e = t >> 16 & 255, r = t >> 8 & 255, n = 255 & t; this.writeUInt8(e), this.writeUInt8(r), this.writeUInt8(n); }, o.prototype.writeInt24 = o.prototype.writeUInt24, o.prototype.writeUInt32 = function (t) { var e = t >> 24 & 255, r = t >> 16 & 255, n = t >> 8 & 255, i = 255 & t; this.writeUInt8(e), this.writeUInt8(r), this.writeUInt8(n), this.writeUInt8(i); }, o.prototype.writeInt32 = o.prototype.writeUInt32, o.prototype.writeBytes = function (t) { this.buffer = this.buffer.concat(Array.prototype.slice.call(t, 0)); }, o.prototype.writeString = function (t) { var e, r = t.length, n = []; for (e = 0; e < r; e++)
|
|
201
|
-
n.push(t.codePointAt(e)); this.writeBytes(n); }, o.prototype.writeVarInt = function (t) { if (t < 0)
|
|
202
|
-
throw "Cannot write negative variable-length integer"; if (t <= 127)
|
|
203
|
-
this.writeUInt8(t);
|
|
204
|
-
else {
|
|
205
|
-
var e = t, r = [];
|
|
206
|
-
for (r.push(127 & e), e >>= 7; e;) {
|
|
207
|
-
var n = 127 & e | 128;
|
|
208
|
-
r.push(n), e >>= 7;
|
|
209
|
-
}
|
|
210
|
-
this.writeBytes(r.reverse());
|
|
211
|
-
} }, o.prototype.writeChunk = function (t, e) { this.writeString(t), this.writeUInt32(e.length), this.writeBytes(e); };
|
|
212
|
-
var s = function (t, e) { if ("object" != typeof t)
|
|
213
|
-
throw "Invalid MIDI data"; e = e || {}; var r, n = t.header || {}, a = t.tracks || [], s = a.length, I = new o; for (function (t, e, r) { var n = null == e.format ? 1 : e.format, i = 128; e.timeDivision ? i = e.timeDivision : e.ticksPerFrame && e.framesPerSecond ? i = -(255 & e.framesPerSecond) << 8 | 255 & e.ticksPerFrame : e.ticksPerBeat && (i = 32767 & e.ticksPerBeat); var a = new o; a.writeUInt16(n), a.writeUInt16(r), a.writeUInt16(i), t.writeChunk("MThd", a.buffer); }(I, n, s), r = 0; r < s; r++)
|
|
214
|
-
i(I, a[r], e); return I.buffer; }, I = t.parseMidi = n, c = t.writeMidi = s;
|
|
215
|
-
export { t as default, I as parseMidi, c as writeMidi };
|
|
216
|
-
//# sourceMappingURL=/sm/4ef9545b018e4043d7034a9272f1e66ac6dc613c64c28b528c827714a6c09f4f.map
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
declare const _default: null;
|
|
2
|
-
export default _default;
|
|
3
|
-
declare const M: string[];
|
|
4
|
-
declare class B {
|
|
5
|
-
constructor(e: any);
|
|
6
|
-
parsed: any;
|
|
7
|
-
getGenerators(e: any, t: any, n: any, r: any): any[];
|
|
8
|
-
getPresetGenerators(e: any): any[];
|
|
9
|
-
getInstrumentGenerators(e: any): any[];
|
|
10
|
-
findInstrumentZone(e: any, t: any, n: any): {} | undefined;
|
|
11
|
-
findInstrument(e: any, t: any, n: any): any;
|
|
12
|
-
getInstrument(e: any, t: any): any;
|
|
13
|
-
getInstrumentKey(e: any, t: any, n: any, r: any): {
|
|
14
|
-
start: any;
|
|
15
|
-
end: any;
|
|
16
|
-
loopStart: any;
|
|
17
|
-
loopEnd: any;
|
|
18
|
-
modLfoToPitch: any;
|
|
19
|
-
vibLfoToPitch: any;
|
|
20
|
-
modEnvToPitch: any;
|
|
21
|
-
initialFilterFc: any;
|
|
22
|
-
initialFilterQ: any;
|
|
23
|
-
modLfoToFilterFc: any;
|
|
24
|
-
modEnvToFilterFc: any;
|
|
25
|
-
modLfoToVolume: any;
|
|
26
|
-
chorusEffectsSend: number;
|
|
27
|
-
reverbEffectsSend: number;
|
|
28
|
-
pan: any;
|
|
29
|
-
delayModLFO: number;
|
|
30
|
-
freqModLFO: any;
|
|
31
|
-
delayVibLFO: number;
|
|
32
|
-
freqVibLFO: any;
|
|
33
|
-
modDelay: number;
|
|
34
|
-
modAttack: number;
|
|
35
|
-
modHold: number;
|
|
36
|
-
modDecay: number;
|
|
37
|
-
modSustain: number;
|
|
38
|
-
modRelease: number;
|
|
39
|
-
volDelay: number;
|
|
40
|
-
volAttack: number;
|
|
41
|
-
volHold: number;
|
|
42
|
-
volDecay: number;
|
|
43
|
-
volSustain: number;
|
|
44
|
-
volRelease: number;
|
|
45
|
-
initialAttenuation: any;
|
|
46
|
-
playbackRate: (e: any) => number;
|
|
47
|
-
sample: any;
|
|
48
|
-
sampleRate: any;
|
|
49
|
-
sampleName: any;
|
|
50
|
-
sampleModes: any;
|
|
51
|
-
exclusiveClass: any;
|
|
52
|
-
} | null;
|
|
53
|
-
getPresetNames(): {};
|
|
54
|
-
}
|
|
55
|
-
declare function S(e: any): {};
|
|
56
|
-
declare function V(e: any): {};
|
|
57
|
-
declare namespace W {
|
|
58
|
-
let startAddrsOffset: m;
|
|
59
|
-
let endAddrsOffset: m;
|
|
60
|
-
let startloopAddrsOffset: m;
|
|
61
|
-
let endloopAddrsOffset: m;
|
|
62
|
-
let startAddrsCoarseOffset: m;
|
|
63
|
-
let modLfoToPitch: m;
|
|
64
|
-
let vibLfoToPitch: m;
|
|
65
|
-
let modEnvToPitch: m;
|
|
66
|
-
let initialFilterFc: m;
|
|
67
|
-
let initialFilterQ: m;
|
|
68
|
-
let modLfoToFilterFc: m;
|
|
69
|
-
let modEnvToFilterFc: m;
|
|
70
|
-
let endAddrsCoarseOffset: m;
|
|
71
|
-
let modLfoToVolume: m;
|
|
72
|
-
let chorusEffectsSend: m;
|
|
73
|
-
let reverbEffectsSend: m;
|
|
74
|
-
let pan: m;
|
|
75
|
-
let delayModLFO: m;
|
|
76
|
-
let freqModLFO: m;
|
|
77
|
-
let delayVibLFO: m;
|
|
78
|
-
let freqVibLFO: m;
|
|
79
|
-
let delayModEnv: m;
|
|
80
|
-
let attackModEnv: m;
|
|
81
|
-
let holdModEnv: m;
|
|
82
|
-
let decayModEnv: m;
|
|
83
|
-
let sustainModEnv: m;
|
|
84
|
-
let releaseModEnv: m;
|
|
85
|
-
let keynumToModEnvHold: m;
|
|
86
|
-
let keynumToModEnvDecay: m;
|
|
87
|
-
let delayVolEnv: m;
|
|
88
|
-
let attackVolEnv: m;
|
|
89
|
-
let holdVolEnv: m;
|
|
90
|
-
let decayVolEnv: m;
|
|
91
|
-
let sustainVolEnv: m;
|
|
92
|
-
let releaseVolEnv: m;
|
|
93
|
-
let keynumToVolEnvHold: m;
|
|
94
|
-
let keynumToVolEnvDecay: m;
|
|
95
|
-
let instrument: m;
|
|
96
|
-
let keyRange: d;
|
|
97
|
-
let velRange: d;
|
|
98
|
-
let startloopAddrsCoarseOffset: m;
|
|
99
|
-
let keynum: m;
|
|
100
|
-
let velocity: m;
|
|
101
|
-
let initialAttenuation: m;
|
|
102
|
-
let endloopAddrsCoarseOffset: m;
|
|
103
|
-
let coarseTune: m;
|
|
104
|
-
let fineTune: m;
|
|
105
|
-
let sampleID: m;
|
|
106
|
-
let sampleModes: m;
|
|
107
|
-
let scaleTuning: m;
|
|
108
|
-
let exclusiveClass: m;
|
|
109
|
-
let overridingRootKey: m;
|
|
110
|
-
}
|
|
111
|
-
declare function L(e: any): boolean;
|
|
112
|
-
declare function p(e: any, r?: {}): {
|
|
113
|
-
samples: any;
|
|
114
|
-
presetHeaders: any[];
|
|
115
|
-
presetZone: any[];
|
|
116
|
-
presetModulators: any[];
|
|
117
|
-
presetGenerators: any[];
|
|
118
|
-
instruments: any[];
|
|
119
|
-
instrumentZone: any[];
|
|
120
|
-
instrumentModulators: any[];
|
|
121
|
-
instrumentGenerators: any[];
|
|
122
|
-
sampleHeaders: any[];
|
|
123
|
-
info: s;
|
|
124
|
-
samplingData: {
|
|
125
|
-
offsetMSB: any;
|
|
126
|
-
offsetLSB: any;
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
declare function H(e: any): number;
|
|
130
|
-
declare class m {
|
|
131
|
-
constructor(e: any, t: any, n: any);
|
|
132
|
-
min: any;
|
|
133
|
-
value: any;
|
|
134
|
-
max: any;
|
|
135
|
-
clamp(): number;
|
|
136
|
-
}
|
|
137
|
-
declare class d {
|
|
138
|
-
static parse(e: any): d;
|
|
139
|
-
constructor(e: any, t: any);
|
|
140
|
-
lo: any;
|
|
141
|
-
hi: any;
|
|
142
|
-
in(e: any): boolean;
|
|
143
|
-
}
|
|
144
|
-
declare class s {
|
|
145
|
-
static parse(t: any, n: any): s;
|
|
146
|
-
constructor(e: any, t: any, n: any, r: any, a: any, o: any, s: any, i: any, l: any, d: any, u: any);
|
|
147
|
-
}
|
|
148
|
-
export { M as RangeGeneratorNames, B as SoundFont, S as createInstrumentGeneratorObject, V as createPresetGeneratorObject, W as defaultInstrumentZone, L as isRangeGenerator, p as parse, H as timecentToSecond };
|
|
149
|
-
//# sourceMappingURL=+esm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"+esm.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.6/+esm.js"],"names":[],"mappings":";;AAM0lV,0BAAyB;AAAugF;IAAQ,oBAA2H;IAAd,YAAa;IAAC,qDAAoJ;IAAA,mCAAoP;IAAA,uCAAwQ;IAAA,2DAAiP;IAAA,4CAAmX;IAAA,mCAAuL;IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAA49D;IAAA,qBAAqK;CAAC;AAApoL,+BAA2R;AAAzd,+BAA8L;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAjO,oCAAmC;AAA7yE;;;;;;;;;;;;;;;;EAA27B;AAAorO,mCAAwC;AAAziR;IAAQ,oCAAyU;IAAnC,SAAU;IAAC,WAAY;IAAC,SAAU;IAAC,gBAAgE;CAAC;AAA19G;IAAqQ,wBAAsE;IAAnU,4BAAyN;IAApB,QAAS;IAAC,QAAS;IAAC,oBAAoC;CAAuE;AAAv5F;IAAshC,gCAAqa;IAAn7C,oGAA8gC;CAAsa"}
|