@marmooo/midy 0.1.2 → 0.1.3

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.
Files changed (35) hide show
  1. package/esm/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.4/+esm.d.ts +153 -0
  2. package/esm/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.4/+esm.d.ts.map +1 -0
  3. package/esm/deps/cdn.jsdelivr.net/npm/@marmooo/{soundfont-parser@0.0.2 → soundfont-parser@0.0.4}/+esm.js +73 -66
  4. package/esm/midy-GM1.d.ts +17 -12
  5. package/esm/midy-GM1.d.ts.map +1 -1
  6. package/esm/midy-GM1.js +125 -96
  7. package/esm/midy-GM2.d.ts +21 -14
  8. package/esm/midy-GM2.d.ts.map +1 -1
  9. package/esm/midy-GM2.js +146 -107
  10. package/esm/midy-GMLite.d.ts +15 -12
  11. package/esm/midy-GMLite.d.ts.map +1 -1
  12. package/esm/midy-GMLite.js +115 -98
  13. package/esm/midy.d.ts +18 -15
  14. package/esm/midy.d.ts.map +1 -1
  15. package/esm/midy.js +147 -134
  16. package/package.json +1 -1
  17. package/script/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.4/+esm.d.ts +153 -0
  18. package/script/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.4/+esm.d.ts.map +1 -0
  19. package/script/deps/cdn.jsdelivr.net/npm/@marmooo/{soundfont-parser@0.0.2 → soundfont-parser@0.0.4}/+esm.js +75 -68
  20. package/script/midy-GM1.d.ts +17 -12
  21. package/script/midy-GM1.d.ts.map +1 -1
  22. package/script/midy-GM1.js +125 -96
  23. package/script/midy-GM2.d.ts +21 -14
  24. package/script/midy-GM2.d.ts.map +1 -1
  25. package/script/midy-GM2.js +146 -107
  26. package/script/midy-GMLite.d.ts +15 -12
  27. package/script/midy-GMLite.d.ts.map +1 -1
  28. package/script/midy-GMLite.js +115 -98
  29. package/script/midy.d.ts +18 -15
  30. package/script/midy.d.ts.map +1 -1
  31. package/script/midy.js +147 -134
  32. package/esm/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.2/+esm.d.ts +0 -135
  33. package/esm/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.2/+esm.d.ts.map +0 -1
  34. package/script/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.2/+esm.d.ts +0 -135
  35. package/script/deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.2/+esm.d.ts.map +0 -1
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MidyGM1 = void 0;
4
4
  const _esm_js_1 = require("./deps/cdn.jsdelivr.net/npm/midi-file@1.2.4/+esm.js");
5
- const _esm_js_2 = require("./deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.2/+esm.js");
5
+ const _esm_js_2 = require("./deps/cdn.jsdelivr.net/npm/@marmooo/soundfont-parser@0.0.4/+esm.js");
6
6
  class Note {
7
7
  constructor(noteNumber, velocity, startTime, instrumentKey) {
8
8
  Object.defineProperty(this, "bufferSource", {
@@ -11,25 +11,43 @@ class Note {
11
11
  writable: true,
12
12
  value: void 0
13
13
  });
14
- Object.defineProperty(this, "gainNode", {
14
+ Object.defineProperty(this, "filterNode", {
15
15
  enumerable: true,
16
16
  configurable: true,
17
17
  writable: true,
18
18
  value: void 0
19
19
  });
20
- Object.defineProperty(this, "filterNode", {
20
+ Object.defineProperty(this, "volumeNode", {
21
+ enumerable: true,
22
+ configurable: true,
23
+ writable: true,
24
+ value: void 0
25
+ });
26
+ Object.defineProperty(this, "volumeDepth", {
27
+ enumerable: true,
28
+ configurable: true,
29
+ writable: true,
30
+ value: void 0
31
+ });
32
+ Object.defineProperty(this, "modulationLFO", {
33
+ enumerable: true,
34
+ configurable: true,
35
+ writable: true,
36
+ value: void 0
37
+ });
38
+ Object.defineProperty(this, "modulationDepth", {
21
39
  enumerable: true,
22
40
  configurable: true,
23
41
  writable: true,
24
42
  value: void 0
25
43
  });
26
- Object.defineProperty(this, "modLFO", {
44
+ Object.defineProperty(this, "vibratoLFO", {
27
45
  enumerable: true,
28
46
  configurable: true,
29
47
  writable: true,
30
48
  value: void 0
31
49
  });
32
- Object.defineProperty(this, "modLFOGain", {
50
+ Object.defineProperty(this, "vibratoDepth", {
33
51
  enumerable: true,
34
52
  configurable: true,
35
53
  writable: true,
@@ -316,7 +334,7 @@ class MidyGM1 {
316
334
  const t = this.audioContext.currentTime + offset;
317
335
  queueIndex = await this.scheduleTimelineEvents(t, offset, queueIndex);
318
336
  if (this.isPausing) {
319
- await this.stopNotes();
337
+ await this.stopNotes(0, true);
320
338
  this.notePromises = [];
321
339
  resolve();
322
340
  this.isPausing = false;
@@ -324,7 +342,7 @@ class MidyGM1 {
324
342
  return;
325
343
  }
326
344
  else if (this.isStopping) {
327
- await this.stopNotes();
345
+ await this.stopNotes(0, true);
328
346
  this.notePromises = [];
329
347
  resolve();
330
348
  this.isStopping = false;
@@ -332,7 +350,7 @@ class MidyGM1 {
332
350
  return;
333
351
  }
334
352
  else if (this.isSeeking) {
335
- this.stopNotes();
353
+ this.stopNotes(0, true);
336
354
  this.startTime = this.audioContext.currentTime;
337
355
  queueIndex = this.getQueueIndex(this.resumeTime);
338
356
  offset = this.resumeTime - this.startTime;
@@ -413,21 +431,24 @@ class MidyGM1 {
413
431
  }
414
432
  return { instruments, timeline };
415
433
  }
416
- stopNotes() {
434
+ async stopChannelNotes(channelNumber, velocity, stopPedal) {
417
435
  const now = this.audioContext.currentTime;
418
- const velocity = 0;
419
- const stopPedal = true;
420
- this.channels.forEach((channel, channelNumber) => {
421
- channel.scheduledNotes.forEach((scheduledNotes) => {
422
- scheduledNotes.forEach((scheduledNote) => {
423
- if (scheduledNote) {
424
- const promise = this.scheduleNoteRelease(channelNumber, scheduledNote.noteNumber, velocity, now, stopPedal);
425
- this.notePromises.push(promise);
426
- }
427
- });
436
+ const channel = this.channels[channelNumber];
437
+ channel.scheduledNotes.forEach((noteList) => {
438
+ noteList.forEach((note) => {
439
+ if (note) {
440
+ const promise = this.scheduleNoteRelease(channelNumber, note.noteNumber, velocity, now, stopPedal);
441
+ this.notePromises.push(promise);
442
+ }
428
443
  });
429
- channel.scheduledNotes.clear();
430
444
  });
445
+ channel.scheduledNotes.clear();
446
+ await Promise.all(this.notePromises);
447
+ }
448
+ stopNotes(velocity, stopPedal) {
449
+ for (let i = 0; i < this.channels.length; i++) {
450
+ this.stopChannelNotes(i, velocity, stopPedal);
451
+ }
431
452
  return Promise.all(this.notePromises);
432
453
  }
433
454
  async start() {
@@ -511,21 +532,39 @@ class MidyGM1 {
511
532
  }
512
533
  setVolumeEnvelope(note) {
513
534
  const { instrumentKey, startTime } = note;
514
- note.gainNode = new GainNode(this.audioContext, { gain: 0 });
535
+ note.volumeNode = new GainNode(this.audioContext, { gain: 0 });
515
536
  const attackVolume = this.cbToRatio(-instrumentKey.initialAttenuation);
516
537
  const sustainVolume = attackVolume * (1 - instrumentKey.volSustain);
517
538
  const volDelay = startTime + instrumentKey.volDelay;
518
539
  const volAttack = volDelay + instrumentKey.volAttack;
519
540
  const volHold = volAttack + instrumentKey.volHold;
520
541
  const volDecay = volHold + instrumentKey.volDecay;
521
- note.gainNode.gain
542
+ note.volumeNode.gain
522
543
  .setValueAtTime(1e-6, volDelay) // exponentialRampToValueAtTime() requires a non-zero value
523
544
  .exponentialRampToValueAtTime(attackVolume, volAttack)
524
545
  .setValueAtTime(attackVolume, volHold)
525
546
  .linearRampToValueAtTime(sustainVolume, volDecay);
526
547
  }
527
- setFilterEnvelope(channel, note) {
528
- const { instrumentKey, startTime, noteNumber } = note;
548
+ setPitch(note, semitoneOffset) {
549
+ const { instrumentKey, noteNumber, startTime } = note;
550
+ const modEnvToPitch = instrumentKey.modEnvToPitch / 100;
551
+ note.bufferSource.playbackRate.value = this.calcPlaybackRate(instrumentKey, noteNumber, semitoneOffset);
552
+ if (modEnvToPitch === 0)
553
+ return;
554
+ const basePitch = note.bufferSource.playbackRate.value;
555
+ const peekPitch = this.calcPlaybackRate(instrumentKey, noteNumber, semitoneOffset + modEnvToPitch);
556
+ const modDelay = startTime + instrumentKey.modDelay;
557
+ const modAttack = modDelay + instrumentKey.modAttack;
558
+ const modHold = modAttack + instrumentKey.modHold;
559
+ const modDecay = modHold + instrumentKey.modDecay;
560
+ note.bufferSource.playbackRate.value
561
+ .setValueAtTime(basePitch, modDelay)
562
+ .exponentialRampToValueAtTime(peekPitch, modAttack)
563
+ .setValueAtTime(peekPitch, modHold)
564
+ .linearRampToValueAtTime(basePitch, modDecay);
565
+ }
566
+ setFilterNode(channel, note) {
567
+ const { instrumentKey, noteNumber, startTime } = note;
529
568
  const softPedalFactor = 1 -
530
569
  (0.1 + (noteNumber / 127) * 0.2) * channel.softPedal;
531
570
  const maxFreq = this.audioContext.sampleRate / 2;
@@ -534,13 +573,13 @@ class MidyGM1 {
534
573
  const peekFreq = this.centToHz(instrumentKey.initialFilterFc + instrumentKey.modEnvToFilterFc) * softPedalFactor;
535
574
  const sustainFreq = (baseFreq +
536
575
  (peekFreq - baseFreq) * (1 - instrumentKey.modSustain)) * softPedalFactor;
576
+ const adjustedBaseFreq = Math.min(maxFreq, baseFreq);
577
+ const adjustedPeekFreq = Math.min(maxFreq, peekFreq);
578
+ const adjustedSustainFreq = Math.min(maxFreq, sustainFreq);
537
579
  const modDelay = startTime + instrumentKey.modDelay;
538
580
  const modAttack = modDelay + instrumentKey.modAttack;
539
581
  const modHold = modAttack + instrumentKey.modHold;
540
582
  const modDecay = modHold + instrumentKey.modDecay;
541
- const adjustedBaseFreq = Math.min(maxFreq, baseFreq);
542
- const adjustedPeekFreq = Math.min(maxFreq, peekFreq);
543
- const adjustedSustainFreq = Math.min(maxFreq, sustainFreq);
544
583
  note.filterNode = new BiquadFilterNode(this.audioContext, {
545
584
  type: "lowpass",
546
585
  Q: instrumentKey.initialFilterQ / 10, // dB
@@ -551,35 +590,49 @@ class MidyGM1 {
551
590
  .exponentialRampToValueAtTime(adjustedPeekFreq, modAttack)
552
591
  .setValueAtTime(adjustedPeekFreq, modHold)
553
592
  .linearRampToValueAtTime(adjustedSustainFreq, modDecay);
554
- note.bufferSource.detune.setValueAtTime(note.bufferSource.detune.value + instrumentKey.modEnvToPitch, modDelay);
555
593
  }
556
- startModulation(channel, note, time) {
594
+ startModulation(channel, note, startTime) {
557
595
  const { instrumentKey } = note;
558
- note.modLFOGain = new GainNode(this.audioContext, {
559
- gain: this.cbToRatio(instrumentKey.modLfoToVolume + channel.modulation),
560
- });
561
- note.modLFO = new OscillatorNode(this.audioContext, {
596
+ const { modLfoToPitch, modLfoToVolume } = instrumentKey;
597
+ note.modulationLFO = new OscillatorNode(this.audioContext, {
562
598
  frequency: this.centToHz(instrumentKey.freqModLFO),
563
599
  });
564
- note.modLFO.start(time);
565
- note.filterNode.frequency.setValueAtTime(note.filterNode.frequency.value + instrumentKey.modLfoToFilterFc, time);
566
- note.bufferSource.detune.setValueAtTime(note.bufferSource.detune.value + instrumentKey.modLfoToPitch, time);
567
- note.modLFO.connect(note.modLFOGain);
568
- note.modLFOGain.connect(note.bufferSource.detune);
600
+ note.filterDepth = new GainNode(this.audioContext, {
601
+ gain: instrumentKey.modLfoToFilterFc,
602
+ });
603
+ const modulationDepth = Math.abs(modLfoToPitch) + channel.modulationDepth;
604
+ const modulationDepthSign = (0 < modLfoToPitch) ? 1 : -1;
605
+ note.modulationDepth = new GainNode(this.audioContext, {
606
+ gain: modulationDepth * modulationDepthSign,
607
+ });
608
+ const volumeDepth = this.cbToRatio(Math.abs(modLfoToVolume)) - 1;
609
+ const volumeDepthSign = (0 < modLfoToVolume) ? 1 : -1;
610
+ note.volumeDepth = new GainNode(this.audioContext, {
611
+ gain: volumeDepth * volumeDepthSign,
612
+ });
613
+ note.modulationLFO.start(startTime + instrumentKey.delayModLFO);
614
+ note.modulationLFO.connect(note.filterDepth);
615
+ note.filterDepth.connect(note.filterNode.frequency);
616
+ note.modulationLFO.connect(note.modulationDepth);
617
+ note.modulationDepth.connect(note.bufferSource.detune);
618
+ note.modulationLFO.connect(note.volumeDepth);
619
+ note.volumeDepth.connect(note.volumeNode.gain);
569
620
  }
570
621
  async createNote(channel, instrumentKey, noteNumber, velocity, startTime, isSF3) {
571
622
  const semitoneOffset = this.calcSemitoneOffset(channel);
572
623
  const note = new Note(noteNumber, velocity, startTime, instrumentKey);
573
624
  note.bufferSource = await this.createNoteBufferNode(instrumentKey, isSF3);
574
- note.bufferSource.playbackRate.value = this.calcPlaybackRate(instrumentKey, noteNumber, semitoneOffset);
625
+ this.setFilterNode(channel, note);
575
626
  this.setVolumeEnvelope(note);
576
- this.setFilterEnvelope(channel, note);
577
- if (channel.modulation > 0) {
578
- const delayModLFO = startTime + instrumentKey.delayModLFO;
579
- this.startModulation(channel, note, delayModLFO);
627
+ if (0 < channel.modulationDepth) {
628
+ this.setPitch(note, semitoneOffset);
629
+ this.startModulation(channel, note, startTime);
630
+ }
631
+ else {
632
+ note.bufferSource.playbackRate.value = this.calcPlaybackRate(instrumentKey, noteNumber, semitoneOffset);
580
633
  }
581
634
  note.bufferSource.connect(note.filterNode);
582
- note.filterNode.connect(note.gainNode);
635
+ note.filterNode.connect(note.volumeNode);
583
636
  note.bufferSource.start(startTime, instrumentKey.start / instrumentKey.sampleRate);
584
637
  return note;
585
638
  }
@@ -595,8 +648,8 @@ class MidyGM1 {
595
648
  if (!instrumentKey)
596
649
  return;
597
650
  const note = await this.createNote(channel, instrumentKey, noteNumber, velocity, startTime, isSF3);
598
- note.gainNode.connect(channel.gainL);
599
- note.gainNode.connect(channel.gainR);
651
+ note.volumeNode.connect(channel.gainL);
652
+ note.volumeNode.connect(channel.gainR);
600
653
  const scheduledNotes = channel.scheduledNotes;
601
654
  if (scheduledNotes.has(noteNumber)) {
602
655
  scheduledNotes.get(noteNumber).push(note);
@@ -625,17 +678,14 @@ class MidyGM1 {
625
678
  const velocityRate = (velocity + 127) / 127;
626
679
  const volEndTime = stopTime +
627
680
  note.instrumentKey.volRelease * velocityRate;
628
- note.gainNode.gain
681
+ note.volumeNode.gain
629
682
  .cancelScheduledValues(stopTime)
630
683
  .linearRampToValueAtTime(0, volEndTime);
631
- const maxFreq = this.audioContext.sampleRate / 2;
632
- const baseFreq = this.centToHz(note.instrumentKey.initialFilterFc);
633
- const adjustedBaseFreq = Math.min(maxFreq, baseFreq);
634
- const modEndTime = stopTime +
684
+ const modRelease = stopTime +
635
685
  note.instrumentKey.modRelease * velocityRate;
636
686
  note.filterNode.frequency
637
687
  .cancelScheduledValues(stopTime)
638
- .linearRampToValueAtTime(adjustedBaseFreq, modEndTime);
688
+ .linearRampToValueAtTime(0, modRelease);
639
689
  note.ending = true;
640
690
  this.scheduleTask(() => {
641
691
  note.bufferSource.loop = false;
@@ -644,15 +694,17 @@ class MidyGM1 {
644
694
  note.bufferSource.onended = () => {
645
695
  scheduledNotes[i] = null;
646
696
  note.bufferSource.disconnect();
697
+ note.volumeNode.disconnect();
647
698
  note.filterNode.disconnect();
648
- note.gainNode.disconnect();
649
- if (note.modLFOGain)
650
- note.modLFOGain.disconnect();
651
- if (note.modLFO)
652
- note.modLFO.stop();
699
+ if (note.volumeDepth)
700
+ note.volumeDepth.disconnect();
701
+ if (note.modulationDepth)
702
+ note.modulationDepth.disconnect();
703
+ if (note.modulationLFO)
704
+ note.modulationLFO.stop();
653
705
  resolve();
654
706
  };
655
- bufferSource.stop(volEndTime);
707
+ note.bufferSource.stop(volEndTime);
656
708
  });
657
709
  }
658
710
  }
@@ -665,10 +717,10 @@ class MidyGM1 {
665
717
  const channel = this.channels[channelNumber];
666
718
  const promises = [];
667
719
  channel.sustainPedal = false;
668
- channel.scheduledNotes.forEach((scheduledNotes) => {
669
- scheduledNotes.forEach((scheduledNote) => {
670
- if (scheduledNote) {
671
- const { noteNumber } = scheduledNote;
720
+ channel.scheduledNotes.forEach((noteList) => {
721
+ noteList.forEach((note) => {
722
+ if (note) {
723
+ const { noteNumber } = note;
672
724
  const promise = this.releaseNote(channelNumber, noteNumber, velocity);
673
725
  promises.push(promise);
674
726
  }
@@ -713,7 +765,7 @@ class MidyGM1 {
713
765
  handleControlChange(channelNumber, controller, value) {
714
766
  switch (controller) {
715
767
  case 1:
716
- return this.setModulation(channelNumber, value);
768
+ return this.setModulationDepth(channelNumber, value);
717
769
  case 6:
718
770
  return this.dataEntryMSB(channelNumber, value);
719
771
  case 7:
@@ -744,18 +796,19 @@ class MidyGM1 {
744
796
  const now = this.audioContext.currentTime;
745
797
  const activeNotes = this.getActiveNotes(channel, now);
746
798
  activeNotes.forEach((activeNote) => {
747
- if (activeNote.modLFO) {
748
- const { gainNode, instrumentKey } = activeNote;
749
- gainNode.gain.setValueAtTime(this.cbToRatio(instrumentKey.modLfoToVolume + channel.modulation), now);
799
+ if (activeNote.modulationDepth) {
800
+ activeNote.modulationDepth.gain.setValueAtTime(channel.modulationDepth, now);
750
801
  }
751
802
  else {
803
+ const semitoneOffset = this.calcSemitoneOffset(channel);
804
+ this.setPitch(activeNote, semitoneOffset);
752
805
  this.startModulation(channel, activeNote, now);
753
806
  }
754
807
  });
755
808
  }
756
- setModulation(channelNumber, modulation) {
809
+ setModulationDepth(channelNumber, modulation) {
757
810
  const channel = this.channels[channelNumber];
758
- channel.modulation = (modulation / 127) * channel.modulationDepthRange;
811
+ channel.modulationDepth = (modulation / 127) * channel.modulationDepthRange;
759
812
  this.updateModulation(channel);
760
813
  }
761
814
  setVolume(channelNumber, volume) {
@@ -907,37 +960,13 @@ class MidyGM1 {
907
960
  this.updateDetune(channel, detuneChange);
908
961
  }
909
962
  allSoundOff(channelNumber) {
910
- const now = this.audioContext.currentTime;
911
- const channel = this.channels[channelNumber];
912
- const velocity = 0;
913
- const stopPedal = true;
914
- const promises = [];
915
- channel.scheduledNotes.forEach((noteList) => {
916
- const activeNote = this.getActiveNote(noteList, now);
917
- if (activeNote) {
918
- const notePromise = this.scheduleNoteRelease(channelNumber, noteNumber, velocity, now, stopPedal);
919
- promises.push(notePromise);
920
- }
921
- });
922
- return promises;
963
+ return this.stopChannelNotes(channelNumber, 0, true);
923
964
  }
924
965
  resetAllControllers(channelNumber) {
925
966
  Object.assign(this.channels[channelNumber], this.effectSettings);
926
967
  }
927
968
  allNotesOff(channelNumber) {
928
- const now = this.audioContext.currentTime;
929
- const channel = this.channels[channelNumber];
930
- const velocity = 0;
931
- const stopPedal = false;
932
- const promises = [];
933
- channel.scheduledNotes.forEach((noteList) => {
934
- const activeNote = this.getActiveNote(noteList, now);
935
- if (activeNote) {
936
- const notePromise = this.scheduleNoteRelease(channelNumber, activeNote.noteNumber, velocity, now, stopPedal);
937
- promises.push(notePromise);
938
- }
939
- });
940
- return promises;
969
+ return this.stopChannelNotes(channelNumber, 0, false);
941
970
  }
942
971
  handleUniversalNonRealTimeExclusiveMessage(data) {
943
972
  switch (data[2]) {
@@ -1033,7 +1062,7 @@ Object.defineProperty(MidyGM1, "channelSettings", {
1033
1062
  pitchBend: 0,
1034
1063
  fineTuning: 0, // cb
1035
1064
  coarseTuning: 0, // cb
1036
- modulationDepthRange: 0.5, // cb
1065
+ modulationDepthRange: 50, // cent
1037
1066
  }
1038
1067
  });
1039
1068
  Object.defineProperty(MidyGM1, "effectSettings", {
@@ -1042,7 +1071,7 @@ Object.defineProperty(MidyGM1, "effectSettings", {
1042
1071
  writable: true,
1043
1072
  value: {
1044
1073
  expression: 1,
1045
- modulation: 0,
1074
+ modulationDepth: 0,
1046
1075
  sustainPedal: false,
1047
1076
  rpnMSB: 127,
1048
1077
  rpnLSB: 127,
@@ -6,6 +6,9 @@ export class MidyGM2 {
6
6
  portamentoTime: number;
7
7
  reverbSendLevel: number;
8
8
  chorusSendLevel: number;
9
+ vibratoRate: number;
10
+ vibratoDepth: number;
11
+ vibratoDelay: number;
9
12
  bank: number;
10
13
  bankMSB: number;
11
14
  bankLSB: number;
@@ -19,7 +22,7 @@ export class MidyGM2 {
19
22
  };
20
23
  static effectSettings: {
21
24
  expression: number;
22
- modulation: number;
25
+ modulationDepth: number;
23
26
  sustainPedal: boolean;
24
27
  portamento: boolean;
25
28
  sostenutoPedal: boolean;
@@ -125,7 +128,8 @@ export class MidyGM2 {
125
128
  instruments: Set<any>;
126
129
  timeline: any[];
127
130
  };
128
- stopNotes(): Promise<any[]>;
131
+ stopChannelNotes(channelNumber: any, velocity: any, stopPedal: any): Promise<void>;
132
+ stopNotes(velocity: any, stopPedal: any): Promise<any[]>;
129
133
  start(): Promise<void>;
130
134
  stop(): void;
131
135
  pause(): void;
@@ -162,8 +166,10 @@ export class MidyGM2 {
162
166
  calcSemitoneOffset(channel: any): any;
163
167
  calcPlaybackRate(instrumentKey: any, noteNumber: any, semitoneOffset: any): number;
164
168
  setVolumeEnvelope(note: any): void;
165
- setFilterEnvelope(channel: any, note: any): void;
166
- startModulation(channel: any, note: any, time: any): void;
169
+ setPitch(note: any, semitoneOffset: any): void;
170
+ setFilterNode(channel: any, note: any): void;
171
+ startModulation(channel: any, note: any, startTime: any): void;
172
+ startVibrato(channel: any, note: any, startTime: any): void;
167
173
  createNote(channel: any, instrumentKey: any, noteNumber: any, velocity: any, startTime: any, isSF3: any): Promise<Note>;
168
174
  calcBank(channel: any, channelNumber: any): any;
169
175
  scheduleNoteOn(channelNumber: any, noteNumber: any, velocity: any, startTime: any): Promise<void>;
@@ -172,15 +178,15 @@ export class MidyGM2 {
172
178
  releaseNote(channelNumber: any, noteNumber: any, velocity: any): Promise<any> | undefined;
173
179
  releaseSustainPedal(channelNumber: any, halfVelocity: any): any[];
174
180
  releaseSostenutoPedal(channelNumber: any, halfVelocity: any): any[];
175
- handleMIDIMessage(statusByte: any, data1: any, data2: any): void | any[] | Promise<any>;
181
+ handleMIDIMessage(statusByte: any, data1: any, data2: any): void | Promise<any>;
176
182
  handleProgramChange(channelNumber: any, program: any): void;
177
183
  handleChannelPressure(channelNumber: any, pressure: any): void;
178
184
  handlePitchBendMessage(channelNumber: any, lsb: any, msb: any): void;
179
185
  setPitchBend(channelNumber: any, pitchBend: any): void;
180
- handleControlChange(channelNumber: any, controller: any, value: any): void | any[];
186
+ handleControlChange(channelNumber: any, controller: any, value: any): void | Promise<void>;
181
187
  setBankMSB(channelNumber: any, msb: any): void;
182
188
  updateModulation(channel: any): void;
183
- setModulation(channelNumber: any, modulation: any): void;
189
+ setModulationDepth(channelNumber: any, modulation: any): void;
184
190
  setPortamentoTime(channelNumber: any, portamentoTime: any): void;
185
191
  setVolume(channelNumber: any, volume: any): void;
186
192
  panToGain(pan: any): {
@@ -213,9 +219,9 @@ export class MidyGM2 {
213
219
  setCoarseTuning(channelNumber: any, coarseTuning: any): void;
214
220
  handleModulationDepthRangeRPN(channelNumber: any): void;
215
221
  setModulationDepthRange(channelNumber: any, modulationDepthRange: any): void;
216
- allSoundOff(channelNumber: any): any[];
222
+ allSoundOff(channelNumber: any): Promise<void>;
217
223
  resetAllControllers(channelNumber: any): void;
218
- allNotesOff(channelNumber: any): any[];
224
+ allNotesOff(channelNumber: any): Promise<void>;
219
225
  omniOff(): void;
220
226
  omniOn(): void;
221
227
  monoOn(): void;
@@ -255,12 +261,13 @@ export class MidyGM2 {
255
261
  declare class Note {
256
262
  constructor(noteNumber: any, velocity: any, startTime: any, instrumentKey: any);
257
263
  bufferSource: any;
258
- gainNode: any;
259
264
  filterNode: any;
260
- modLFO: any;
261
- modLFOGain: any;
262
- vibLFO: any;
263
- vibLFOGain: any;
265
+ volumeNode: any;
266
+ volumeDepth: any;
267
+ modulationLFO: any;
268
+ modulationDepth: any;
269
+ vibratoLFO: any;
270
+ vibratoDepth: any;
264
271
  noteNumber: any;
265
272
  velocity: any;
266
273
  startTime: any;
@@ -1 +1 @@
1
- {"version":3,"file":"midy-GM2.d.ts","sourceRoot":"","sources":["../src/midy-GM2.js"],"names":[],"mappings":"AAuBA;IAkCE;;;;;;;;;;;;;;;;;MAiBE;IAEF;;;;;;;;;;;MAWE;IAEF;;;;;;;MAOE;IAgCF;;;;;OAWC;IAnH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IAED,sDAMC;IAGD,oDAEC;IAED,mEAWC;IAED,mEAWC;IAED,wDAWC;IAED,uDAGC;IAED,kFAeC;IAED,2DAMC;IAED,oCAqBC;IAED,gDAEC;IAED,gDAEC;IAED,mDAGC;IAED,oDAUC;IAED,kDAKC;IAED,iEAOC;IAED,8CAKC;IAED,yDAMC;IAED,gDAKC;IAED,6DAMC;IAED,wDAKC;IAED,6EAKC;IAED,uCAoBC;IAED,8CAEC;IAED,uCAoBC;IAED,gBAEC;IAED,eAEC;IAED,eAEC;IAED,eAEC;IAED,4DAmBC;IAED,oBAQC;IAED,oBAQC;IAED,yDAiDC;IAED,yCAGC;IAED,mCAQC;IAED,6CAGC;IAED,2CAMC;IAED,+CAGC;IAED,+CAMC;IAED,mDAeC;IAED,4CAOC;IAED,+BAKC;IAED,qDAiBC;IAED,gCAMC;IAED,kCAEC;IA6BD,4CAEC;IAED,4CAaC;IAED,+BAiBC;IAED,wFAKC;IAED,mCAQC;IAED,qCAEC;IAED,oCAUC;IAED,sCAEC;IAED,oCAaC;IAED,sCAEC;IAED,wCAWC;IAED,0CAEC;IAED,wCAEC;IAED,6BASC;IAED,0DAUC;CACF;AA9vDD;IASE,gFAKC;IAbD,kBAAa;IACb,cAAS;IACT,gBAAW;IACX,YAAO;IACP,gBAAW;IACX,YAAO;IACP,gBAAW;IAGT,gBAA4B;IAC5B,cAAwB;IACxB,eAA0B;IAC1B,mBAAkC;CAErC"}
1
+ {"version":3,"file":"midy-GM2.d.ts","sourceRoot":"","sources":["../src/midy-GM2.js"],"names":[],"mappings":"AAwBA;IAkCE;;;;;;;;;;;;;;;;;;;;MAoBE;IAEF;;;;;;;;;;;MAWE;IAEF;;;;;;;MAOE;IAgCF;;;;;OAWC;IAtHD,qBAAmB;IACnB,kBAAc;IACd,yBAAqB;IACrB,2BAAuB;IACvB;;;MAGE;IACF;;;;;;MAME;IACF,cAAa;IACb,cAAa;IACb,0BAAwB;IACxB,kBAAc;IACd,mBAAiB;IACjB,kBAAc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