@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.js
CHANGED
|
@@ -8,12 +8,6 @@ export class Midy {
|
|
|
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 Midy {
|
|
|
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 Midy {
|
|
|
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 Midy {
|
|
|
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 Midy {
|
|
|
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 Midy {
|
|
|
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 Midy {
|
|
|
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 Midy {
|
|
|
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 Midy {
|
|
|
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) {
|
|
@@ -760,11 +750,12 @@ export class Midy {
|
|
|
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 Midy {
|
|
|
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 Midy {
|
|
|
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 Midy {
|
|
|
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 Midy {
|
|
|
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
|
}
|
|
@@ -974,13 +966,9 @@ export class Midy {
|
|
|
974
966
|
this.channels[channelNumber].bankMSB = msb;
|
|
975
967
|
}
|
|
976
968
|
setModulation(channelNumber, modulation) {
|
|
977
|
-
const now = this.audioContext.currentTime;
|
|
978
969
|
const channel = this.channels[channelNumber];
|
|
979
|
-
channel.modulation = (modulation
|
|
980
|
-
channel.modulationDepthRange;
|
|
981
|
-
const lfoGain = channel.modulationEffect.lfoGain;
|
|
982
|
-
lfoGain.gain.cancelScheduledValues(now);
|
|
983
|
-
lfoGain.gain.setValueAtTime(channel.modulation, now);
|
|
970
|
+
channel.modulation = (modulation / 127) *
|
|
971
|
+
(channel.modulationDepthRange * 100);
|
|
984
972
|
}
|
|
985
973
|
setPortamentoTime(channelNumber, portamentoTime) {
|
|
986
974
|
this.channels[channelNumber].portamentoTime = portamentoTime / 127;
|
|
@@ -1015,7 +1003,7 @@ export class Midy {
|
|
|
1015
1003
|
const isOn = value >= 64;
|
|
1016
1004
|
this.channels[channelNumber].sustainPedal = isOn;
|
|
1017
1005
|
if (!isOn) {
|
|
1018
|
-
this.releaseSustainPedal(channelNumber);
|
|
1006
|
+
this.releaseSustainPedal(channelNumber, value);
|
|
1019
1007
|
}
|
|
1020
1008
|
}
|
|
1021
1009
|
setPortamento(channelNumber, value) {
|
|
@@ -1044,25 +1032,29 @@ export class Midy {
|
|
|
1044
1032
|
const activeNotes = this.getActiveNotes(channel);
|
|
1045
1033
|
channel.sostenutoNotes = new Map(activeNotes);
|
|
1046
1034
|
}
|
|
1035
|
+
else {
|
|
1036
|
+
this.releaseSostenutoPedal(channelNumber, value);
|
|
1037
|
+
}
|
|
1047
1038
|
}
|
|
1048
1039
|
setSoftPedal(channelNumber, softPedal) {
|
|
1049
1040
|
const channel = this.channels[channelNumber];
|
|
1050
1041
|
channel.softPedal = softPedal / 127;
|
|
1051
|
-
this.updateChannelGain(channel);
|
|
1052
1042
|
}
|
|
1053
1043
|
setVibratoRate(channelNumber, vibratoRate) {
|
|
1054
1044
|
const now = this.audioContext.currentTime;
|
|
1055
1045
|
const channel = this.channels[channelNumber];
|
|
1056
1046
|
channel.vibratoRate = vibratoRate / 127 * 4 + 3; // 3-7Hz
|
|
1057
|
-
channel.modulationEffect.lfo.frequency
|
|
1058
|
-
|
|
1047
|
+
channel.modulationEffect.lfo.frequency
|
|
1048
|
+
.cancelScheduledValues(now)
|
|
1049
|
+
.setValueAtTime(channel.vibratoRate, now);
|
|
1059
1050
|
}
|
|
1060
1051
|
setVibratoDepth(channelNumber, vibratoDepth) {
|
|
1061
1052
|
const now = this.audioContext.currentTime;
|
|
1062
1053
|
const channel = this.channels[channelNumber];
|
|
1063
1054
|
channel.vibratoDepth = vibratoDepth / 127;
|
|
1064
|
-
channel.modulationEffect.lfoGain.gain
|
|
1065
|
-
|
|
1055
|
+
channel.modulationEffect.lfoGain.gain
|
|
1056
|
+
.cancelScheduledValues(now)
|
|
1057
|
+
.setValueAtTime(channel.vibratoDepth, now);
|
|
1066
1058
|
}
|
|
1067
1059
|
setVibratoDelay(channelNumber, vibratoDelay) {
|
|
1068
1060
|
// Access Virus: 0-10sec
|
|
@@ -1333,7 +1325,7 @@ Object.defineProperty(Midy, "channelSettings", {
|
|
|
1333
1325
|
writable: true,
|
|
1334
1326
|
value: {
|
|
1335
1327
|
currentBufferSource: null,
|
|
1336
|
-
volume:
|
|
1328
|
+
volume: 100 / 127,
|
|
1337
1329
|
pan: 0,
|
|
1338
1330
|
portamentoTime: 0,
|
|
1339
1331
|
reverb: 0,
|
|
@@ -1350,7 +1342,7 @@ Object.defineProperty(Midy, "channelSettings", {
|
|
|
1350
1342
|
pitchBend: 0,
|
|
1351
1343
|
fineTuning: 0,
|
|
1352
1344
|
coarseTuning: 0,
|
|
1353
|
-
modulationDepthRange:
|
|
1345
|
+
modulationDepthRange: 0.5,
|
|
1354
1346
|
}
|
|
1355
1347
|
});
|
|
1356
1348
|
Object.defineProperty(Midy, "effectSettings", {
|
package/package.json
CHANGED
package/script/midy-GM1.d.ts
CHANGED
|
@@ -24,7 +24,6 @@ export class MidyGM1 {
|
|
|
24
24
|
};
|
|
25
25
|
constructor(audioContext: any);
|
|
26
26
|
ticksPerBeat: number;
|
|
27
|
-
secondsPerBeat: number;
|
|
28
27
|
totalTime: number;
|
|
29
28
|
noteCheckInterval: number;
|
|
30
29
|
lookAhead: number;
|
|
@@ -50,7 +49,6 @@ export class MidyGM1 {
|
|
|
50
49
|
pannerNode: any;
|
|
51
50
|
modulationEffect: {
|
|
52
51
|
lfo: any;
|
|
53
|
-
lfoGain: any;
|
|
54
52
|
};
|
|
55
53
|
expression: number;
|
|
56
54
|
modulation: number;
|
|
@@ -81,7 +79,6 @@ export class MidyGM1 {
|
|
|
81
79
|
pannerNode: any;
|
|
82
80
|
modulationEffect: {
|
|
83
81
|
lfo: any;
|
|
84
|
-
lfoGain: any;
|
|
85
82
|
};
|
|
86
83
|
};
|
|
87
84
|
createChannels(audioContext: any): {
|
|
@@ -91,7 +88,6 @@ export class MidyGM1 {
|
|
|
91
88
|
pannerNode: any;
|
|
92
89
|
modulationEffect: {
|
|
93
90
|
lfo: any;
|
|
94
|
-
lfoGain: any;
|
|
95
91
|
};
|
|
96
92
|
expression: number;
|
|
97
93
|
modulation: number;
|
|
@@ -137,12 +133,6 @@ export class MidyGM1 {
|
|
|
137
133
|
getActiveChannelNotes(scheduledNotes: any): any;
|
|
138
134
|
createModulationEffect(audioContext: any): {
|
|
139
135
|
lfo: any;
|
|
140
|
-
lfoGain: any;
|
|
141
|
-
};
|
|
142
|
-
createReverbEffect(audioContext: any, options?: {}): {
|
|
143
|
-
convolverNode: any;
|
|
144
|
-
dryGain: any;
|
|
145
|
-
wetGain: any;
|
|
146
136
|
};
|
|
147
137
|
connectNoteEffects(channel: any, gainNode: any): void;
|
|
148
138
|
cbToRatio(cb: any): number;
|
|
@@ -151,12 +141,13 @@ export class MidyGM1 {
|
|
|
151
141
|
bufferSource: any;
|
|
152
142
|
gainNode: any;
|
|
153
143
|
filterNode: any;
|
|
144
|
+
lfoGain: any;
|
|
154
145
|
}>;
|
|
155
146
|
scheduleNoteOn(channelNumber: any, noteNumber: any, velocity: any, startTime: any): Promise<void>;
|
|
156
147
|
noteOn(channelNumber: any, noteNumber: any, velocity: any): Promise<void>;
|
|
157
148
|
scheduleNoteRelease(channelNumber: any, noteNumber: any, velocity: any, stopTime: any, stopPedal?: boolean): Promise<any> | undefined;
|
|
158
149
|
releaseNote(channelNumber: any, noteNumber: any, velocity: any): Promise<any> | undefined;
|
|
159
|
-
releaseSustainPedal(channelNumber: any):
|
|
150
|
+
releaseSustainPedal(channelNumber: any, halfVelocity: any): any[];
|
|
160
151
|
handleMIDIMessage(statusByte: any, data1: any, data2: any): void | any[] | Promise<any>;
|
|
161
152
|
handlePolyphonicKeyPressure(channelNumber: any, noteNumber: any, pressure: any): void;
|
|
162
153
|
handleProgramChange(channelNumber: any, program: any): void;
|
package/script/midy-GM1.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"midy-GM1.d.ts","sourceRoot":"","sources":["../src/midy-GM1.js"],"names":[],"mappings":"AAMA;
|
|
1
|
+
{"version":3,"file":"midy-GM1.d.ts","sourceRoot":"","sources":["../src/midy-GM1.js"],"names":[],"mappings":"AAMA;IAmBE;;;;;;;;;;;;;;MAcE;IAEF;;;;;;;MAOE;IAEF,+BAMC;IAjDD,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;IA4BhB,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;;;;;OA6EC;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,+DAoBC;IAED,uCAoBC;IAED,8CAEC;IAED,uCAoBC;IAED,4DAgBC;IAED,oBAQC;IAED,yDAaC;IAED,yCAGC;IAED,sCAIC;IAED,wCAEC;IAED,6BASC;IAED,0DAUC;CACF"}
|