@marmooo/midy 0.1.5 → 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 +6 -5
- package/esm/midy-GM1.d.ts.map +1 -1
- package/esm/midy-GM1.js +97 -65
- package/esm/midy-GM2.d.ts +15 -9
- package/esm/midy-GM2.d.ts.map +1 -1
- package/esm/midy-GM2.js +316 -129
- package/esm/midy-GMLite.d.ts +6 -5
- package/esm/midy-GMLite.d.ts.map +1 -1
- package/esm/midy-GMLite.js +97 -65
- package/esm/midy.d.ts +15 -9
- package/esm/midy.d.ts.map +1 -1
- package/esm/midy.js +317 -134
- package/package.json +5 -1
- package/script/midy-GM1.d.ts +6 -5
- package/script/midy-GM1.d.ts.map +1 -1
- package/script/midy-GM1.js +100 -68
- package/script/midy-GM2.d.ts +15 -9
- package/script/midy-GM2.d.ts.map +1 -1
- package/script/midy-GM2.js +319 -132
- package/script/midy-GMLite.d.ts +6 -5
- package/script/midy-GMLite.d.ts.map +1 -1
- package/script/midy-GMLite.js +100 -68
- package/script/midy.d.ts +15 -9
- package/script/midy.d.ts.map +1 -1
- package/script/midy.js +320 -137
- 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,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"}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultInstrumentZone = exports.SoundFont = exports.RangeGeneratorNames = void 0;
|
|
4
|
-
exports.createInstrumentGeneratorObject = S;
|
|
5
|
-
exports.createPresetGeneratorObject = V;
|
|
6
|
-
exports.isRangeGenerator = L;
|
|
7
|
-
exports.parse = p;
|
|
8
|
-
exports.timecentToSecond = H;
|
|
9
|
-
/**
|
|
10
|
-
* Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.
|
|
11
|
-
* Original file: /npm/@marmooo/soundfont-parser@0.0.6/esm/mod.js
|
|
12
|
-
*
|
|
13
|
-
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
|
14
|
-
*/
|
|
15
|
-
class e {
|
|
16
|
-
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 }); }
|
|
17
|
-
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; }
|
|
18
|
-
readWORD() { return this.data[this.offset++] | this.data[this.offset++] << 8; }
|
|
19
|
-
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; }
|
|
20
|
-
readByte() { return this.data[this.offset++]; }
|
|
21
|
-
readAt(e) { return this.data[this.offset + e]; }
|
|
22
|
-
readUInt8() { return this.readByte(); }
|
|
23
|
-
readInt8() { return this.readByte() << 24 >> 24; }
|
|
24
|
-
readUInt16() { return this.readWORD(); }
|
|
25
|
-
readInt16() { return this.readWORD() << 16 >> 16; }
|
|
26
|
-
readUInt32() { return this.readDWORD(); }
|
|
27
|
-
}
|
|
28
|
-
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); }
|
|
29
|
-
function n(e, n = 0, r, { padding: a = !0, bigEndian: o = !1 } = {}) { const s = [], i = r + n; let l = n; for (; l < i;) {
|
|
30
|
-
const r = t(e, l, o);
|
|
31
|
-
l = r.offset + r.size, a && 1 == (l - n & 1) && l++, s.push(r);
|
|
32
|
-
} return s; }
|
|
33
|
-
class r {
|
|
34
|
-
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 }); }
|
|
35
|
-
}
|
|
36
|
-
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"];
|
|
37
|
-
class o {
|
|
38
|
-
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 }); }
|
|
39
|
-
static parse(e) { const t = e.readInt8(), n = e.readInt8(); return new o(t, n); }
|
|
40
|
-
}
|
|
41
|
-
class s {
|
|
42
|
-
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 }); }
|
|
43
|
-
static parse(t, n) { function r(e) { for (let t = 0; t < n.length; t++)
|
|
44
|
-
if (n[t].type === e)
|
|
45
|
-
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); }
|
|
46
|
-
}
|
|
47
|
-
class i {
|
|
48
|
-
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 }); }
|
|
49
|
-
static parse(e) { const t = e.readWORD(), n = e.readWORD(); return new i(t, n); }
|
|
50
|
-
}
|
|
51
|
-
class l {
|
|
52
|
-
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 }); }
|
|
53
|
-
get isEnd() { return "EOP" === this.presetName; }
|
|
54
|
-
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); }
|
|
55
|
-
}
|
|
56
|
-
class d {
|
|
57
|
-
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; }
|
|
58
|
-
in(e) { return this.lo <= e && e <= this.hi; }
|
|
59
|
-
static parse(e) { const t = e.readByte(), n = e.readByte(); return new d(t, n); }
|
|
60
|
-
}
|
|
61
|
-
class u {
|
|
62
|
-
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 }); }
|
|
63
|
-
get isEnd() { return 0 === this.sourceOper && 0 === this.destinationOper && 0 === this.value && 0 === this.amountSourceOper && 0 === this.transOper; }
|
|
64
|
-
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); }
|
|
65
|
-
}
|
|
66
|
-
class f {
|
|
67
|
-
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 }); }
|
|
68
|
-
get type() { return a[this.code]; }
|
|
69
|
-
get isEnd() { return 0 === this.code && 0 === this.value; }
|
|
70
|
-
static parse(e) { const t = e.readWORD(); let n; switch (a[t]) {
|
|
71
|
-
case "keyRange":
|
|
72
|
-
case "velRange":
|
|
73
|
-
n = d.parse(e);
|
|
74
|
-
break;
|
|
75
|
-
default: n = e.readInt16();
|
|
76
|
-
} return new f(t, n); }
|
|
77
|
-
}
|
|
78
|
-
class c {
|
|
79
|
-
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 }); }
|
|
80
|
-
get isEnd() { return "EOI" === this.instrumentName; }
|
|
81
|
-
static parse(e) { const t = new c; return t.instrumentName = e.readString(20), t.instrumentBagIndex = e.readWORD(), t; }
|
|
82
|
-
}
|
|
83
|
-
class b {
|
|
84
|
-
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 }); }
|
|
85
|
-
get isEnd() { return "EOS" === this.sampleName; }
|
|
86
|
-
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); }
|
|
87
|
-
}
|
|
88
|
-
class m {
|
|
89
|
-
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; }
|
|
90
|
-
clamp() { return Math.max(this.min, Math.min(this.value, this.max)); }
|
|
91
|
-
}
|
|
92
|
-
function p(e, r = {}) { const a = n(e, 0, e.length, r); if (1 !== a.length)
|
|
93
|
-
throw new Error("wrong chunk length"); const o = a[0]; if (null === o)
|
|
94
|
-
throw new Error("chunk not found"); function i(e, t, n) { const r = h(e, t, "LIST", "pdta"); if (9 !== r.length)
|
|
95
|
-
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)
|
|
96
|
-
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) }; }
|
|
97
|
-
function h(t, r, a, o, s = {}) { if (t.type !== a)
|
|
98
|
-
throw new Error("invalid chunk type:" + t.type); const i = new e(r, t.offset), l = i.readString(4); if (l !== o)
|
|
99
|
-
throw new Error("invalid signature:" + l); return n(r, i.offset, t.size - 4, s); }
|
|
100
|
-
function v(e, t) { const n = h(e, t, "LIST", "sdta"); return { offsetMSB: n[0].offset, offsetLSB: n[1]?.offset }; }
|
|
101
|
-
function g(t, n, r, a, o, s) { const i = []; if (t.type !== r)
|
|
102
|
-
throw new Error("invalid chunk type:" + t.type); const l = new e(n, t.offset), d = t.offset + t.size; for (; l.offset < d;) {
|
|
103
|
-
const e = a.parse(l, s);
|
|
104
|
-
if (o && o(e))
|
|
105
|
-
break;
|
|
106
|
-
i.push(e);
|
|
107
|
-
} return i; }
|
|
108
|
-
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);
|
|
109
|
-
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)); })); }
|
|
110
|
-
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"]];
|
|
111
|
-
exports.RangeGeneratorNames = M;
|
|
112
|
-
function L(e) { return M.includes(e); }
|
|
113
|
-
function V(e) { const t = {}; for (let n = 0; n < e.length; n++) {
|
|
114
|
-
const r = e[n], a = r.type;
|
|
115
|
-
if (void 0 !== a && !F.has(r.code))
|
|
116
|
-
if (L(a))
|
|
117
|
-
t[a] = r.value;
|
|
118
|
-
else {
|
|
119
|
-
const e = a, n = W[e];
|
|
120
|
-
t[e] = new m(n.min, r.value, n.max);
|
|
121
|
-
}
|
|
122
|
-
} return t; }
|
|
123
|
-
function S(e) { const t = {}; for (let n = 0; n < e.length; n++) {
|
|
124
|
-
const r = e[n], a = r.type;
|
|
125
|
-
if (void 0 !== a)
|
|
126
|
-
if (L(a))
|
|
127
|
-
t[a] = r.value;
|
|
128
|
-
else {
|
|
129
|
-
const e = a, n = W[e];
|
|
130
|
-
t[e] = new m(n.min, r.value, n.max);
|
|
131
|
-
}
|
|
132
|
-
} for (let e = 0; e < A.length; e++) {
|
|
133
|
-
const [n, r] = A[e], a = t[n];
|
|
134
|
-
a instanceof m && 0 <= a.value && (t[r] = new d(a.value, a.value));
|
|
135
|
-
} return t; }
|
|
136
|
-
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) };
|
|
137
|
-
exports.defaultInstrumentZone = W;
|
|
138
|
-
class B {
|
|
139
|
-
constructor(e) { Object.defineProperty(this, "parsed", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), this.parsed = e; }
|
|
140
|
-
getGenerators(e, t, n, r) { const a = new Array(r - n); for (let o = n; o < r; o++) {
|
|
141
|
-
const r = t[o].generatorIndex, s = t[o + 1].generatorIndex;
|
|
142
|
-
a[o - n] = e.slice(r, s);
|
|
143
|
-
} return a; }
|
|
144
|
-
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); }
|
|
145
|
-
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); }
|
|
146
|
-
findInstrumentZone(e, t, n) { const r = this.getInstrumentGenerators(e); let a; for (let e = 0; e < r.length; e++) {
|
|
147
|
-
const o = S(r[e]);
|
|
148
|
-
if (void 0 !== o.sampleID) {
|
|
149
|
-
if ((!o.keyRange || o.keyRange.in(t)) && (!o.velRange || o.velRange.in(n)))
|
|
150
|
-
return a ? { ...a, ...o } : o;
|
|
151
|
-
}
|
|
152
|
-
else
|
|
153
|
-
a = o;
|
|
154
|
-
} }
|
|
155
|
-
findInstrument(e, t, n) { const r = this.getPresetGenerators(e); let a; for (let e = 0; e < r.length; e++) {
|
|
156
|
-
const o = V(r[e]);
|
|
157
|
-
if (void 0 === o.instrument) {
|
|
158
|
-
a = o;
|
|
159
|
-
continue;
|
|
160
|
-
}
|
|
161
|
-
if (o.keyRange && !o.keyRange.in(t))
|
|
162
|
-
continue;
|
|
163
|
-
if (o.velRange && !o.velRange.in(n))
|
|
164
|
-
continue;
|
|
165
|
-
const s = this.findInstrumentZone(o.instrument.value, t, n);
|
|
166
|
-
if (s)
|
|
167
|
-
return a ? this.getInstrument({ ...a, ...o }, s) : this.getInstrument(o, s);
|
|
168
|
-
} return null; }
|
|
169
|
-
getInstrument(e, t) { const n = { ...W, ...t }, r = Object.keys(e); for (let t = 0; t < r.length; t++) {
|
|
170
|
-
const a = r[t];
|
|
171
|
-
if (L(a))
|
|
172
|
-
continue;
|
|
173
|
-
const o = n[a], s = e[a];
|
|
174
|
-
n[a] = new m(o.min, o.value + s.value, o.max);
|
|
175
|
-
} return n; }
|
|
176
|
-
getInstrumentKey(e, t, n, r) { const a = this.parsed.presetHeaders.findIndex((n => n.preset === t && n.bank === e)); if (a < 0)
|
|
177
|
-
return console.warn("preset not found: bank=%s instrument=%s", e, t), null; const o = this.findInstrument(a, n, r); if (!o)
|
|
178
|
-
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++) {
|
|
179
|
-
const t = i[e];
|
|
180
|
-
L(t) ? s[t] = o[t] : s[t] = o[t].clamp();
|
|
181
|
-
} 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 }; }
|
|
182
|
-
getPresetNames() { const e = {}, t = this.parsed.presetHeaders; for (let n = 0; n < t.length; n++) {
|
|
183
|
-
const r = t[n];
|
|
184
|
-
e[r.bank] || (e[r.bank] = {}), e[r.bank][r.preset] = r.presetName;
|
|
185
|
-
} return e; }
|
|
186
|
-
}
|
|
187
|
-
exports.SoundFont = B;
|
|
188
|
-
function H(e) { return Math.pow(2, e / 1200); }
|
|
189
|
-
exports.default = null;
|
|
190
|
-
//# 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"}
|