@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.MidyGMLite = 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,31 @@ 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", {
21
27
  enumerable: true,
22
28
  configurable: true,
23
29
  writable: true,
24
30
  value: void 0
25
31
  });
26
- Object.defineProperty(this, "modLFO", {
32
+ Object.defineProperty(this, "modulationLFO", {
27
33
  enumerable: true,
28
34
  configurable: true,
29
35
  writable: true,
30
36
  value: void 0
31
37
  });
32
- Object.defineProperty(this, "modLFOGain", {
38
+ Object.defineProperty(this, "modulationDepth", {
33
39
  enumerable: true,
34
40
  configurable: true,
35
41
  writable: true,
@@ -316,7 +322,7 @@ class MidyGMLite {
316
322
  const t = this.audioContext.currentTime + offset;
317
323
  queueIndex = await this.scheduleTimelineEvents(t, offset, queueIndex);
318
324
  if (this.isPausing) {
319
- await this.stopNotes();
325
+ await this.stopNotes(0, true);
320
326
  this.notePromises = [];
321
327
  resolve();
322
328
  this.isPausing = false;
@@ -324,7 +330,7 @@ class MidyGMLite {
324
330
  return;
325
331
  }
326
332
  else if (this.isStopping) {
327
- await this.stopNotes();
333
+ await this.stopNotes(0, true);
328
334
  this.notePromises = [];
329
335
  resolve();
330
336
  this.isStopping = false;
@@ -332,7 +338,7 @@ class MidyGMLite {
332
338
  return;
333
339
  }
334
340
  else if (this.isSeeking) {
335
- this.stopNotes();
341
+ this.stopNotes(0, true);
336
342
  this.startTime = this.audioContext.currentTime;
337
343
  queueIndex = this.getQueueIndex(this.resumeTime);
338
344
  offset = this.resumeTime - this.startTime;
@@ -413,21 +419,24 @@ class MidyGMLite {
413
419
  }
414
420
  return { instruments, timeline };
415
421
  }
416
- stopNotes() {
422
+ async stopChannelNotes(channelNumber, velocity, stopPedal) {
417
423
  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
- });
424
+ const channel = this.channels[channelNumber];
425
+ channel.scheduledNotes.forEach((noteList) => {
426
+ noteList.forEach((note) => {
427
+ if (note) {
428
+ const promise = this.scheduleNoteRelease(channelNumber, note.noteNumber, velocity, now, stopPedal);
429
+ this.notePromises.push(promise);
430
+ }
428
431
  });
429
- channel.scheduledNotes.clear();
430
432
  });
433
+ channel.scheduledNotes.clear();
434
+ await Promise.all(this.notePromises);
435
+ }
436
+ stopNotes(velocity, stopPedal) {
437
+ for (let i = 0; i < this.channels.length; i++) {
438
+ this.stopChannelNotes(i, velocity, stopPedal);
439
+ }
431
440
  return Promise.all(this.notePromises);
432
441
  }
433
442
  async start() {
@@ -510,36 +519,54 @@ class MidyGMLite {
510
519
  }
511
520
  setVolumeEnvelope(note) {
512
521
  const { instrumentKey, startTime } = note;
513
- note.gainNode = new GainNode(this.audioContext, { gain: 0 });
522
+ note.volumeNode = new GainNode(this.audioContext, { gain: 0 });
514
523
  const attackVolume = this.cbToRatio(-instrumentKey.initialAttenuation);
515
524
  const sustainVolume = attackVolume * (1 - instrumentKey.volSustain);
516
525
  const volDelay = startTime + instrumentKey.volDelay;
517
526
  const volAttack = volDelay + instrumentKey.volAttack;
518
527
  const volHold = volAttack + instrumentKey.volHold;
519
528
  const volDecay = volHold + instrumentKey.volDecay;
520
- note.gainNode.gain
529
+ note.volumeNode.gain
521
530
  .setValueAtTime(1e-6, volDelay) // exponentialRampToValueAtTime() requires a non-zero value
522
531
  .exponentialRampToValueAtTime(attackVolume, volAttack)
523
532
  .setValueAtTime(attackVolume, volHold)
524
533
  .linearRampToValueAtTime(sustainVolume, volDecay);
525
534
  }
526
- setFilterEnvelope(channel, note) {
527
- const { instrumentKey, startTime, noteNumber } = note;
535
+ setPitch(note, semitoneOffset) {
536
+ const { instrumentKey, noteNumber, startTime } = note;
537
+ const modEnvToPitch = instrumentKey.modEnvToPitch / 100;
538
+ note.bufferSource.playbackRate.value = this.calcPlaybackRate(instrumentKey, noteNumber, semitoneOffset);
539
+ if (modEnvToPitch === 0)
540
+ return;
541
+ const basePitch = note.bufferSource.playbackRate.value;
542
+ const peekPitch = this.calcPlaybackRate(instrumentKey, noteNumber, semitoneOffset + modEnvToPitch);
543
+ const modDelay = startTime + instrumentKey.modDelay;
544
+ const modAttack = modDelay + instrumentKey.modAttack;
545
+ const modHold = modAttack + instrumentKey.modHold;
546
+ const modDecay = modHold + instrumentKey.modDecay;
547
+ note.bufferSource.playbackRate.value
548
+ .setValueAtTime(basePitch, modDelay)
549
+ .exponentialRampToValueAtTime(peekPitch, modAttack)
550
+ .setValueAtTime(peekPitch, modHold)
551
+ .linearRampToValueAtTime(basePitch, modDecay);
552
+ }
553
+ setFilterNode(channel, note) {
554
+ const { instrumentKey, noteNumber, startTime } = note;
528
555
  const softPedalFactor = 1 -
529
556
  (0.1 + (noteNumber / 127) * 0.2) * channel.softPedal;
530
557
  const maxFreq = this.audioContext.sampleRate / 2;
531
558
  const baseFreq = this.centToHz(instrumentKey.initialFilterFc) *
532
559
  softPedalFactor;
533
560
  const peekFreq = this.centToHz(instrumentKey.initialFilterFc + instrumentKey.modEnvToFilterFc) * softPedalFactor;
534
- const sustainFreq = (baseFreq +
535
- (peekFreq - baseFreq) * (1 - instrumentKey.modSustain)) * softPedalFactor;
561
+ const sustainFreq = baseFreq +
562
+ (peekFreq - baseFreq) * (1 - instrumentKey.modSustain);
563
+ const adjustedBaseFreq = Math.min(maxFreq, baseFreq);
564
+ const adjustedPeekFreq = Math.min(maxFreq, peekFreq);
565
+ const adjustedSustainFreq = Math.min(maxFreq, sustainFreq);
536
566
  const modDelay = startTime + instrumentKey.modDelay;
537
567
  const modAttack = modDelay + instrumentKey.modAttack;
538
568
  const modHold = modAttack + instrumentKey.modHold;
539
569
  const modDecay = modHold + instrumentKey.modDecay;
540
- const adjustedBaseFreq = Math.min(maxFreq, baseFreq);
541
- const adjustedPeekFreq = Math.min(maxFreq, peekFreq);
542
- const adjustedSustainFreq = Math.min(maxFreq, sustainFreq);
543
570
  note.filterNode = new BiquadFilterNode(this.audioContext, {
544
571
  type: "lowpass",
545
572
  Q: instrumentKey.initialFilterQ / 10, // dB
@@ -550,35 +577,49 @@ class MidyGMLite {
550
577
  .exponentialRampToValueAtTime(adjustedPeekFreq, modAttack)
551
578
  .setValueAtTime(adjustedPeekFreq, modHold)
552
579
  .linearRampToValueAtTime(adjustedSustainFreq, modDecay);
553
- note.bufferSource.detune.setValueAtTime(note.bufferSource.detune.value + instrumentKey.modEnvToPitch, modDelay);
554
580
  }
555
- startModulation(channel, note, time) {
581
+ startModulation(channel, note, startTime) {
556
582
  const { instrumentKey } = note;
557
- note.modLFOGain = new GainNode(this.audioContext, {
558
- gain: this.cbToRatio(instrumentKey.modLfoToVolume + channel.modulation),
559
- });
560
- note.modLFO = new OscillatorNode(this.audioContext, {
583
+ const { modLfoToPitch, modLfoToVolume } = instrumentKey;
584
+ note.modulationLFO = new OscillatorNode(this.audioContext, {
561
585
  frequency: this.centToHz(instrumentKey.freqModLFO),
562
586
  });
563
- note.modLFO.start(time);
564
- note.filterNode.frequency.setValueAtTime(note.filterNode.frequency.value + instrumentKey.modLfoToFilterFc, time);
565
- note.bufferSource.detune.setValueAtTime(note.bufferSource.detune.value + instrumentKey.modLfoToPitch, time);
566
- note.modLFO.connect(note.modLFOGain);
567
- note.modLFOGain.connect(note.bufferSource.detune);
587
+ note.filterDepth = new GainNode(this.audioContext, {
588
+ gain: instrumentKey.modLfoToFilterFc,
589
+ });
590
+ const modulationDepth = Math.abs(modLfoToPitch) + channel.modulationDepth;
591
+ const modulationDepthSign = (0 < modLfoToPitch) ? 1 : -1;
592
+ note.modulationDepth = new GainNode(this.audioContext, {
593
+ gain: modulationDepth * modulationDepthSign,
594
+ });
595
+ const volumeDepth = this.cbToRatio(Math.abs(modLfoToVolume)) - 1;
596
+ const volumeDepthSign = (0 < modLfoToVolume) ? 1 : -1;
597
+ note.volumeDepth = new GainNode(this.audioContext, {
598
+ gain: volumeDepth * volumeDepthSign,
599
+ });
600
+ note.modulationLFO.start(startTime + instrumentKey.delayModLFO);
601
+ note.modulationLFO.connect(note.filterDepth);
602
+ note.filterDepth.connect(note.filterNode.frequency);
603
+ note.modulationLFO.connect(note.modulationDepth);
604
+ note.modulationDepth.connect(note.bufferSource.detune);
605
+ note.modulationLFO.connect(note.volumeDepth);
606
+ note.volumeDepth.connect(note.volumeNode.gain);
568
607
  }
569
608
  async createNote(channel, instrumentKey, noteNumber, velocity, startTime, isSF3) {
570
609
  const semitoneOffset = this.calcSemitoneOffset(channel);
571
610
  const note = new Note(noteNumber, velocity, startTime, instrumentKey);
572
611
  note.bufferSource = await this.createNoteBufferNode(instrumentKey, isSF3);
573
- note.bufferSource.playbackRate.value = this.calcPlaybackRate(instrumentKey, noteNumber, semitoneOffset);
612
+ this.setFilterNode(channel, note);
574
613
  this.setVolumeEnvelope(note);
575
- this.setFilterEnvelope(channel, note);
576
- if (channel.modulation > 0) {
577
- const delayModLFO = startTime + instrumentKey.delayModLFO;
578
- this.startModulation(channel, note, delayModLFO);
614
+ if (0 < channel.modulationDepth) {
615
+ this.setPitch(note, semitoneOffset);
616
+ this.startModulation(channel, note, startTime);
617
+ }
618
+ else {
619
+ note.bufferSource.playbackRate.value = this.calcPlaybackRate(instrumentKey, noteNumber, semitoneOffset);
579
620
  }
580
621
  note.bufferSource.connect(note.filterNode);
581
- note.filterNode.connect(note.gainNode);
622
+ note.filterNode.connect(note.volumeNode);
582
623
  note.bufferSource.start(startTime, instrumentKey.start / instrumentKey.sampleRate);
583
624
  return note;
584
625
  }
@@ -594,8 +635,8 @@ class MidyGMLite {
594
635
  if (!instrumentKey)
595
636
  return;
596
637
  const note = await this.createNote(channel, instrumentKey, noteNumber, velocity, startTime, isSF3);
597
- note.gainNode.connect(channel.gainL);
598
- note.gainNode.connect(channel.gainR);
638
+ note.volumeNode.connect(channel.gainL);
639
+ note.volumeNode.connect(channel.gainR);
599
640
  const scheduledNotes = channel.scheduledNotes;
600
641
  if (scheduledNotes.has(noteNumber)) {
601
642
  scheduledNotes.get(noteNumber).push(note);
@@ -624,17 +665,14 @@ class MidyGMLite {
624
665
  const velocityRate = (velocity + 127) / 127;
625
666
  const volEndTime = stopTime +
626
667
  note.instrumentKey.volRelease * velocityRate;
627
- note.gainNode.gain
668
+ note.volumeNode.gain
628
669
  .cancelScheduledValues(stopTime)
629
670
  .linearRampToValueAtTime(0, volEndTime);
630
- const maxFreq = this.audioContext.sampleRate / 2;
631
- const baseFreq = this.centToHz(note.instrumentKey.initialFilterFc);
632
- const adjustedBaseFreq = Math.min(maxFreq, baseFreq);
633
- const modEndTime = stopTime +
671
+ const modRelease = stopTime +
634
672
  note.instrumentKey.modRelease * velocityRate;
635
673
  note.filterNode.frequency
636
674
  .cancelScheduledValues(stopTime)
637
- .linearRampToValueAtTime(adjustedBaseFreq, modEndTime);
675
+ .linearRampToValueAtTime(0, modRelease);
638
676
  note.ending = true;
639
677
  this.scheduleTask(() => {
640
678
  note.bufferSource.loop = false;
@@ -643,15 +681,17 @@ class MidyGMLite {
643
681
  note.bufferSource.onended = () => {
644
682
  scheduledNotes[i] = null;
645
683
  note.bufferSource.disconnect();
684
+ note.volumeNode.disconnect();
646
685
  note.filterNode.disconnect();
647
- note.gainNode.disconnect();
648
- if (note.modLFOGain)
649
- note.modLFOGain.disconnect();
650
- if (note.modLFO)
651
- note.modLFO.stop();
686
+ if (note.volumeDepth)
687
+ note.volumeDepth.disconnect();
688
+ if (note.modulationDepth)
689
+ note.modulationDepth.disconnect();
690
+ if (note.modulationLFO)
691
+ note.modulationLFO.stop();
652
692
  resolve();
653
693
  };
654
- bufferSource.stop(volEndTime);
694
+ note.bufferSource.stop(volEndTime);
655
695
  });
656
696
  }
657
697
  }
@@ -664,10 +704,10 @@ class MidyGMLite {
664
704
  const channel = this.channels[channelNumber];
665
705
  const promises = [];
666
706
  channel.sustainPedal = false;
667
- channel.scheduledNotes.forEach((scheduledNotes) => {
668
- scheduledNotes.forEach((scheduledNote) => {
669
- if (scheduledNote) {
670
- const { noteNumber } = scheduledNote;
707
+ channel.scheduledNotes.forEach((noteList) => {
708
+ noteList.forEach((note) => {
709
+ if (note) {
710
+ const { noteNumber } = note;
671
711
  const promise = this.releaseNote(channelNumber, noteNumber, velocity);
672
712
  promises.push(promise);
673
713
  }
@@ -712,7 +752,7 @@ class MidyGMLite {
712
752
  handleControlChange(channelNumber, controller, value) {
713
753
  switch (controller) {
714
754
  case 1:
715
- return this.setModulation(channelNumber, value);
755
+ return this.setModulationDepth(channelNumber, value);
716
756
  case 6:
717
757
  return this.dataEntryMSB(channelNumber, value);
718
758
  case 7:
@@ -743,18 +783,19 @@ class MidyGMLite {
743
783
  const now = this.audioContext.currentTime;
744
784
  const activeNotes = this.getActiveNotes(channel, now);
745
785
  activeNotes.forEach((activeNote) => {
746
- if (activeNote.modLFO) {
747
- const { gainNode, instrumentKey } = activeNote;
748
- gainNode.gain.setValueAtTime(this.cbToRatio(instrumentKey.modLfoToVolume + channel.modulation), now);
786
+ if (activeNote.modulationDepth) {
787
+ activeNote.modulationDepth.gain.setValueAtTime(channel.modulationDepth, now);
749
788
  }
750
789
  else {
790
+ const semitoneOffset = this.calcSemitoneOffset(channel);
791
+ this.setPitch(activeNote, semitoneOffset);
751
792
  this.startModulation(channel, activeNote, now);
752
793
  }
753
794
  });
754
795
  }
755
- setModulation(channelNumber, modulation) {
796
+ setModulationDepth(channelNumber, modulation) {
756
797
  const channel = this.channels[channelNumber];
757
- channel.modulation = (modulation / 127) * channel.modulationDepthRange;
798
+ channel.modulationDepth = (modulation / 127) * channel.modulationDepthRange;
758
799
  this.updateModulation(channel);
759
800
  }
760
801
  setVolume(channelNumber, volume) {
@@ -848,37 +889,13 @@ class MidyGMLite {
848
889
  this.updateDetune(channel, detuneChange);
849
890
  }
850
891
  allSoundOff(channelNumber) {
851
- const now = this.audioContext.currentTime;
852
- const channel = this.channels[channelNumber];
853
- const velocity = 0;
854
- const stopPedal = true;
855
- const promises = [];
856
- channel.scheduledNotes.forEach((noteList) => {
857
- const activeNote = this.getActiveNote(noteList, now);
858
- if (activeNote) {
859
- const notePromise = this.scheduleNoteRelease(channelNumber, noteNumber, velocity, now, stopPedal);
860
- promises.push(notePromise);
861
- }
862
- });
863
- return promises;
892
+ return this.stopChannelNotes(channelNumber, 0, true);
864
893
  }
865
894
  resetAllControllers(channelNumber) {
866
895
  Object.assign(this.channels[channelNumber], this.effectSettings);
867
896
  }
868
897
  allNotesOff(channelNumber) {
869
- const now = this.audioContext.currentTime;
870
- const channel = this.channels[channelNumber];
871
- const velocity = 0;
872
- const stopPedal = false;
873
- const promises = [];
874
- channel.scheduledNotes.forEach((noteList) => {
875
- const activeNote = this.getActiveNote(noteList, now);
876
- if (activeNote) {
877
- const notePromise = this.scheduleNoteRelease(channelNumber, activeNote.noteNumber, velocity, now, stopPedal);
878
- promises.push(notePromise);
879
- }
880
- });
881
- return promises;
898
+ return this.stopChannelNotes(channelNumber, 0, false);
882
899
  }
883
900
  handleUniversalNonRealTimeExclusiveMessage(data) {
884
901
  switch (data[2]) {
@@ -972,7 +989,7 @@ Object.defineProperty(MidyGMLite, "channelSettings", {
972
989
  dataLSB: 0,
973
990
  program: 0,
974
991
  pitchBend: 0,
975
- modulationDepthRange: 0.5, // cb
992
+ modulationDepthRange: 50, // cent
976
993
  }
977
994
  });
978
995
  Object.defineProperty(MidyGMLite, "effectSettings", {
@@ -981,7 +998,7 @@ Object.defineProperty(MidyGMLite, "effectSettings", {
981
998
  writable: true,
982
999
  value: {
983
1000
  expression: 1,
984
- modulation: 0,
1001
+ modulationDepth: 0,
985
1002
  sustainPedal: false,
986
1003
  rpnMSB: 127,
987
1004
  rpnLSB: 127,
package/script/midy.d.ts CHANGED
@@ -22,7 +22,7 @@ export class Midy {
22
22
  };
23
23
  static effectSettings: {
24
24
  expression: number;
25
- modulation: number;
25
+ modulationDepth: number;
26
26
  sustainPedal: boolean;
27
27
  portamento: boolean;
28
28
  sostenutoPedal: boolean;
@@ -128,7 +128,8 @@ export class Midy {
128
128
  instruments: Set<any>;
129
129
  timeline: any[];
130
130
  };
131
- stopNotes(): Promise<any[]>;
131
+ stopChannelNotes(channelNumber: any, velocity: any, stopPedal: any): Promise<void>;
132
+ stopNotes(velocity: any, stopPedal: any): Promise<any[]>;
132
133
  start(): Promise<void>;
133
134
  stop(): void;
134
135
  pause(): void;
@@ -165,9 +166,10 @@ export class Midy {
165
166
  calcSemitoneOffset(channel: any): any;
166
167
  calcPlaybackRate(instrumentKey: any, noteNumber: any, semitoneOffset: any): number;
167
168
  setVolumeEnvelope(note: any): void;
168
- setFilterEnvelope(channel: any, note: any): void;
169
- startModulation(channel: any, note: any, time: any): void;
170
- startVibrato(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;
171
173
  createNote(channel: any, instrumentKey: any, noteNumber: any, velocity: any, startTime: any, isSF3: any): Promise<Note>;
172
174
  calcBank(channel: any, channelNumber: any): any;
173
175
  scheduleNoteOn(channelNumber: any, noteNumber: any, velocity: any, startTime: any): Promise<void>;
@@ -176,16 +178,16 @@ export class Midy {
176
178
  releaseNote(channelNumber: any, noteNumber: any, velocity: any): Promise<any> | undefined;
177
179
  releaseSustainPedal(channelNumber: any, halfVelocity: any): any[];
178
180
  releaseSostenutoPedal(channelNumber: any, halfVelocity: any): any[];
179
- handleMIDIMessage(statusByte: any, data1: any, data2: any): void | any[] | Promise<any>;
181
+ handleMIDIMessage(statusByte: any, data1: any, data2: any): void | Promise<any>;
180
182
  handlePolyphonicKeyPressure(channelNumber: any, noteNumber: any, pressure: any): void;
181
183
  handleProgramChange(channelNumber: any, program: any): void;
182
184
  handleChannelPressure(channelNumber: any, pressure: any): void;
183
185
  handlePitchBendMessage(channelNumber: any, lsb: any, msb: any): void;
184
186
  setPitchBend(channelNumber: any, pitchBend: any): void;
185
- handleControlChange(channelNumber: any, controller: any, value: any): void | any[];
187
+ handleControlChange(channelNumber: any, controller: any, value: any): void | Promise<void>;
186
188
  setBankMSB(channelNumber: any, msb: any): void;
187
189
  updateModulation(channel: any): void;
188
- setModulation(channelNumber: any, modulation: any): void;
190
+ setModulationDepth(channelNumber: any, modulation: any): void;
189
191
  setPortamentoTime(channelNumber: any, portamentoTime: any): void;
190
192
  setVolume(channelNumber: any, volume: any): void;
191
193
  panToGain(pan: any): {
@@ -223,9 +225,9 @@ export class Midy {
223
225
  setCoarseTuning(channelNumber: any, coarseTuning: any): void;
224
226
  handleModulationDepthRangeRPN(channelNumber: any): void;
225
227
  setModulationDepthRange(channelNumber: any, modulationDepthRange: any): void;
226
- allSoundOff(channelNumber: any): any[];
228
+ allSoundOff(channelNumber: any): Promise<void>;
227
229
  resetAllControllers(channelNumber: any): void;
228
- allNotesOff(channelNumber: any): any[];
230
+ allNotesOff(channelNumber: any): Promise<void>;
229
231
  omniOff(): void;
230
232
  omniOn(): void;
231
233
  monoOn(): void;
@@ -265,12 +267,13 @@ export class Midy {
265
267
  declare class Note {
266
268
  constructor(noteNumber: any, velocity: any, startTime: any, instrumentKey: any);
267
269
  bufferSource: any;
268
- gainNode: any;
269
270
  filterNode: any;
270
- modLFO: any;
271
- modLFOGain: any;
272
- vibLFO: any;
273
- vibLFOGain: any;
271
+ volumeNode: any;
272
+ volumeDepth: any;
273
+ modulationLFO: any;
274
+ modulationDepth: any;
275
+ vibratoLFO: any;
276
+ vibratoDepth: any;
274
277
  noteNumber: any;
275
278
  velocity: any;
276
279
  startTime: any;
@@ -1 +1 @@
1
- {"version":3,"file":"midy.d.ts","sourceRoot":"","sources":["../src/midy.js"],"names":[],"mappings":"AAuBA;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;IACd,mBAAe;IACf,kBAAgB;IAChB,sBAA2C;IAC3C,mBAAkB;IAClB,mBAAkB;IAClB,kBAAiB;IACjB,oBAAmB;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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;AA71DD;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.d.ts","sourceRoot":"","sources":["../src/midy.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;IACd,mBAAe;IACf,kBAAgB;IAChB,sBAA2C;IAC3C,mBAAkB;IAClB,mBAAkB;IAClB,kBAAiB;IACjB,oBAAmB;IACnB,mBAAkB;IAClB,gBAAc;IACd,mBAAiB;IACjB,oBAAkB;IA8ClB;;;;;MA4BE;IAGA,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