@marmooo/midy 0.0.1 → 0.0.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.
- package/esm/midy-GM1.d.ts +2 -11
- package/esm/midy-GM1.d.ts.map +1 -1
- package/esm/midy-GM1.js +83 -126
- package/esm/midy-GM2.d.ts +3 -7
- package/esm/midy-GM2.d.ts.map +1 -1
- package/esm/midy-GM2.js +91 -102
- package/esm/midy-GMLite.d.ts +2 -11
- package/esm/midy-GMLite.d.ts.map +1 -1
- package/esm/midy-GMLite.js +84 -127
- package/esm/midy.d.ts +2 -7
- package/esm/midy.d.ts.map +1 -1
- package/esm/midy.js +94 -102
- package/package.json +1 -1
- package/script/midy-GM1.d.ts +2 -11
- package/script/midy-GM1.d.ts.map +1 -1
- package/script/midy-GM1.js +83 -126
- package/script/midy-GM2.d.ts +3 -7
- package/script/midy-GM2.d.ts.map +1 -1
- package/script/midy-GM2.js +91 -102
- package/script/midy-GMLite.d.ts +2 -11
- package/script/midy-GMLite.d.ts.map +1 -1
- package/script/midy-GMLite.js +84 -127
- package/script/midy.d.ts +2 -7
- package/script/midy.d.ts.map +1 -1
- package/script/midy.js +94 -102
package/esm/midy-GM2.js
CHANGED
|
@@ -8,12 +8,6 @@ export class MidyGM2 {
|
|
|
8
8
|
writable: true,
|
|
9
9
|
value: 120
|
|
10
10
|
});
|
|
11
|
-
Object.defineProperty(this, "secondsPerBeat", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: 0.5
|
|
16
|
-
});
|
|
17
11
|
Object.defineProperty(this, "totalTime", {
|
|
18
12
|
enumerable: true,
|
|
19
13
|
configurable: true,
|
|
@@ -174,10 +168,10 @@ export class MidyGM2 {
|
|
|
174
168
|
const response = await fetch(midiUrl);
|
|
175
169
|
const arrayBuffer = await response.arrayBuffer();
|
|
176
170
|
const midi = parseMidi(new Uint8Array(arrayBuffer));
|
|
171
|
+
this.ticksPerBeat = midi.header.ticksPerBeat;
|
|
177
172
|
const midiData = this.extractMidiData(midi);
|
|
178
173
|
this.instruments = midiData.instruments;
|
|
179
174
|
this.timeline = midiData.timeline;
|
|
180
|
-
this.ticksPerBeat = midi.header.ticksPerBeat;
|
|
181
175
|
this.totalTime = this.calcTotalTime();
|
|
182
176
|
}
|
|
183
177
|
setChannelAudioNodes(audioContext) {
|
|
@@ -263,18 +257,20 @@ export class MidyGM2 {
|
|
|
263
257
|
async scheduleTimelineEvents(t, offset, queueIndex) {
|
|
264
258
|
while (queueIndex < this.timeline.length) {
|
|
265
259
|
const event = this.timeline[queueIndex];
|
|
266
|
-
|
|
267
|
-
if (time > t + this.lookAhead)
|
|
260
|
+
if (event.startTime > t + this.lookAhead)
|
|
268
261
|
break;
|
|
269
262
|
switch (event.type) {
|
|
270
263
|
case "controller":
|
|
271
264
|
this.handleControlChange(this.omni ? 0 : event.channel, event.controllerType, event.value);
|
|
272
265
|
break;
|
|
273
266
|
case "noteOn":
|
|
274
|
-
|
|
275
|
-
|
|
267
|
+
if (event.velocity !== 0) {
|
|
268
|
+
await this.scheduleNoteOn(event.channel, event.noteNumber, event.velocity, event.startTime + this.startDelay - offset);
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
/* falls through */
|
|
276
272
|
case "noteOff": {
|
|
277
|
-
const notePromise = this.scheduleNoteRelease(this.omni ? 0 : event.channel, event.noteNumber, event.velocity,
|
|
273
|
+
const notePromise = this.scheduleNoteRelease(this.omni ? 0 : event.channel, event.noteNumber, event.velocity, event.startTime + this.startDelay - offset);
|
|
278
274
|
if (notePromise) {
|
|
279
275
|
this.notePromises.push(notePromise);
|
|
280
276
|
}
|
|
@@ -283,9 +279,6 @@ export class MidyGM2 {
|
|
|
283
279
|
case "programChange":
|
|
284
280
|
this.handleProgramChange(event.channel, event.programNumber);
|
|
285
281
|
break;
|
|
286
|
-
case "setTempo":
|
|
287
|
-
this.secondsPerBeat = event.microsecondsPerBeat / 1000000;
|
|
288
|
-
break;
|
|
289
282
|
case "sysEx":
|
|
290
283
|
this.handleSysEx(event.data);
|
|
291
284
|
}
|
|
@@ -294,9 +287,8 @@ export class MidyGM2 {
|
|
|
294
287
|
return queueIndex;
|
|
295
288
|
}
|
|
296
289
|
getQueueIndex(second) {
|
|
297
|
-
const ticks = this.secondToTicks(second, this.secondsPerBeat);
|
|
298
290
|
for (let i = 0; i < this.timeline.length; i++) {
|
|
299
|
-
if (
|
|
291
|
+
if (second <= this.timeline[i].startTime) {
|
|
300
292
|
return i;
|
|
301
293
|
}
|
|
302
294
|
}
|
|
@@ -438,18 +430,28 @@ export class MidyGM2 {
|
|
|
438
430
|
timeline.push(event);
|
|
439
431
|
});
|
|
440
432
|
});
|
|
433
|
+
const priority = {
|
|
434
|
+
setTempo: 0,
|
|
435
|
+
controller: 1,
|
|
436
|
+
};
|
|
441
437
|
timeline.sort((a, b) => {
|
|
442
|
-
if (a.ticks !== b.ticks)
|
|
438
|
+
if (a.ticks !== b.ticks)
|
|
443
439
|
return a.ticks - b.ticks;
|
|
444
|
-
|
|
445
|
-
if (a.type !== "controller" && b.type === "controller") {
|
|
446
|
-
return -1;
|
|
447
|
-
}
|
|
448
|
-
if (a.type === "controller" && b.type !== "controller") {
|
|
449
|
-
return 1;
|
|
450
|
-
}
|
|
451
|
-
return 0;
|
|
440
|
+
return (priority[a.type] || 2) - (priority[b.type] || 2);
|
|
452
441
|
});
|
|
442
|
+
let prevTempoTime = 0;
|
|
443
|
+
let prevTempoTicks = 0;
|
|
444
|
+
let secondsPerBeat = 0.5;
|
|
445
|
+
for (let i = 0; i < timeline.length; i++) {
|
|
446
|
+
const event = timeline[i];
|
|
447
|
+
const timeFromPrevTempo = this.ticksToSecond(event.ticks - prevTempoTicks, secondsPerBeat);
|
|
448
|
+
event.startTime = prevTempoTime + timeFromPrevTempo;
|
|
449
|
+
if (event.type === "setTempo") {
|
|
450
|
+
prevTempoTime += this.ticksToSecond(event.ticks - prevTempoTicks, secondsPerBeat);
|
|
451
|
+
secondsPerBeat = event.microsecondsPerBeat / 1000000;
|
|
452
|
+
prevTempoTicks = event.ticks;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
453
455
|
return { instruments, timeline };
|
|
454
456
|
}
|
|
455
457
|
stopNotes() {
|
|
@@ -501,32 +503,12 @@ export class MidyGM2 {
|
|
|
501
503
|
}
|
|
502
504
|
}
|
|
503
505
|
calcTotalTime() {
|
|
504
|
-
const endOfTracks = [];
|
|
505
|
-
let prevTicks = 0;
|
|
506
506
|
let totalTime = 0;
|
|
507
|
-
let secondsPerBeat = 0.5;
|
|
508
507
|
for (let i = 0; i < this.timeline.length; i++) {
|
|
509
508
|
const event = this.timeline[i];
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
const durationTicks = event.ticks - prevTicks;
|
|
513
|
-
totalTime += this.ticksToSecond(durationTicks, secondsPerBeat);
|
|
514
|
-
secondsPerBeat = event.microsecondsPerBeat / 1000000;
|
|
515
|
-
prevTicks = event.ticks;
|
|
516
|
-
break;
|
|
517
|
-
}
|
|
518
|
-
case "endOfTrack":
|
|
519
|
-
endOfTracks.push(event);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
let maxTicks = 0;
|
|
523
|
-
for (let i = 0; i < endOfTracks.length; i++) {
|
|
524
|
-
const event = endOfTracks[i];
|
|
525
|
-
if (maxTicks < event.ticks)
|
|
526
|
-
maxTicks = event.ticks;
|
|
509
|
+
if (totalTime < event.startTime)
|
|
510
|
+
totalTime = event.startTime;
|
|
527
511
|
}
|
|
528
|
-
const durationTicks = maxTicks - prevTicks;
|
|
529
|
-
totalTime += this.ticksToSecond(durationTicks, secondsPerBeat);
|
|
530
512
|
return totalTime;
|
|
531
513
|
}
|
|
532
514
|
currentTime() {
|
|
@@ -554,11 +536,8 @@ export class MidyGM2 {
|
|
|
554
536
|
const lfo = new OscillatorNode(audioContext, {
|
|
555
537
|
frequency: 5,
|
|
556
538
|
});
|
|
557
|
-
const lfoGain = new GainNode(audioContext);
|
|
558
|
-
lfo.connect(lfoGain);
|
|
559
539
|
return {
|
|
560
540
|
lfo,
|
|
561
|
-
lfoGain,
|
|
562
541
|
};
|
|
563
542
|
}
|
|
564
543
|
createReverbEffect(audioContext, options = {}) {
|
|
@@ -690,33 +669,44 @@ export class MidyGM2 {
|
|
|
690
669
|
.exponentialRampToValueAtTime(attackVolume, volAttack)
|
|
691
670
|
.setValueAtTime(attackVolume, volHold)
|
|
692
671
|
.linearRampToValueAtTime(sustainVolume, volDecay);
|
|
693
|
-
if (channel.modulation > 0) {
|
|
694
|
-
const lfoGain = channel.modulationEffect.lfoGain;
|
|
695
|
-
lfoGain.connect(bufferSource.detune);
|
|
696
|
-
lfoGain.gain.cancelScheduledValues(startTime + channel.vibratoDelay);
|
|
697
|
-
lfoGain.gain.setValueAtTime(channel.modulation, startTime + channel.vibratoDelay);
|
|
698
|
-
}
|
|
699
672
|
// filter envelope
|
|
700
673
|
const softPedalFactor = 1 -
|
|
701
674
|
(0.1 + (noteNumber / 127) * 0.2) * channel.softPedal;
|
|
675
|
+
const maxFreq = this.audioContext.sampleRate / 2;
|
|
702
676
|
const baseFreq = this.centToHz(noteInfo.initialFilterFc) * softPedalFactor;
|
|
703
677
|
const peekFreq = this.centToHz(noteInfo.initialFilterFc + noteInfo.modEnvToFilterFc) * softPedalFactor;
|
|
704
678
|
const sustainFreq = (baseFreq +
|
|
705
679
|
(peekFreq - baseFreq) * (1 - noteInfo.modSustain)) * softPedalFactor;
|
|
680
|
+
const adjustedBaseFreq = Math.min(maxFreq, baseFreq);
|
|
681
|
+
const adjustedPeekFreq = Math.min(maxFreq, peekFreq);
|
|
682
|
+
const adjustedSustainFreq = Math.min(maxFreq, sustainFreq);
|
|
706
683
|
const filterNode = new BiquadFilterNode(this.audioContext, {
|
|
707
684
|
type: "lowpass",
|
|
708
|
-
Q:
|
|
709
|
-
frequency:
|
|
685
|
+
Q: noteInfo.initialFilterQ / 10, // dB
|
|
686
|
+
frequency: adjustedBaseFreq,
|
|
710
687
|
});
|
|
711
688
|
const modDelay = startTime + noteInfo.modDelay;
|
|
712
689
|
const modAttack = modDelay + noteInfo.modAttack;
|
|
713
690
|
const modHold = modAttack + noteInfo.modHold;
|
|
714
691
|
const modDecay = modHold + noteInfo.modDecay;
|
|
715
692
|
filterNode.frequency
|
|
716
|
-
.setValueAtTime(
|
|
717
|
-
.exponentialRampToValueAtTime(
|
|
718
|
-
.setValueAtTime(
|
|
719
|
-
.linearRampToValueAtTime(
|
|
693
|
+
.setValueAtTime(adjustedBaseFreq, modDelay)
|
|
694
|
+
.exponentialRampToValueAtTime(adjustedPeekFreq, modAttack)
|
|
695
|
+
.setValueAtTime(adjustedPeekFreq, modHold)
|
|
696
|
+
.linearRampToValueAtTime(adjustedSustainFreq, modDecay);
|
|
697
|
+
let lfoGain;
|
|
698
|
+
if (channel.modulation > 0) {
|
|
699
|
+
const vibratoDelay = startTime + channel.vibratoDelay;
|
|
700
|
+
const vibratoAttack = vibratoDelay + 0.1;
|
|
701
|
+
lfoGain = new GainNode(this.audioContext, {
|
|
702
|
+
gain: 0,
|
|
703
|
+
});
|
|
704
|
+
lfoGain.gain
|
|
705
|
+
.setValueAtTime(1e-6, vibratoDelay) // exponentialRampToValueAtTime() requires a non-zero value
|
|
706
|
+
.exponentialRampToValueAtTime(channel.modulation, vibratoAttack);
|
|
707
|
+
channel.modulationEffect.lfo.connect(lfoGain);
|
|
708
|
+
lfoGain.connect(bufferSource.detune);
|
|
709
|
+
}
|
|
720
710
|
bufferSource.connect(filterNode);
|
|
721
711
|
filterNode.connect(gainNode);
|
|
722
712
|
if (this.mono && channel.currentBufferSource) {
|
|
@@ -724,7 +714,7 @@ export class MidyGM2 {
|
|
|
724
714
|
channel.currentBufferSource = bufferSource;
|
|
725
715
|
}
|
|
726
716
|
bufferSource.start(startTime, noteInfo.start / noteInfo.sampleRate);
|
|
727
|
-
return { bufferSource, gainNode, filterNode };
|
|
717
|
+
return { bufferSource, gainNode, filterNode, lfoGain };
|
|
728
718
|
}
|
|
729
719
|
calcBank(channel, channelNumber) {
|
|
730
720
|
if (channel.bankMSB === 121) {
|
|
@@ -746,7 +736,7 @@ export class MidyGM2 {
|
|
|
746
736
|
const noteInfo = soundFont.getInstrumentKey(bankNumber, channel.program, noteNumber);
|
|
747
737
|
if (!noteInfo)
|
|
748
738
|
return;
|
|
749
|
-
const { bufferSource, gainNode, filterNode } = await this
|
|
739
|
+
const { bufferSource, gainNode, filterNode, lfoGain } = await this
|
|
750
740
|
.createNoteAudioChain(channel, noteInfo, noteNumber, velocity, startTime, isSF3);
|
|
751
741
|
this.connectNoteEffects(channel, gainNode);
|
|
752
742
|
if (channel.sostenutoPedal) {
|
|
@@ -760,11 +750,12 @@ export class MidyGM2 {
|
|
|
760
750
|
}
|
|
761
751
|
const scheduledNotes = channel.scheduledNotes;
|
|
762
752
|
const scheduledNote = {
|
|
763
|
-
gainNode,
|
|
764
|
-
filterNode,
|
|
765
753
|
bufferSource,
|
|
766
|
-
|
|
754
|
+
filterNode,
|
|
755
|
+
gainNode,
|
|
756
|
+
lfoGain,
|
|
767
757
|
noteInfo,
|
|
758
|
+
noteNumber,
|
|
768
759
|
startTime,
|
|
769
760
|
};
|
|
770
761
|
if (scheduledNotes.has(noteNumber)) {
|
|
@@ -793,15 +784,18 @@ export class MidyGM2 {
|
|
|
793
784
|
continue;
|
|
794
785
|
if (targetNote.ending)
|
|
795
786
|
continue;
|
|
796
|
-
const { bufferSource, filterNode, gainNode, noteInfo } = targetNote;
|
|
787
|
+
const { bufferSource, filterNode, gainNode, lfoGain, noteInfo } = targetNote;
|
|
797
788
|
const velocityRate = (velocity + 127) / 127;
|
|
798
789
|
const volEndTime = stopTime + noteInfo.volRelease * velocityRate;
|
|
799
790
|
gainNode.gain.cancelScheduledValues(stopTime);
|
|
800
791
|
gainNode.gain.linearRampToValueAtTime(0, volEndTime);
|
|
792
|
+
const maxFreq = this.audioContext.sampleRate / 2;
|
|
801
793
|
const baseFreq = this.centToHz(noteInfo.initialFilterFc);
|
|
794
|
+
const adjustedBaseFreq = Math.min(maxFreq, baseFreq);
|
|
802
795
|
const modEndTime = stopTime + noteInfo.modRelease * velocityRate;
|
|
803
|
-
filterNode.frequency
|
|
804
|
-
|
|
796
|
+
filterNode.frequency
|
|
797
|
+
.cancelScheduledValues(stopTime)
|
|
798
|
+
.linearRampToValueAtTime(adjustedBaseFreq, modEndTime);
|
|
805
799
|
targetNote.ending = true;
|
|
806
800
|
this.scheduleTask(() => {
|
|
807
801
|
bufferSource.loop = false;
|
|
@@ -812,6 +806,8 @@ export class MidyGM2 {
|
|
|
812
806
|
bufferSource.disconnect(0);
|
|
813
807
|
filterNode.disconnect(0);
|
|
814
808
|
gainNode.disconnect(0);
|
|
809
|
+
if (lfoGain)
|
|
810
|
+
lfoGain.disconnect(0);
|
|
815
811
|
resolve();
|
|
816
812
|
};
|
|
817
813
|
bufferSource.stop(volEndTime);
|
|
@@ -822,38 +818,34 @@ export class MidyGM2 {
|
|
|
822
818
|
const now = this.audioContext.currentTime;
|
|
823
819
|
return this.scheduleNoteRelease(channelNumber, noteNumber, velocity, now);
|
|
824
820
|
}
|
|
825
|
-
releaseSustainPedal(channelNumber) {
|
|
826
|
-
const
|
|
821
|
+
releaseSustainPedal(channelNumber, halfVelocity) {
|
|
822
|
+
const velocity = halfVelocity * 2;
|
|
827
823
|
const channel = this.channels[channelNumber];
|
|
824
|
+
const promises = [];
|
|
828
825
|
channel.sustainPedal = false;
|
|
829
826
|
channel.scheduledNotes.forEach((scheduledNotes) => {
|
|
830
827
|
scheduledNotes.forEach((scheduledNote) => {
|
|
831
828
|
if (scheduledNote) {
|
|
832
|
-
const {
|
|
833
|
-
const
|
|
834
|
-
|
|
835
|
-
gainNode.gain.linearRampToValueAtTime(0, volEndTime);
|
|
836
|
-
const baseFreq = this.centToHz(noteInfo.initialFilterFc);
|
|
837
|
-
const modEndTime = now + noteInfo.modRelease;
|
|
838
|
-
filterNode.frequency.cancelScheduledValues(now);
|
|
839
|
-
filterNode.frequency.linearRampToValueAtTime(baseFreq, modEndTime);
|
|
840
|
-
bufferSource.stop(volEndTime);
|
|
829
|
+
const { noteNumber } = scheduledNote;
|
|
830
|
+
const promise = this.releaseNote(channelNumber, noteNumber, velocity);
|
|
831
|
+
promises.push(promise);
|
|
841
832
|
}
|
|
842
833
|
});
|
|
843
834
|
});
|
|
835
|
+
return promises;
|
|
844
836
|
}
|
|
845
|
-
|
|
846
|
-
const
|
|
837
|
+
releaseSostenutoPedal(channelNumber, halfVelocity) {
|
|
838
|
+
const velocity = halfVelocity * 2;
|
|
847
839
|
const channel = this.channels[channelNumber];
|
|
840
|
+
const promises = [];
|
|
848
841
|
channel.sostenutoPedal = false;
|
|
849
842
|
channel.sostenutoNotes.forEach((activeNote) => {
|
|
850
|
-
const {
|
|
851
|
-
const
|
|
852
|
-
|
|
853
|
-
gainNode.gain.linearRampToValueAtTime(0, now + fadeTime);
|
|
854
|
-
bufferSource.stop(now + fadeTime);
|
|
843
|
+
const { noteNumber } = activeNote;
|
|
844
|
+
const promise = this.releaseNote(channelNumber, noteNumber, velocity);
|
|
845
|
+
promises.push(promise);
|
|
855
846
|
});
|
|
856
847
|
channel.sostenutoNotes.clear();
|
|
848
|
+
return promises;
|
|
857
849
|
}
|
|
858
850
|
handleMIDIMessage(statusByte, data1, data2) {
|
|
859
851
|
const channelNumber = omni ? 0 : statusByte & 0x0F;
|
|
@@ -886,7 +878,7 @@ export class MidyGM2 {
|
|
|
886
878
|
scheduledNotes.forEach((scheduledNote) => {
|
|
887
879
|
if (scheduledNote) {
|
|
888
880
|
const { initialAttenuation } = scheduledNote.noteInfo;
|
|
889
|
-
const gain = this.cbToRatio(initialAttenuation) * pressure;
|
|
881
|
+
const gain = this.cbToRatio(-initialAttenuation) * pressure;
|
|
890
882
|
scheduledNote.gainNode.gain.cancelScheduledValues(now);
|
|
891
883
|
scheduledNote.gainNode.gain.setValueAtTime(gain, now);
|
|
892
884
|
}
|
|
@@ -960,17 +952,12 @@ export class MidyGM2 {
|
|
|
960
952
|
}
|
|
961
953
|
}
|
|
962
954
|
setBankMSB(channelNumber, msb) {
|
|
963
|
-
|
|
964
|
-
channel.bankMSB = msb;
|
|
955
|
+
this.channels[channelNumber].bankMSB = msb;
|
|
965
956
|
}
|
|
966
957
|
setModulation(channelNumber, modulation) {
|
|
967
|
-
const now = this.audioContext.currentTime;
|
|
968
958
|
const channel = this.channels[channelNumber];
|
|
969
|
-
channel.modulation = (modulation
|
|
970
|
-
channel.modulationDepthRange;
|
|
971
|
-
const lfoGain = channel.modulationEffect.lfoGain;
|
|
972
|
-
lfoGain.gain.cancelScheduledValues(now);
|
|
973
|
-
lfoGain.gain.setValueAtTime(channel.modulation, now);
|
|
959
|
+
channel.modulation = (modulation / 127) *
|
|
960
|
+
(channel.modulationDepthRange * 100);
|
|
974
961
|
}
|
|
975
962
|
setPortamentoTime(channelNumber, portamentoTime) {
|
|
976
963
|
this.channels[channelNumber].portamentoTime = portamentoTime / 127;
|
|
@@ -1005,7 +992,7 @@ export class MidyGM2 {
|
|
|
1005
992
|
const isOn = value >= 64;
|
|
1006
993
|
this.channels[channelNumber].sustainPedal = isOn;
|
|
1007
994
|
if (!isOn) {
|
|
1008
|
-
this.releaseSustainPedal(channelNumber);
|
|
995
|
+
this.releaseSustainPedal(channelNumber, value);
|
|
1009
996
|
}
|
|
1010
997
|
}
|
|
1011
998
|
setPortamento(channelNumber, value) {
|
|
@@ -1034,11 +1021,13 @@ export class MidyGM2 {
|
|
|
1034
1021
|
const activeNotes = this.getActiveNotes(channel);
|
|
1035
1022
|
channel.sostenutoNotes = new Map(activeNotes);
|
|
1036
1023
|
}
|
|
1024
|
+
else {
|
|
1025
|
+
this.releaseSostenutoPedal(channelNumber, value);
|
|
1026
|
+
}
|
|
1037
1027
|
}
|
|
1038
1028
|
setSoftPedal(channelNumber, softPedal) {
|
|
1039
1029
|
const channel = this.channels[channelNumber];
|
|
1040
1030
|
channel.softPedal = softPedal / 127;
|
|
1041
|
-
this.updateChannelGain(channel);
|
|
1042
1031
|
}
|
|
1043
1032
|
setRPNMSB(channelNumber, value) {
|
|
1044
1033
|
this.channels[channelNumber].rpnMSB = value;
|
|
@@ -1264,7 +1253,7 @@ Object.defineProperty(MidyGM2, "channelSettings", {
|
|
|
1264
1253
|
writable: true,
|
|
1265
1254
|
value: {
|
|
1266
1255
|
currentBufferSource: null,
|
|
1267
|
-
volume:
|
|
1256
|
+
volume: 100 / 127,
|
|
1268
1257
|
pan: 0,
|
|
1269
1258
|
portamentoTime: 0,
|
|
1270
1259
|
reverb: 0,
|
|
@@ -1281,7 +1270,7 @@ Object.defineProperty(MidyGM2, "channelSettings", {
|
|
|
1281
1270
|
pitchBend: 0,
|
|
1282
1271
|
fineTuning: 0,
|
|
1283
1272
|
coarseTuning: 0,
|
|
1284
|
-
modulationDepthRange:
|
|
1273
|
+
modulationDepthRange: 0.5,
|
|
1285
1274
|
}
|
|
1286
1275
|
});
|
|
1287
1276
|
Object.defineProperty(MidyGM2, "effectSettings", {
|
package/esm/midy-GMLite.d.ts
CHANGED
|
@@ -22,7 +22,6 @@ export class MidyGMLite {
|
|
|
22
22
|
};
|
|
23
23
|
constructor(audioContext: any);
|
|
24
24
|
ticksPerBeat: number;
|
|
25
|
-
secondsPerBeat: number;
|
|
26
25
|
totalTime: number;
|
|
27
26
|
noteCheckInterval: number;
|
|
28
27
|
lookAhead: number;
|
|
@@ -48,7 +47,6 @@ export class MidyGMLite {
|
|
|
48
47
|
pannerNode: any;
|
|
49
48
|
modulationEffect: {
|
|
50
49
|
lfo: any;
|
|
51
|
-
lfoGain: any;
|
|
52
50
|
};
|
|
53
51
|
expression: number;
|
|
54
52
|
modulation: number;
|
|
@@ -77,7 +75,6 @@ export class MidyGMLite {
|
|
|
77
75
|
pannerNode: any;
|
|
78
76
|
modulationEffect: {
|
|
79
77
|
lfo: any;
|
|
80
|
-
lfoGain: any;
|
|
81
78
|
};
|
|
82
79
|
};
|
|
83
80
|
createChannels(audioContext: any): {
|
|
@@ -87,7 +84,6 @@ export class MidyGMLite {
|
|
|
87
84
|
pannerNode: any;
|
|
88
85
|
modulationEffect: {
|
|
89
86
|
lfo: any;
|
|
90
|
-
lfoGain: any;
|
|
91
87
|
};
|
|
92
88
|
expression: number;
|
|
93
89
|
modulation: number;
|
|
@@ -131,12 +127,6 @@ export class MidyGMLite {
|
|
|
131
127
|
getActiveChannelNotes(scheduledNotes: any): any;
|
|
132
128
|
createModulationEffect(audioContext: any): {
|
|
133
129
|
lfo: any;
|
|
134
|
-
lfoGain: any;
|
|
135
|
-
};
|
|
136
|
-
createReverbEffect(audioContext: any, options?: {}): {
|
|
137
|
-
convolverNode: any;
|
|
138
|
-
dryGain: any;
|
|
139
|
-
wetGain: any;
|
|
140
130
|
};
|
|
141
131
|
connectNoteEffects(channel: any, gainNode: any): void;
|
|
142
132
|
cbToRatio(cb: any): number;
|
|
@@ -145,12 +135,13 @@ export class MidyGMLite {
|
|
|
145
135
|
bufferSource: any;
|
|
146
136
|
gainNode: any;
|
|
147
137
|
filterNode: any;
|
|
138
|
+
lfoGain: any;
|
|
148
139
|
}>;
|
|
149
140
|
scheduleNoteOn(channelNumber: any, noteNumber: any, velocity: any, startTime: any): Promise<void>;
|
|
150
141
|
noteOn(channelNumber: any, noteNumber: any, velocity: any): Promise<void>;
|
|
151
142
|
scheduleNoteRelease(channelNumber: any, noteNumber: any, velocity: any, stopTime: any, stopPedal?: boolean): Promise<any> | undefined;
|
|
152
143
|
releaseNote(channelNumber: any, noteNumber: any, velocity: any): Promise<any> | undefined;
|
|
153
|
-
releaseSustainPedal(channelNumber: any):
|
|
144
|
+
releaseSustainPedal(channelNumber: any, halfVelocity: any): any[];
|
|
154
145
|
handleMIDIMessage(statusByte: any, data1: any, data2: any): void | any[] | Promise<any>;
|
|
155
146
|
handlePolyphonicKeyPressure(channelNumber: any, noteNumber: any, pressure: any): void;
|
|
156
147
|
handleProgramChange(channelNumber: any, program: any): void;
|
package/esm/midy-GMLite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"midy-GMLite.d.ts","sourceRoot":"","sources":["../src/midy-GMLite.js"],"names":[],"mappings":"AAMA;
|
|
1
|
+
{"version":3,"file":"midy-GMLite.d.ts","sourceRoot":"","sources":["../src/midy-GMLite.js"],"names":[],"mappings":"AAMA;IAmBE;;;;;;;;;;;;MAYE;IAEF;;;;;;;MAOE;IAEF,+BAMC;IA/CD,qBAAmB;IACnB,kBAAc;IACd,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;IA0BhB,kBAAgC;IAChC,gBAA4C;IAE5C;;;;;;;;;;;;;;;;;;;;;;;;;QAAiD;IAInD,4BAMC;IAED,mCASC;IAED,gDAMC;IAED,sCASC;IAED;;;;;;MAgBC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;QAWC;IAED,0DAyBC;IAED,8DAUC;IAED,qDAOC;IAED,2EA4CC;IAED,mCAOC;IAED,0BA+CC;IAED,uDAEC;IAED,wDAEC;IAED;;;MAyEC;IAED,4BAsBC;IAED,uBAKC;IAED,aAGC;IAED,cAKC;IAED,wBAIC;IAED,0BAKC;IAED,wBAOC;IAED,sBAGC;IAED,4CASC;IAED,gDAKC;IAED;;MAOC;IAED,sDAEC;IAED,2BAEC;IAED,4BAEC;IAED;;;;;OA4EC;IAED,kGAuCC;IAED,0EAGC;IAED,sIA4CC;IAED,0FAGC;IAED,kEAeC;IAED,wFAqBC;IAED,sFAeC;IAED,4DAGC;IAED,+DAEC;IAED,8DAGC;IAED,mFA+BC;IAED,yDAIC;IAED,iDAIC;IAED,2CAMC;IAED,yDAIC;IAED,sCAKC;IAED,sDAMC;IAED,gDAEC;IAED,gDAEC;IAED,+DAcC;IAED,uCAoBC;IAED,8CAEC;IAED,uCAoBC;IAED,4DAgBC;IAED,oBAQC;IAED,yDAaC;IAED,yCAGC;IAED,sCAIC;IAED,wCAEC;IAED,6BASC;IAED,0DAUC;CACF"}
|