@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/script/midy-GM2.js
CHANGED
|
@@ -11,12 +11,6 @@ class MidyGM2 {
|
|
|
11
11
|
writable: true,
|
|
12
12
|
value: 120
|
|
13
13
|
});
|
|
14
|
-
Object.defineProperty(this, "secondsPerBeat", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
configurable: true,
|
|
17
|
-
writable: true,
|
|
18
|
-
value: 0.5
|
|
19
|
-
});
|
|
20
14
|
Object.defineProperty(this, "totalTime", {
|
|
21
15
|
enumerable: true,
|
|
22
16
|
configurable: true,
|
|
@@ -177,10 +171,10 @@ class MidyGM2 {
|
|
|
177
171
|
const response = await fetch(midiUrl);
|
|
178
172
|
const arrayBuffer = await response.arrayBuffer();
|
|
179
173
|
const midi = (0, _esm_js_1.parseMidi)(new Uint8Array(arrayBuffer));
|
|
174
|
+
this.ticksPerBeat = midi.header.ticksPerBeat;
|
|
180
175
|
const midiData = this.extractMidiData(midi);
|
|
181
176
|
this.instruments = midiData.instruments;
|
|
182
177
|
this.timeline = midiData.timeline;
|
|
183
|
-
this.ticksPerBeat = midi.header.ticksPerBeat;
|
|
184
178
|
this.totalTime = this.calcTotalTime();
|
|
185
179
|
}
|
|
186
180
|
setChannelAudioNodes(audioContext) {
|
|
@@ -266,18 +260,20 @@ class MidyGM2 {
|
|
|
266
260
|
async scheduleTimelineEvents(t, offset, queueIndex) {
|
|
267
261
|
while (queueIndex < this.timeline.length) {
|
|
268
262
|
const event = this.timeline[queueIndex];
|
|
269
|
-
|
|
270
|
-
if (time > t + this.lookAhead)
|
|
263
|
+
if (event.startTime > t + this.lookAhead)
|
|
271
264
|
break;
|
|
272
265
|
switch (event.type) {
|
|
273
266
|
case "controller":
|
|
274
267
|
this.handleControlChange(this.omni ? 0 : event.channel, event.controllerType, event.value);
|
|
275
268
|
break;
|
|
276
269
|
case "noteOn":
|
|
277
|
-
|
|
278
|
-
|
|
270
|
+
if (event.velocity !== 0) {
|
|
271
|
+
await this.scheduleNoteOn(event.channel, event.noteNumber, event.velocity, event.startTime + this.startDelay - offset);
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
/* falls through */
|
|
279
275
|
case "noteOff": {
|
|
280
|
-
const notePromise = this.scheduleNoteRelease(this.omni ? 0 : event.channel, event.noteNumber, event.velocity,
|
|
276
|
+
const notePromise = this.scheduleNoteRelease(this.omni ? 0 : event.channel, event.noteNumber, event.velocity, event.startTime + this.startDelay - offset);
|
|
281
277
|
if (notePromise) {
|
|
282
278
|
this.notePromises.push(notePromise);
|
|
283
279
|
}
|
|
@@ -286,9 +282,6 @@ class MidyGM2 {
|
|
|
286
282
|
case "programChange":
|
|
287
283
|
this.handleProgramChange(event.channel, event.programNumber);
|
|
288
284
|
break;
|
|
289
|
-
case "setTempo":
|
|
290
|
-
this.secondsPerBeat = event.microsecondsPerBeat / 1000000;
|
|
291
|
-
break;
|
|
292
285
|
case "sysEx":
|
|
293
286
|
this.handleSysEx(event.data);
|
|
294
287
|
}
|
|
@@ -297,9 +290,8 @@ class MidyGM2 {
|
|
|
297
290
|
return queueIndex;
|
|
298
291
|
}
|
|
299
292
|
getQueueIndex(second) {
|
|
300
|
-
const ticks = this.secondToTicks(second, this.secondsPerBeat);
|
|
301
293
|
for (let i = 0; i < this.timeline.length; i++) {
|
|
302
|
-
if (
|
|
294
|
+
if (second <= this.timeline[i].startTime) {
|
|
303
295
|
return i;
|
|
304
296
|
}
|
|
305
297
|
}
|
|
@@ -441,18 +433,28 @@ class MidyGM2 {
|
|
|
441
433
|
timeline.push(event);
|
|
442
434
|
});
|
|
443
435
|
});
|
|
436
|
+
const priority = {
|
|
437
|
+
setTempo: 0,
|
|
438
|
+
controller: 1,
|
|
439
|
+
};
|
|
444
440
|
timeline.sort((a, b) => {
|
|
445
|
-
if (a.ticks !== b.ticks)
|
|
441
|
+
if (a.ticks !== b.ticks)
|
|
446
442
|
return a.ticks - b.ticks;
|
|
447
|
-
|
|
448
|
-
if (a.type !== "controller" && b.type === "controller") {
|
|
449
|
-
return -1;
|
|
450
|
-
}
|
|
451
|
-
if (a.type === "controller" && b.type !== "controller") {
|
|
452
|
-
return 1;
|
|
453
|
-
}
|
|
454
|
-
return 0;
|
|
443
|
+
return (priority[a.type] || 2) - (priority[b.type] || 2);
|
|
455
444
|
});
|
|
445
|
+
let prevTempoTime = 0;
|
|
446
|
+
let prevTempoTicks = 0;
|
|
447
|
+
let secondsPerBeat = 0.5;
|
|
448
|
+
for (let i = 0; i < timeline.length; i++) {
|
|
449
|
+
const event = timeline[i];
|
|
450
|
+
const timeFromPrevTempo = this.ticksToSecond(event.ticks - prevTempoTicks, secondsPerBeat);
|
|
451
|
+
event.startTime = prevTempoTime + timeFromPrevTempo;
|
|
452
|
+
if (event.type === "setTempo") {
|
|
453
|
+
prevTempoTime += this.ticksToSecond(event.ticks - prevTempoTicks, secondsPerBeat);
|
|
454
|
+
secondsPerBeat = event.microsecondsPerBeat / 1000000;
|
|
455
|
+
prevTempoTicks = event.ticks;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
456
458
|
return { instruments, timeline };
|
|
457
459
|
}
|
|
458
460
|
stopNotes() {
|
|
@@ -504,32 +506,12 @@ class MidyGM2 {
|
|
|
504
506
|
}
|
|
505
507
|
}
|
|
506
508
|
calcTotalTime() {
|
|
507
|
-
const endOfTracks = [];
|
|
508
|
-
let prevTicks = 0;
|
|
509
509
|
let totalTime = 0;
|
|
510
|
-
let secondsPerBeat = 0.5;
|
|
511
510
|
for (let i = 0; i < this.timeline.length; i++) {
|
|
512
511
|
const event = this.timeline[i];
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
const durationTicks = event.ticks - prevTicks;
|
|
516
|
-
totalTime += this.ticksToSecond(durationTicks, secondsPerBeat);
|
|
517
|
-
secondsPerBeat = event.microsecondsPerBeat / 1000000;
|
|
518
|
-
prevTicks = event.ticks;
|
|
519
|
-
break;
|
|
520
|
-
}
|
|
521
|
-
case "endOfTrack":
|
|
522
|
-
endOfTracks.push(event);
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
let maxTicks = 0;
|
|
526
|
-
for (let i = 0; i < endOfTracks.length; i++) {
|
|
527
|
-
const event = endOfTracks[i];
|
|
528
|
-
if (maxTicks < event.ticks)
|
|
529
|
-
maxTicks = event.ticks;
|
|
512
|
+
if (totalTime < event.startTime)
|
|
513
|
+
totalTime = event.startTime;
|
|
530
514
|
}
|
|
531
|
-
const durationTicks = maxTicks - prevTicks;
|
|
532
|
-
totalTime += this.ticksToSecond(durationTicks, secondsPerBeat);
|
|
533
515
|
return totalTime;
|
|
534
516
|
}
|
|
535
517
|
currentTime() {
|
|
@@ -557,11 +539,8 @@ class MidyGM2 {
|
|
|
557
539
|
const lfo = new OscillatorNode(audioContext, {
|
|
558
540
|
frequency: 5,
|
|
559
541
|
});
|
|
560
|
-
const lfoGain = new GainNode(audioContext);
|
|
561
|
-
lfo.connect(lfoGain);
|
|
562
542
|
return {
|
|
563
543
|
lfo,
|
|
564
|
-
lfoGain,
|
|
565
544
|
};
|
|
566
545
|
}
|
|
567
546
|
createReverbEffect(audioContext, options = {}) {
|
|
@@ -693,33 +672,44 @@ class MidyGM2 {
|
|
|
693
672
|
.exponentialRampToValueAtTime(attackVolume, volAttack)
|
|
694
673
|
.setValueAtTime(attackVolume, volHold)
|
|
695
674
|
.linearRampToValueAtTime(sustainVolume, volDecay);
|
|
696
|
-
if (channel.modulation > 0) {
|
|
697
|
-
const lfoGain = channel.modulationEffect.lfoGain;
|
|
698
|
-
lfoGain.connect(bufferSource.detune);
|
|
699
|
-
lfoGain.gain.cancelScheduledValues(startTime + channel.vibratoDelay);
|
|
700
|
-
lfoGain.gain.setValueAtTime(channel.modulation, startTime + channel.vibratoDelay);
|
|
701
|
-
}
|
|
702
675
|
// filter envelope
|
|
703
676
|
const softPedalFactor = 1 -
|
|
704
677
|
(0.1 + (noteNumber / 127) * 0.2) * channel.softPedal;
|
|
678
|
+
const maxFreq = this.audioContext.sampleRate / 2;
|
|
705
679
|
const baseFreq = this.centToHz(noteInfo.initialFilterFc) * softPedalFactor;
|
|
706
680
|
const peekFreq = this.centToHz(noteInfo.initialFilterFc + noteInfo.modEnvToFilterFc) * softPedalFactor;
|
|
707
681
|
const sustainFreq = (baseFreq +
|
|
708
682
|
(peekFreq - baseFreq) * (1 - noteInfo.modSustain)) * softPedalFactor;
|
|
683
|
+
const adjustedBaseFreq = Math.min(maxFreq, baseFreq);
|
|
684
|
+
const adjustedPeekFreq = Math.min(maxFreq, peekFreq);
|
|
685
|
+
const adjustedSustainFreq = Math.min(maxFreq, sustainFreq);
|
|
709
686
|
const filterNode = new BiquadFilterNode(this.audioContext, {
|
|
710
687
|
type: "lowpass",
|
|
711
|
-
Q:
|
|
712
|
-
frequency:
|
|
688
|
+
Q: noteInfo.initialFilterQ / 10, // dB
|
|
689
|
+
frequency: adjustedBaseFreq,
|
|
713
690
|
});
|
|
714
691
|
const modDelay = startTime + noteInfo.modDelay;
|
|
715
692
|
const modAttack = modDelay + noteInfo.modAttack;
|
|
716
693
|
const modHold = modAttack + noteInfo.modHold;
|
|
717
694
|
const modDecay = modHold + noteInfo.modDecay;
|
|
718
695
|
filterNode.frequency
|
|
719
|
-
.setValueAtTime(
|
|
720
|
-
.exponentialRampToValueAtTime(
|
|
721
|
-
.setValueAtTime(
|
|
722
|
-
.linearRampToValueAtTime(
|
|
696
|
+
.setValueAtTime(adjustedBaseFreq, modDelay)
|
|
697
|
+
.exponentialRampToValueAtTime(adjustedPeekFreq, modAttack)
|
|
698
|
+
.setValueAtTime(adjustedPeekFreq, modHold)
|
|
699
|
+
.linearRampToValueAtTime(adjustedSustainFreq, modDecay);
|
|
700
|
+
let lfoGain;
|
|
701
|
+
if (channel.modulation > 0) {
|
|
702
|
+
const vibratoDelay = startTime + channel.vibratoDelay;
|
|
703
|
+
const vibratoAttack = vibratoDelay + 0.1;
|
|
704
|
+
lfoGain = new GainNode(this.audioContext, {
|
|
705
|
+
gain: 0,
|
|
706
|
+
});
|
|
707
|
+
lfoGain.gain
|
|
708
|
+
.setValueAtTime(1e-6, vibratoDelay) // exponentialRampToValueAtTime() requires a non-zero value
|
|
709
|
+
.exponentialRampToValueAtTime(channel.modulation, vibratoAttack);
|
|
710
|
+
channel.modulationEffect.lfo.connect(lfoGain);
|
|
711
|
+
lfoGain.connect(bufferSource.detune);
|
|
712
|
+
}
|
|
723
713
|
bufferSource.connect(filterNode);
|
|
724
714
|
filterNode.connect(gainNode);
|
|
725
715
|
if (this.mono && channel.currentBufferSource) {
|
|
@@ -727,7 +717,7 @@ class MidyGM2 {
|
|
|
727
717
|
channel.currentBufferSource = bufferSource;
|
|
728
718
|
}
|
|
729
719
|
bufferSource.start(startTime, noteInfo.start / noteInfo.sampleRate);
|
|
730
|
-
return { bufferSource, gainNode, filterNode };
|
|
720
|
+
return { bufferSource, gainNode, filterNode, lfoGain };
|
|
731
721
|
}
|
|
732
722
|
calcBank(channel, channelNumber) {
|
|
733
723
|
if (channel.bankMSB === 121) {
|
|
@@ -749,7 +739,7 @@ class MidyGM2 {
|
|
|
749
739
|
const noteInfo = soundFont.getInstrumentKey(bankNumber, channel.program, noteNumber);
|
|
750
740
|
if (!noteInfo)
|
|
751
741
|
return;
|
|
752
|
-
const { bufferSource, gainNode, filterNode } = await this
|
|
742
|
+
const { bufferSource, gainNode, filterNode, lfoGain } = await this
|
|
753
743
|
.createNoteAudioChain(channel, noteInfo, noteNumber, velocity, startTime, isSF3);
|
|
754
744
|
this.connectNoteEffects(channel, gainNode);
|
|
755
745
|
if (channel.sostenutoPedal) {
|
|
@@ -763,11 +753,12 @@ class MidyGM2 {
|
|
|
763
753
|
}
|
|
764
754
|
const scheduledNotes = channel.scheduledNotes;
|
|
765
755
|
const scheduledNote = {
|
|
766
|
-
gainNode,
|
|
767
|
-
filterNode,
|
|
768
756
|
bufferSource,
|
|
769
|
-
|
|
757
|
+
filterNode,
|
|
758
|
+
gainNode,
|
|
759
|
+
lfoGain,
|
|
770
760
|
noteInfo,
|
|
761
|
+
noteNumber,
|
|
771
762
|
startTime,
|
|
772
763
|
};
|
|
773
764
|
if (scheduledNotes.has(noteNumber)) {
|
|
@@ -796,15 +787,18 @@ class MidyGM2 {
|
|
|
796
787
|
continue;
|
|
797
788
|
if (targetNote.ending)
|
|
798
789
|
continue;
|
|
799
|
-
const { bufferSource, filterNode, gainNode, noteInfo } = targetNote;
|
|
790
|
+
const { bufferSource, filterNode, gainNode, lfoGain, noteInfo } = targetNote;
|
|
800
791
|
const velocityRate = (velocity + 127) / 127;
|
|
801
792
|
const volEndTime = stopTime + noteInfo.volRelease * velocityRate;
|
|
802
793
|
gainNode.gain.cancelScheduledValues(stopTime);
|
|
803
794
|
gainNode.gain.linearRampToValueAtTime(0, volEndTime);
|
|
795
|
+
const maxFreq = this.audioContext.sampleRate / 2;
|
|
804
796
|
const baseFreq = this.centToHz(noteInfo.initialFilterFc);
|
|
797
|
+
const adjustedBaseFreq = Math.min(maxFreq, baseFreq);
|
|
805
798
|
const modEndTime = stopTime + noteInfo.modRelease * velocityRate;
|
|
806
|
-
filterNode.frequency
|
|
807
|
-
|
|
799
|
+
filterNode.frequency
|
|
800
|
+
.cancelScheduledValues(stopTime)
|
|
801
|
+
.linearRampToValueAtTime(adjustedBaseFreq, modEndTime);
|
|
808
802
|
targetNote.ending = true;
|
|
809
803
|
this.scheduleTask(() => {
|
|
810
804
|
bufferSource.loop = false;
|
|
@@ -815,6 +809,8 @@ class MidyGM2 {
|
|
|
815
809
|
bufferSource.disconnect(0);
|
|
816
810
|
filterNode.disconnect(0);
|
|
817
811
|
gainNode.disconnect(0);
|
|
812
|
+
if (lfoGain)
|
|
813
|
+
lfoGain.disconnect(0);
|
|
818
814
|
resolve();
|
|
819
815
|
};
|
|
820
816
|
bufferSource.stop(volEndTime);
|
|
@@ -825,38 +821,34 @@ class MidyGM2 {
|
|
|
825
821
|
const now = this.audioContext.currentTime;
|
|
826
822
|
return this.scheduleNoteRelease(channelNumber, noteNumber, velocity, now);
|
|
827
823
|
}
|
|
828
|
-
releaseSustainPedal(channelNumber) {
|
|
829
|
-
const
|
|
824
|
+
releaseSustainPedal(channelNumber, halfVelocity) {
|
|
825
|
+
const velocity = halfVelocity * 2;
|
|
830
826
|
const channel = this.channels[channelNumber];
|
|
827
|
+
const promises = [];
|
|
831
828
|
channel.sustainPedal = false;
|
|
832
829
|
channel.scheduledNotes.forEach((scheduledNotes) => {
|
|
833
830
|
scheduledNotes.forEach((scheduledNote) => {
|
|
834
831
|
if (scheduledNote) {
|
|
835
|
-
const {
|
|
836
|
-
const
|
|
837
|
-
|
|
838
|
-
gainNode.gain.linearRampToValueAtTime(0, volEndTime);
|
|
839
|
-
const baseFreq = this.centToHz(noteInfo.initialFilterFc);
|
|
840
|
-
const modEndTime = now + noteInfo.modRelease;
|
|
841
|
-
filterNode.frequency.cancelScheduledValues(now);
|
|
842
|
-
filterNode.frequency.linearRampToValueAtTime(baseFreq, modEndTime);
|
|
843
|
-
bufferSource.stop(volEndTime);
|
|
832
|
+
const { noteNumber } = scheduledNote;
|
|
833
|
+
const promise = this.releaseNote(channelNumber, noteNumber, velocity);
|
|
834
|
+
promises.push(promise);
|
|
844
835
|
}
|
|
845
836
|
});
|
|
846
837
|
});
|
|
838
|
+
return promises;
|
|
847
839
|
}
|
|
848
|
-
|
|
849
|
-
const
|
|
840
|
+
releaseSostenutoPedal(channelNumber, halfVelocity) {
|
|
841
|
+
const velocity = halfVelocity * 2;
|
|
850
842
|
const channel = this.channels[channelNumber];
|
|
843
|
+
const promises = [];
|
|
851
844
|
channel.sostenutoPedal = false;
|
|
852
845
|
channel.sostenutoNotes.forEach((activeNote) => {
|
|
853
|
-
const {
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
gainNode.gain.linearRampToValueAtTime(0, now + fadeTime);
|
|
857
|
-
bufferSource.stop(now + fadeTime);
|
|
846
|
+
const { noteNumber } = activeNote;
|
|
847
|
+
const promise = this.releaseNote(channelNumber, noteNumber, velocity);
|
|
848
|
+
promises.push(promise);
|
|
858
849
|
});
|
|
859
850
|
channel.sostenutoNotes.clear();
|
|
851
|
+
return promises;
|
|
860
852
|
}
|
|
861
853
|
handleMIDIMessage(statusByte, data1, data2) {
|
|
862
854
|
const channelNumber = omni ? 0 : statusByte & 0x0F;
|
|
@@ -889,7 +881,7 @@ class MidyGM2 {
|
|
|
889
881
|
scheduledNotes.forEach((scheduledNote) => {
|
|
890
882
|
if (scheduledNote) {
|
|
891
883
|
const { initialAttenuation } = scheduledNote.noteInfo;
|
|
892
|
-
const gain = this.cbToRatio(initialAttenuation) * pressure;
|
|
884
|
+
const gain = this.cbToRatio(-initialAttenuation) * pressure;
|
|
893
885
|
scheduledNote.gainNode.gain.cancelScheduledValues(now);
|
|
894
886
|
scheduledNote.gainNode.gain.setValueAtTime(gain, now);
|
|
895
887
|
}
|
|
@@ -963,17 +955,12 @@ class MidyGM2 {
|
|
|
963
955
|
}
|
|
964
956
|
}
|
|
965
957
|
setBankMSB(channelNumber, msb) {
|
|
966
|
-
|
|
967
|
-
channel.bankMSB = msb;
|
|
958
|
+
this.channels[channelNumber].bankMSB = msb;
|
|
968
959
|
}
|
|
969
960
|
setModulation(channelNumber, modulation) {
|
|
970
|
-
const now = this.audioContext.currentTime;
|
|
971
961
|
const channel = this.channels[channelNumber];
|
|
972
|
-
channel.modulation = (modulation
|
|
973
|
-
channel.modulationDepthRange;
|
|
974
|
-
const lfoGain = channel.modulationEffect.lfoGain;
|
|
975
|
-
lfoGain.gain.cancelScheduledValues(now);
|
|
976
|
-
lfoGain.gain.setValueAtTime(channel.modulation, now);
|
|
962
|
+
channel.modulation = (modulation / 127) *
|
|
963
|
+
(channel.modulationDepthRange * 100);
|
|
977
964
|
}
|
|
978
965
|
setPortamentoTime(channelNumber, portamentoTime) {
|
|
979
966
|
this.channels[channelNumber].portamentoTime = portamentoTime / 127;
|
|
@@ -1008,7 +995,7 @@ class MidyGM2 {
|
|
|
1008
995
|
const isOn = value >= 64;
|
|
1009
996
|
this.channels[channelNumber].sustainPedal = isOn;
|
|
1010
997
|
if (!isOn) {
|
|
1011
|
-
this.releaseSustainPedal(channelNumber);
|
|
998
|
+
this.releaseSustainPedal(channelNumber, value);
|
|
1012
999
|
}
|
|
1013
1000
|
}
|
|
1014
1001
|
setPortamento(channelNumber, value) {
|
|
@@ -1037,11 +1024,13 @@ class MidyGM2 {
|
|
|
1037
1024
|
const activeNotes = this.getActiveNotes(channel);
|
|
1038
1025
|
channel.sostenutoNotes = new Map(activeNotes);
|
|
1039
1026
|
}
|
|
1027
|
+
else {
|
|
1028
|
+
this.releaseSostenutoPedal(channelNumber, value);
|
|
1029
|
+
}
|
|
1040
1030
|
}
|
|
1041
1031
|
setSoftPedal(channelNumber, softPedal) {
|
|
1042
1032
|
const channel = this.channels[channelNumber];
|
|
1043
1033
|
channel.softPedal = softPedal / 127;
|
|
1044
|
-
this.updateChannelGain(channel);
|
|
1045
1034
|
}
|
|
1046
1035
|
setRPNMSB(channelNumber, value) {
|
|
1047
1036
|
this.channels[channelNumber].rpnMSB = value;
|
|
@@ -1268,7 +1257,7 @@ Object.defineProperty(MidyGM2, "channelSettings", {
|
|
|
1268
1257
|
writable: true,
|
|
1269
1258
|
value: {
|
|
1270
1259
|
currentBufferSource: null,
|
|
1271
|
-
volume:
|
|
1260
|
+
volume: 100 / 127,
|
|
1272
1261
|
pan: 0,
|
|
1273
1262
|
portamentoTime: 0,
|
|
1274
1263
|
reverb: 0,
|
|
@@ -1285,7 +1274,7 @@ Object.defineProperty(MidyGM2, "channelSettings", {
|
|
|
1285
1274
|
pitchBend: 0,
|
|
1286
1275
|
fineTuning: 0,
|
|
1287
1276
|
coarseTuning: 0,
|
|
1288
|
-
modulationDepthRange:
|
|
1277
|
+
modulationDepthRange: 0.5,
|
|
1289
1278
|
}
|
|
1290
1279
|
});
|
|
1291
1280
|
Object.defineProperty(MidyGM2, "effectSettings", {
|
package/script/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;
|
|
@@ -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"}
|