@marmooo/midy 0.2.9 → 0.3.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/esm/midy-GM1.d.ts +8 -6
- package/esm/midy-GM1.d.ts.map +1 -1
- package/esm/midy-GM1.js +72 -55
- package/esm/midy-GM2.d.ts +14 -10
- package/esm/midy-GM2.d.ts.map +1 -1
- package/esm/midy-GM2.js +189 -87
- package/esm/midy-GMLite.d.ts +11 -8
- package/esm/midy-GMLite.d.ts.map +1 -1
- package/esm/midy-GMLite.js +124 -61
- package/esm/midy.d.ts +14 -10
- package/esm/midy.d.ts.map +1 -1
- package/esm/midy.js +190 -87
- package/package.json +1 -1
- package/script/midy-GM1.d.ts +8 -6
- package/script/midy-GM1.d.ts.map +1 -1
- package/script/midy-GM1.js +72 -55
- package/script/midy-GM2.d.ts +14 -10
- package/script/midy-GM2.d.ts.map +1 -1
- package/script/midy-GM2.js +189 -87
- package/script/midy-GMLite.d.ts +11 -8
- package/script/midy-GMLite.d.ts.map +1 -1
- package/script/midy-GMLite.js +124 -61
- package/script/midy.d.ts +14 -10
- package/script/midy.d.ts.map +1 -1
- package/script/midy.js +190 -87
package/script/midy-GMLite.js
CHANGED
|
@@ -106,6 +106,19 @@ class Note {
|
|
|
106
106
|
this.voiceParams = voiceParams;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
+
const drumExclusiveClasses = new Uint8Array(128);
|
|
110
|
+
drumExclusiveClasses[42] = 1;
|
|
111
|
+
drumExclusiveClasses[44] = 1;
|
|
112
|
+
drumExclusiveClasses[46] = 1, // HH
|
|
113
|
+
drumExclusiveClasses[71] = 2;
|
|
114
|
+
drumExclusiveClasses[72] = 2; // Whistle
|
|
115
|
+
drumExclusiveClasses[73] = 3;
|
|
116
|
+
drumExclusiveClasses[74] = 3; // Guiro
|
|
117
|
+
drumExclusiveClasses[78] = 4;
|
|
118
|
+
drumExclusiveClasses[79] = 4; // Cuica
|
|
119
|
+
drumExclusiveClasses[80] = 5;
|
|
120
|
+
drumExclusiveClasses[81] = 5; // Triangle
|
|
121
|
+
const drumExclusiveClassCount = 5;
|
|
109
122
|
// normalized to 0-1 for use with the SF2 modulator model
|
|
110
123
|
const defaultControllerState = {
|
|
111
124
|
noteOnVelocity: { type: 2, defaultValue: 0 },
|
|
@@ -179,6 +192,12 @@ class MidyGMLite {
|
|
|
179
192
|
writable: true,
|
|
180
193
|
value: "GM1"
|
|
181
194
|
});
|
|
195
|
+
Object.defineProperty(this, "numChannels", {
|
|
196
|
+
enumerable: true,
|
|
197
|
+
configurable: true,
|
|
198
|
+
writable: true,
|
|
199
|
+
value: 16
|
|
200
|
+
});
|
|
182
201
|
Object.defineProperty(this, "ticksPerBeat", {
|
|
183
202
|
enumerable: true,
|
|
184
203
|
configurable: true,
|
|
@@ -293,11 +312,17 @@ class MidyGMLite {
|
|
|
293
312
|
writable: true,
|
|
294
313
|
value: []
|
|
295
314
|
});
|
|
296
|
-
Object.defineProperty(this, "
|
|
315
|
+
Object.defineProperty(this, "exclusiveClassNotes", {
|
|
316
|
+
enumerable: true,
|
|
317
|
+
configurable: true,
|
|
318
|
+
writable: true,
|
|
319
|
+
value: new Array(128)
|
|
320
|
+
});
|
|
321
|
+
Object.defineProperty(this, "drumExclusiveClassNotes", {
|
|
297
322
|
enumerable: true,
|
|
298
323
|
configurable: true,
|
|
299
324
|
writable: true,
|
|
300
|
-
value: new
|
|
325
|
+
value: new Array(this.numChannels * drumExclusiveClassCount)
|
|
301
326
|
});
|
|
302
327
|
this.audioContext = audioContext;
|
|
303
328
|
this.masterVolume = new GainNode(audioContext);
|
|
@@ -364,8 +389,10 @@ class MidyGMLite {
|
|
|
364
389
|
};
|
|
365
390
|
}
|
|
366
391
|
createChannels(audioContext) {
|
|
367
|
-
const channels = Array.from({ length:
|
|
392
|
+
const channels = Array.from({ length: this.numChannels }, () => {
|
|
368
393
|
return {
|
|
394
|
+
currentBufferSource: null,
|
|
395
|
+
isDrum: false,
|
|
369
396
|
...this.constructor.channelSettings,
|
|
370
397
|
state: new ControllerState(),
|
|
371
398
|
...this.setChannelAudioNodes(audioContext),
|
|
@@ -404,18 +431,10 @@ class MidyGMLite {
|
|
|
404
431
|
return audioBuffer;
|
|
405
432
|
}
|
|
406
433
|
}
|
|
407
|
-
|
|
408
|
-
if (channel.isDrum) {
|
|
409
|
-
return false;
|
|
410
|
-
}
|
|
411
|
-
else {
|
|
412
|
-
return voiceParams.sampleModes % 2 !== 0;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
createBufferSource(channel, voiceParams, audioBuffer) {
|
|
434
|
+
createBufferSource(voiceParams, audioBuffer) {
|
|
416
435
|
const bufferSource = new AudioBufferSourceNode(this.audioContext);
|
|
417
436
|
bufferSource.buffer = audioBuffer;
|
|
418
|
-
bufferSource.loop =
|
|
437
|
+
bufferSource.loop = voiceParams.sampleModes % 2 !== 0;
|
|
419
438
|
if (bufferSource.loop) {
|
|
420
439
|
bufferSource.loopStart = voiceParams.loopStart / voiceParams.sampleRate;
|
|
421
440
|
bufferSource.loopEnd = voiceParams.loopEnd / voiceParams.sampleRate;
|
|
@@ -478,7 +497,7 @@ class MidyGMLite {
|
|
|
478
497
|
if (queueIndex >= this.timeline.length) {
|
|
479
498
|
await Promise.all(this.notePromises);
|
|
480
499
|
this.notePromises = [];
|
|
481
|
-
this.
|
|
500
|
+
this.exclusiveClassNotes.flll(undefined);
|
|
482
501
|
this.audioBufferCache.clear();
|
|
483
502
|
resolve();
|
|
484
503
|
return;
|
|
@@ -497,7 +516,7 @@ class MidyGMLite {
|
|
|
497
516
|
else if (this.isStopping) {
|
|
498
517
|
await this.stopNotes(0, true, now);
|
|
499
518
|
this.notePromises = [];
|
|
500
|
-
this.
|
|
519
|
+
this.exclusiveClassNotes.fill(undefined);
|
|
501
520
|
this.audioBufferCache.clear();
|
|
502
521
|
resolve();
|
|
503
522
|
this.isStopping = false;
|
|
@@ -506,7 +525,7 @@ class MidyGMLite {
|
|
|
506
525
|
}
|
|
507
526
|
else if (this.isSeeking) {
|
|
508
527
|
this.stopNotes(0, true, now);
|
|
509
|
-
this.
|
|
528
|
+
this.exclusiveClassNotes.fill(undefined);
|
|
510
529
|
this.startTime = this.audioContext.currentTime;
|
|
511
530
|
queueIndex = this.getQueueIndex(this.resumeTime);
|
|
512
531
|
offset = this.resumeTime - this.startTime;
|
|
@@ -534,7 +553,7 @@ class MidyGMLite {
|
|
|
534
553
|
extractMidiData(midi) {
|
|
535
554
|
const instruments = new Set();
|
|
536
555
|
const timeline = [];
|
|
537
|
-
const tmpChannels = new Array(
|
|
556
|
+
const tmpChannels = new Array(this.channels.length);
|
|
538
557
|
for (let i = 0; i < tmpChannels.length; i++) {
|
|
539
558
|
tmpChannels[i] = {
|
|
540
559
|
programNumber: -1,
|
|
@@ -626,6 +645,9 @@ class MidyGMLite {
|
|
|
626
645
|
if (!this.isPlaying)
|
|
627
646
|
return;
|
|
628
647
|
this.isStopping = true;
|
|
648
|
+
for (let i = 0; i < this.channels.length; i++) {
|
|
649
|
+
this.resetAllStates(i);
|
|
650
|
+
}
|
|
629
651
|
}
|
|
630
652
|
pause() {
|
|
631
653
|
if (!this.isPlaying || this.isPaused)
|
|
@@ -801,8 +823,8 @@ class MidyGMLite {
|
|
|
801
823
|
note.modulationLFO.connect(note.volumeDepth);
|
|
802
824
|
note.volumeDepth.connect(note.volumeEnvelopeNode.gain);
|
|
803
825
|
}
|
|
804
|
-
async getAudioBuffer(
|
|
805
|
-
const audioBufferId = this.getAudioBufferId(
|
|
826
|
+
async getAudioBuffer(programNumber, noteNumber, velocity, voiceParams, isSF3) {
|
|
827
|
+
const audioBufferId = this.getAudioBufferId(programNumber, noteNumber, velocity);
|
|
806
828
|
const cache = this.audioBufferCache.get(audioBufferId);
|
|
807
829
|
if (cache) {
|
|
808
830
|
cache.counter += 1;
|
|
@@ -825,8 +847,8 @@ class MidyGMLite {
|
|
|
825
847
|
const controllerState = this.getControllerState(channel, noteNumber, velocity);
|
|
826
848
|
const voiceParams = voice.getAllParams(controllerState);
|
|
827
849
|
const note = new Note(noteNumber, velocity, startTime, voice, voiceParams);
|
|
828
|
-
const audioBuffer = await this.getAudioBuffer(channel.
|
|
829
|
-
note.bufferSource = this.createBufferSource(
|
|
850
|
+
const audioBuffer = await this.getAudioBuffer(channel.programNumber, noteNumber, velocity, voiceParams, isSF3);
|
|
851
|
+
note.bufferSource = this.createBufferSource(voiceParams, audioBuffer);
|
|
830
852
|
note.volumeEnvelopeNode = new GainNode(this.audioContext);
|
|
831
853
|
note.filterNode = new BiquadFilterNode(this.audioContext, {
|
|
832
854
|
type: "lowpass",
|
|
@@ -843,14 +865,43 @@ class MidyGMLite {
|
|
|
843
865
|
note.bufferSource.start(startTime);
|
|
844
866
|
return note;
|
|
845
867
|
}
|
|
868
|
+
handleExclusiveClass(note, channelNumber, startTime) {
|
|
869
|
+
const exclusiveClass = note.voiceParams.exclusiveClass;
|
|
870
|
+
if (exclusiveClass === 0)
|
|
871
|
+
return;
|
|
872
|
+
const prev = this.exclusiveClassNotes[exclusiveClass];
|
|
873
|
+
if (prev) {
|
|
874
|
+
const [prevNote, prevChannelNumber] = prev;
|
|
875
|
+
if (prevNote && !prevNote.ending) {
|
|
876
|
+
this.scheduleNoteOff(prevChannelNumber, prevNote.noteNumber, 0, // velocity,
|
|
877
|
+
startTime, true);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
this.exclusiveClassNotes[exclusiveClass] = [note, channelNumber];
|
|
881
|
+
}
|
|
882
|
+
handleDrumExclusiveClass(note, channelNumber, startTime) {
|
|
883
|
+
const channel = this.channels[channelNumber];
|
|
884
|
+
if (!channel.isDrum)
|
|
885
|
+
return;
|
|
886
|
+
const drumExclusiveClass = drumExclusiveClasses[noteNumber];
|
|
887
|
+
if (drumExclusiveClass === 0)
|
|
888
|
+
return;
|
|
889
|
+
const index = drumExclusiveClass * this.channels.length + channelNumber;
|
|
890
|
+
const prevNote = this.drumExclusiveClassNotes[index];
|
|
891
|
+
if (prevNote && !prevNote.ending) {
|
|
892
|
+
this.scheduleNoteOff(channelNumber, prevNote.noteNumber, 0, // velocity,
|
|
893
|
+
startTime, true);
|
|
894
|
+
}
|
|
895
|
+
this.drumExclusiveClassNotes[index] = note;
|
|
896
|
+
}
|
|
846
897
|
async scheduleNoteOn(channelNumber, noteNumber, velocity, startTime) {
|
|
847
898
|
const channel = this.channels[channelNumber];
|
|
848
899
|
const bankNumber = channel.bank;
|
|
849
|
-
const soundFontIndex = this.soundFontTable[channel.
|
|
900
|
+
const soundFontIndex = this.soundFontTable[channel.programNumber].get(bankNumber);
|
|
850
901
|
if (soundFontIndex === undefined)
|
|
851
902
|
return;
|
|
852
903
|
const soundFont = this.soundFonts[soundFontIndex];
|
|
853
|
-
const voice = soundFont.getVoice(bankNumber, channel.
|
|
904
|
+
const voice = soundFont.getVoice(bankNumber, channel.programNumber, noteNumber, velocity);
|
|
854
905
|
if (!voice)
|
|
855
906
|
return;
|
|
856
907
|
const isSF3 = soundFont.parsed.info.version.major === 3;
|
|
@@ -860,30 +911,45 @@ class MidyGMLite {
|
|
|
860
911
|
if (0.5 <= channel.state.sustainPedal) {
|
|
861
912
|
channel.sustainNotes.push(note);
|
|
862
913
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
if (this.exclusiveClassMap.has(exclusiveClass)) {
|
|
866
|
-
const prevEntry = this.exclusiveClassMap.get(exclusiveClass);
|
|
867
|
-
const [prevNote, prevChannelNumber] = prevEntry;
|
|
868
|
-
if (prevNote && !prevNote.ending) {
|
|
869
|
-
this.scheduleNoteOff(prevChannelNumber, prevNote.noteNumber, 0, // velocity,
|
|
870
|
-
startTime, true);
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
this.exclusiveClassMap.set(exclusiveClass, [note, channelNumber]);
|
|
874
|
-
}
|
|
914
|
+
this.handleExclusiveClass(note, channelNumber, startTime);
|
|
915
|
+
this.handleDrumExclusiveClass(note, channelNumber, startTime);
|
|
875
916
|
const scheduledNotes = channel.scheduledNotes;
|
|
876
|
-
|
|
877
|
-
|
|
917
|
+
let notes = scheduledNotes.get(noteNumber);
|
|
918
|
+
if (notes) {
|
|
919
|
+
notes.push(note);
|
|
878
920
|
}
|
|
879
921
|
else {
|
|
880
|
-
|
|
922
|
+
notes = [note];
|
|
923
|
+
scheduledNotes.set(noteNumber, notes);
|
|
924
|
+
}
|
|
925
|
+
if (this.isDrumNoteOffException(channel, noteNumber)) {
|
|
926
|
+
const stopTime = startTime + note.bufferSource.buffer.duration;
|
|
927
|
+
const index = notes.length - 1;
|
|
928
|
+
const promise = new Promise((resolve) => {
|
|
929
|
+
note.bufferSource.onended = () => {
|
|
930
|
+
this.disconnectNote(note, scheduledNotes, index);
|
|
931
|
+
resolve();
|
|
932
|
+
};
|
|
933
|
+
note.bufferSource.stop(stopTime);
|
|
934
|
+
});
|
|
935
|
+
this.notePromises.push(promise);
|
|
881
936
|
}
|
|
882
937
|
}
|
|
883
938
|
noteOn(channelNumber, noteNumber, velocity, scheduleTime) {
|
|
884
939
|
scheduleTime ??= this.audioContext.currentTime;
|
|
885
940
|
return this.scheduleNoteOn(channelNumber, noteNumber, velocity, scheduleTime);
|
|
886
941
|
}
|
|
942
|
+
disconnectNote(note, scheduledNotes, index) {
|
|
943
|
+
scheduledNotes[index] = null;
|
|
944
|
+
note.bufferSource.disconnect();
|
|
945
|
+
note.filterNode.disconnect();
|
|
946
|
+
note.volumeEnvelopeNode.disconnect();
|
|
947
|
+
if (note.modulationDepth) {
|
|
948
|
+
note.volumeDepth.disconnect();
|
|
949
|
+
note.modulationDepth.disconnect();
|
|
950
|
+
note.modulationLFO.stop();
|
|
951
|
+
}
|
|
952
|
+
}
|
|
887
953
|
stopNote(endTime, stopTime, scheduledNotes, index) {
|
|
888
954
|
const note = scheduledNotes[index];
|
|
889
955
|
note.volumeEnvelopeNode.gain
|
|
@@ -895,15 +961,7 @@ class MidyGMLite {
|
|
|
895
961
|
}, stopTime);
|
|
896
962
|
return new Promise((resolve) => {
|
|
897
963
|
note.bufferSource.onended = () => {
|
|
898
|
-
scheduledNotes
|
|
899
|
-
note.bufferSource.disconnect();
|
|
900
|
-
note.filterNode.disconnect();
|
|
901
|
-
note.volumeEnvelopeNode.disconnect();
|
|
902
|
-
if (note.modulationDepth) {
|
|
903
|
-
note.volumeDepth.disconnect();
|
|
904
|
-
note.modulationDepth.disconnect();
|
|
905
|
-
note.modulationLFO.stop();
|
|
906
|
-
}
|
|
964
|
+
this.disconnectNote(note, scheduledNotes, index);
|
|
907
965
|
resolve();
|
|
908
966
|
};
|
|
909
967
|
note.bufferSource.stop(stopTime);
|
|
@@ -911,6 +969,8 @@ class MidyGMLite {
|
|
|
911
969
|
}
|
|
912
970
|
scheduleNoteOff(channelNumber, noteNumber, _velocity, endTime, force) {
|
|
913
971
|
const channel = this.channels[channelNumber];
|
|
972
|
+
if (channel.isDrum)
|
|
973
|
+
return;
|
|
914
974
|
if (!force && 0.5 <= channel.state.sustainPedal)
|
|
915
975
|
return;
|
|
916
976
|
if (!channel.scheduledNotes.has(noteNumber))
|
|
@@ -964,9 +1024,9 @@ class MidyGMLite {
|
|
|
964
1024
|
console.warn(`Unsupported MIDI message: ${messageType.toString(16)}`);
|
|
965
1025
|
}
|
|
966
1026
|
}
|
|
967
|
-
handleProgramChange(channelNumber,
|
|
1027
|
+
handleProgramChange(channelNumber, programNumber, _scheduleTime) {
|
|
968
1028
|
const channel = this.channels[channelNumber];
|
|
969
|
-
channel.
|
|
1029
|
+
channel.programNumber = programNumber;
|
|
970
1030
|
}
|
|
971
1031
|
handlePitchBendMessage(channelNumber, lsb, msb, scheduleTime) {
|
|
972
1032
|
const pitchBend = msb * 128 + lsb;
|
|
@@ -974,8 +1034,6 @@ class MidyGMLite {
|
|
|
974
1034
|
}
|
|
975
1035
|
setPitchBend(channelNumber, value, scheduleTime) {
|
|
976
1036
|
const channel = this.channels[channelNumber];
|
|
977
|
-
if (channel.isDrum)
|
|
978
|
-
return;
|
|
979
1037
|
scheduleTime ??= this.audioContext.currentTime;
|
|
980
1038
|
const state = channel.state;
|
|
981
1039
|
const prev = state.pitchWheel * 2 - 1;
|
|
@@ -1138,8 +1196,6 @@ class MidyGMLite {
|
|
|
1138
1196
|
}
|
|
1139
1197
|
setModulationDepth(channelNumber, modulation, scheduleTime) {
|
|
1140
1198
|
const channel = this.channels[channelNumber];
|
|
1141
|
-
if (channel.isDrum)
|
|
1142
|
-
return;
|
|
1143
1199
|
scheduleTime ??= this.audioContext.currentTime;
|
|
1144
1200
|
channel.state.modulationDepth = modulation / 127;
|
|
1145
1201
|
this.updateModulation(channel, scheduleTime);
|
|
@@ -1186,8 +1242,6 @@ class MidyGMLite {
|
|
|
1186
1242
|
}
|
|
1187
1243
|
setSustainPedal(channelNumber, value, scheduleTime) {
|
|
1188
1244
|
const channel = this.channels[channelNumber];
|
|
1189
|
-
if (channel.isDrum)
|
|
1190
|
-
return;
|
|
1191
1245
|
scheduleTime ??= this.audioContext.currentTime;
|
|
1192
1246
|
channel.state.sustainPedal = value / 127;
|
|
1193
1247
|
if (64 <= value) {
|
|
@@ -1246,8 +1300,6 @@ class MidyGMLite {
|
|
|
1246
1300
|
}
|
|
1247
1301
|
setPitchBendRange(channelNumber, value, scheduleTime) {
|
|
1248
1302
|
const channel = this.channels[channelNumber];
|
|
1249
|
-
if (channel.isDrum)
|
|
1250
|
-
return;
|
|
1251
1303
|
scheduleTime ??= this.audioContext.currentTime;
|
|
1252
1304
|
const state = channel.state;
|
|
1253
1305
|
const prev = state.pitchWheelSensitivity;
|
|
@@ -1261,12 +1313,24 @@ class MidyGMLite {
|
|
|
1261
1313
|
scheduleTime ??= this.audioContext.currentTime;
|
|
1262
1314
|
return this.stopChannelNotes(channelNumber, 0, true, scheduleTime);
|
|
1263
1315
|
}
|
|
1316
|
+
resetAllStates(channelNumber) {
|
|
1317
|
+
const channel = this.channels[channelNumber];
|
|
1318
|
+
const state = channel.state;
|
|
1319
|
+
for (const type of Object.keys(defaultControllerState)) {
|
|
1320
|
+
state[type] = defaultControllerState[type].defaultValue;
|
|
1321
|
+
}
|
|
1322
|
+
for (const type of Object.keys(this.constructor.channelSettings)) {
|
|
1323
|
+
channel[type] = this.constructor.channelSettings[type];
|
|
1324
|
+
}
|
|
1325
|
+
this.mode = "GM1";
|
|
1326
|
+
}
|
|
1327
|
+
// https://amei.or.jp/midistandardcommittee/Recommended_Practice/e/rp15.pdf
|
|
1264
1328
|
resetAllControllers(channelNumber) {
|
|
1265
1329
|
const stateTypes = [
|
|
1330
|
+
"pitchWheel",
|
|
1266
1331
|
"expression",
|
|
1267
1332
|
"modulationDepth",
|
|
1268
1333
|
"sustainPedal",
|
|
1269
|
-
"pitchWheelSensitivity",
|
|
1270
1334
|
];
|
|
1271
1335
|
const channel = this.channels[channelNumber];
|
|
1272
1336
|
const state = channel.state;
|
|
@@ -1355,6 +1419,7 @@ class MidyGMLite {
|
|
|
1355
1419
|
console.warn(`Unsupported Exclusive Message: ${data}`);
|
|
1356
1420
|
}
|
|
1357
1421
|
}
|
|
1422
|
+
// https://github.com/marmooo/js-timer-benchmark
|
|
1358
1423
|
scheduleTask(callback, scheduleTime) {
|
|
1359
1424
|
return new Promise((resolve) => {
|
|
1360
1425
|
const bufferSource = new AudioBufferSourceNode(this.audioContext, {
|
|
@@ -1380,10 +1445,8 @@ Object.defineProperty(MidyGMLite, "channelSettings", {
|
|
|
1380
1445
|
configurable: true,
|
|
1381
1446
|
writable: true,
|
|
1382
1447
|
value: {
|
|
1383
|
-
currentBufferSource: null,
|
|
1384
|
-
isDrum: false,
|
|
1385
1448
|
detune: 0,
|
|
1386
|
-
|
|
1449
|
+
programNumber: 0,
|
|
1387
1450
|
bank: 0,
|
|
1388
1451
|
dataMSB: 0,
|
|
1389
1452
|
dataLSB: 0,
|
package/script/midy.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export class Midy {
|
|
2
2
|
static channelSettings: {
|
|
3
|
-
currentBufferSource: null;
|
|
4
|
-
isDrum: boolean;
|
|
5
3
|
detune: number;
|
|
6
|
-
|
|
4
|
+
programNumber: number;
|
|
7
5
|
bank: number;
|
|
8
6
|
bankMSB: number;
|
|
9
7
|
bankLSB: number;
|
|
@@ -23,8 +21,6 @@ export class Midy {
|
|
|
23
21
|
};
|
|
24
22
|
});
|
|
25
23
|
mode: string;
|
|
26
|
-
ticksPerBeat: number;
|
|
27
|
-
totalTime: number;
|
|
28
24
|
masterFineTuning: number;
|
|
29
25
|
masterCoarseTuning: number;
|
|
30
26
|
reverb: {
|
|
@@ -38,6 +34,9 @@ export class Midy {
|
|
|
38
34
|
sendToReverb: number;
|
|
39
35
|
delayTimes: any[];
|
|
40
36
|
};
|
|
37
|
+
numChannels: number;
|
|
38
|
+
ticksPerBeat: number;
|
|
39
|
+
totalTime: number;
|
|
41
40
|
noteCheckInterval: number;
|
|
42
41
|
lookAhead: number;
|
|
43
42
|
startDelay: number;
|
|
@@ -55,7 +54,8 @@ export class Midy {
|
|
|
55
54
|
timeline: any[];
|
|
56
55
|
instruments: any[];
|
|
57
56
|
notePromises: any[];
|
|
58
|
-
|
|
57
|
+
exclusiveClassNotes: any[];
|
|
58
|
+
drumExclusiveClassNotes: any[];
|
|
59
59
|
defaultOptions: {
|
|
60
60
|
reverbAlgorithm: (audioContext: any) => {
|
|
61
61
|
input: any;
|
|
@@ -145,8 +145,7 @@ export class Midy {
|
|
|
145
145
|
};
|
|
146
146
|
createChannels(audioContext: any): any[];
|
|
147
147
|
createNoteBuffer(voiceParams: any, isSF3: any): Promise<any>;
|
|
148
|
-
|
|
149
|
-
createBufferSource(channel: any, note: any, voiceParams: any, audioBuffer: any): any;
|
|
148
|
+
createBufferSource(voiceParams: any, audioBuffer: any): any;
|
|
150
149
|
findPortamentoTarget(queueIndex: any): any;
|
|
151
150
|
scheduleTimelineEvents(t: any, offset: any, queueIndex: any): Promise<any>;
|
|
152
151
|
getQueueIndex(second: any): number;
|
|
@@ -209,11 +208,15 @@ export class Midy {
|
|
|
209
208
|
setFilterEnvelope(channel: any, note: any, scheduleTime: any): void;
|
|
210
209
|
startModulation(channel: any, note: any, scheduleTime: any): void;
|
|
211
210
|
startVibrato(channel: any, note: any, scheduleTime: any): void;
|
|
212
|
-
getAudioBuffer(
|
|
211
|
+
getAudioBuffer(programNumber: any, noteNumber: any, velocity: any, voiceParams: any, isSF3: any): Promise<any>;
|
|
213
212
|
createNote(channel: any, voice: any, noteNumber: any, velocity: any, startTime: any, portamento: any, isSF3: any): Promise<Note>;
|
|
214
213
|
calcBank(channel: any): any;
|
|
214
|
+
handleExclusiveClass(note: any, channelNumber: any, startTime: any): void;
|
|
215
|
+
handleDrumExclusiveClass(note: any, channelNumber: any, startTime: any): void;
|
|
216
|
+
isDrumNoteOffException(channel: any, noteNumber: any): boolean;
|
|
215
217
|
scheduleNoteOn(channelNumber: any, noteNumber: any, velocity: any, startTime: any, portamento: any): Promise<void>;
|
|
216
218
|
noteOn(channelNumber: any, noteNumber: any, velocity: any, scheduleTime: any): Promise<void>;
|
|
219
|
+
disconnectNote(note: any, scheduledNotes: any, index: any): void;
|
|
217
220
|
stopNote(endTime: any, stopTime: any, scheduledNotes: any, index: any): Promise<any>;
|
|
218
221
|
scheduleNoteOff(channelNumber: any, noteNumber: any, _velocity: any, endTime: any, force: any, portamentoNoteNumber: any): Promise<any> | undefined;
|
|
219
222
|
noteOff(channelNumber: any, noteNumber: any, velocity: any, scheduleTime: any): Promise<any> | undefined;
|
|
@@ -221,7 +224,7 @@ export class Midy {
|
|
|
221
224
|
releaseSostenutoPedal(channelNumber: any, halfVelocity: any, scheduleTime: any): any[];
|
|
222
225
|
handleMIDIMessage(statusByte: any, data1: any, data2: any, scheduleTime: any): void | Promise<any>;
|
|
223
226
|
handlePolyphonicKeyPressure(channelNumber: any, noteNumber: any, pressure: any, scheduleTime: any): void;
|
|
224
|
-
handleProgramChange(channelNumber: any,
|
|
227
|
+
handleProgramChange(channelNumber: any, programNumber: any, _scheduleTime: any): void;
|
|
225
228
|
handleChannelPressure(channelNumber: any, value: any, scheduleTime: any): void;
|
|
226
229
|
handlePitchBendMessage(channelNumber: any, lsb: any, msb: any, scheduleTime: any): void;
|
|
227
230
|
setPitchBend(channelNumber: any, value: any, scheduleTime: any): void;
|
|
@@ -332,6 +335,7 @@ export class Midy {
|
|
|
332
335
|
handleModulationDepthRangeRPN(channelNumber: any, scheduleTime: any): void;
|
|
333
336
|
setModulationDepthRange(channelNumber: any, modulationDepthRange: any, scheduleTime: any): void;
|
|
334
337
|
allSoundOff(channelNumber: any, _value: any, scheduleTime: any): Promise<any[]>;
|
|
338
|
+
resetAllStates(channelNumber: any): void;
|
|
335
339
|
resetAllControllers(channelNumber: any): void;
|
|
336
340
|
allNotesOff(channelNumber: any, _value: any, scheduleTime: any): Promise<any[]>;
|
|
337
341
|
omniOff(channelNumber: any, value: any, scheduleTime: any): void;
|
package/script/midy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"midy.d.ts","sourceRoot":"","sources":["../src/midy.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"midy.d.ts","sourceRoot":"","sources":["../src/midy.js"],"names":[],"mappings":"AAkNA;IAwCE;;;;;;;;;;;;;;MAcE;IAgCF;;;;;OAmBC;IAxGD,aAAa;IACb,yBAAqB;IACrB,2BAAuB;IACvB;;;MAGE;IACF;;;;;;MAME;IACF,oBAAiB;IACjB,qBAAmB;IACnB,kBAAc;IACd,0BAAwB;IACxB,kBAAc;IACd,mBAAiB;IACjB,kBAAc;IACd,mBAAe;IACf,kBAAgB;IAChB,sBAA2C;IAC3C,kCAA+B;IAC/B,gCAA6B;IAC7B,mBAAkB;IAClB,mBAAkB;IAClB,kBAAiB;IACjB,oBAAmB;IACnB,mBAAkB;IAClB,gBAAc;IACd,mBAAiB;IACjB,oBAAkB;IAClB,2BAAqC;IACrC,+BAEE;IAkBF;;;;;MA4BE;IAGA,kBAAgC;IAChC;;;;;MAAqD;IACrD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