spessasynth_core 4.3.3 → 4.3.4
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/dist/index.d.ts +16 -10
- package/dist/index.js +49 -41
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -956,11 +956,17 @@ declare class BasicSample {
|
|
|
956
956
|
*/
|
|
957
957
|
sampleType: SampleType;
|
|
958
958
|
/**
|
|
959
|
-
*
|
|
959
|
+
* The sample's loop start index, inclusive.
|
|
960
|
+
* In sample data points, relative to the start of the sample.
|
|
961
|
+
*
|
|
962
|
+
* Minimum allowed value is 0.
|
|
960
963
|
*/
|
|
961
964
|
loopStart: number;
|
|
962
965
|
/**
|
|
963
|
-
*
|
|
966
|
+
* The sample's loop end index, exclusive.
|
|
967
|
+
* In sample data points, relative to the start of the sample.
|
|
968
|
+
*
|
|
969
|
+
* Maximum allowed value is the sample data length.
|
|
964
970
|
*/
|
|
965
971
|
loopEnd: number;
|
|
966
972
|
/**
|
|
@@ -981,14 +987,14 @@ declare class BasicSample {
|
|
|
981
987
|
*/
|
|
982
988
|
protected audioData?: Float32Array;
|
|
983
989
|
/**
|
|
984
|
-
* The basic representation of a sample
|
|
985
|
-
* @param sampleName The sample's name
|
|
986
|
-
* @param sampleRate The sample's rate in Hz
|
|
987
|
-
* @param originalKey The sample's pitch as a MIDI note number
|
|
988
|
-
* @param pitchCorrection The sample's pitch correction in cents
|
|
989
|
-
* @param sampleType The sample's type, an enum that can indicate SF3
|
|
990
|
-
* @param loopStart The sample's loop start relative to the sample start in sample points
|
|
991
|
-
* @param loopEnd The sample's loop end relative to the sample start in sample points
|
|
990
|
+
* The basic representation of a sample.
|
|
991
|
+
* @param sampleName The sample's name.
|
|
992
|
+
* @param sampleRate The sample's rate in Hz.
|
|
993
|
+
* @param originalKey The sample's pitch as a MIDI note number.
|
|
994
|
+
* @param pitchCorrection The sample's pitch correction in cents.
|
|
995
|
+
* @param sampleType The sample's type, an enum that can indicate SF3.
|
|
996
|
+
* @param loopStart The sample's loop start relative to the sample start in sample points.
|
|
997
|
+
* @param loopEnd The sample's loop end relative to the sample start in sample points. Inclusive.
|
|
992
998
|
*/
|
|
993
999
|
constructor(sampleName: string, sampleRate: number, originalKey: number, pitchCorrection: number, sampleType: SampleType, loopStart: number, loopEnd: number);
|
|
994
1000
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2583,16 +2583,15 @@ function getNoteTimesInternal(midi, minDrumLength = 0) {
|
|
|
2583
2583
|
let i = 0;
|
|
2584
2584
|
let unfinished = 0;
|
|
2585
2585
|
const unfinishedNotes = [];
|
|
2586
|
-
for (let i = 0; i < 16; i++) unfinishedNotes.push(
|
|
2586
|
+
for (let i = 0; i < 16; i++) unfinishedNotes.push(/* @__PURE__ */ new Map());
|
|
2587
2587
|
const noteOff = (midiNote, channel) => {
|
|
2588
|
-
const
|
|
2589
|
-
const
|
|
2590
|
-
if (
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
}
|
|
2588
|
+
const ch = unfinishedNotes[channel];
|
|
2589
|
+
const noteIndex = ch.get(midiNote);
|
|
2590
|
+
if (noteIndex === void 0) return;
|
|
2591
|
+
const note = noteTimes[channel][noteIndex];
|
|
2592
|
+
const time = elapsedTime - note.start;
|
|
2593
|
+
note.length = channel === 9 ? Math.max(time, minDrumLength) : time;
|
|
2594
|
+
ch.delete(midiNote);
|
|
2596
2595
|
unfinished--;
|
|
2597
2596
|
};
|
|
2598
2597
|
const { timeline, tracks } = midi;
|
|
@@ -2602,27 +2601,30 @@ function getNoteTimesInternal(midi, minDrumLength = 0) {
|
|
|
2602
2601
|
const status = event.statusByte >> 4;
|
|
2603
2602
|
const channel = event.statusByte & 15;
|
|
2604
2603
|
if (status === 8) noteOff(event.data[0], channel);
|
|
2605
|
-
else if (status === 9)
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2604
|
+
else if (status === 9) {
|
|
2605
|
+
const midiNote = event.data[0];
|
|
2606
|
+
const velocity = event.data[1];
|
|
2607
|
+
if (velocity === 0) noteOff(midiNote, channel);
|
|
2608
|
+
else {
|
|
2609
|
+
noteOff(midiNote, channel);
|
|
2610
|
+
const noteTime = {
|
|
2611
|
+
midiNote,
|
|
2612
|
+
start: elapsedTime,
|
|
2613
|
+
length: -1,
|
|
2614
|
+
velocity
|
|
2615
|
+
};
|
|
2616
|
+
const times = noteTimes[channel];
|
|
2617
|
+
times.push(noteTime);
|
|
2618
|
+
unfinishedNotes[channel].set(midiNote, times.length - 1);
|
|
2619
|
+
unfinished++;
|
|
2620
|
+
}
|
|
2621
|
+
} else if (event.statusByte === 81) oneTickToSeconds = 60 / (getTempo(event) * midi.timeDivision);
|
|
2619
2622
|
if (++i >= timeline.length) break;
|
|
2620
2623
|
elapsedTime += oneTickToSeconds * (tracks[timeline[i].tr].events[timeline[i].ev].ticks - event.ticks);
|
|
2621
2624
|
}
|
|
2622
|
-
if (unfinished > 0) for (
|
|
2623
|
-
const
|
|
2624
|
-
note.length =
|
|
2625
|
-
if (channel === 9) note.length = Math.max(time, minDrumLength);
|
|
2625
|
+
if (unfinished > 0) for (let channel = 0; channel < unfinishedNotes.length; channel++) for (const noteIndex of unfinishedNotes[channel].values()) {
|
|
2626
|
+
const note = noteTimes[channel][noteIndex];
|
|
2627
|
+
note.length = elapsedTime - note.start;
|
|
2626
2628
|
}
|
|
2627
2629
|
return noteTimes;
|
|
2628
2630
|
}
|
|
@@ -6004,8 +6006,8 @@ function applySnapshot$1(snapshot) {
|
|
|
6004
6006
|
this.systemExclusive(MIDIUtils.gsData(64, 3, 0, [is.type >> 8, is.type & 127]));
|
|
6005
6007
|
for (let i = 0; i < is.params.length; i++) if (is.params[i] !== 255) this.systemExclusive(MIDIUtils.gsData(64, 3, 3 + i, [is.params[i]]));
|
|
6006
6008
|
for (let channel = 0; channel < is.channels.length; channel++) this.systemExclusive(MIDIUtils.gsData(64, 64 | MIDIUtils.channelToSyx(channel), 34, [is.channels[channel] ? 1 : 0]));
|
|
6007
|
-
for (const [parameter, value] of Object.entries(
|
|
6008
|
-
for (const [parameter, value] of Object.entries(
|
|
6009
|
+
for (const [parameter, value] of Object.entries(snapshot.midiParameters)) this.setMIDIParameter(parameter, value);
|
|
6010
|
+
for (const [parameter, value] of Object.entries(snapshot.systemParameters)) this.setSystemParameter(parameter, value);
|
|
6009
6011
|
}
|
|
6010
6012
|
function getSynthesizerSnapshot() {
|
|
6011
6013
|
return {
|
|
@@ -7961,11 +7963,17 @@ var BasicSample = class {
|
|
|
7961
7963
|
*/
|
|
7962
7964
|
sampleType;
|
|
7963
7965
|
/**
|
|
7964
|
-
*
|
|
7966
|
+
* The sample's loop start index, inclusive.
|
|
7967
|
+
* In sample data points, relative to the start of the sample.
|
|
7968
|
+
*
|
|
7969
|
+
* Minimum allowed value is 0.
|
|
7965
7970
|
*/
|
|
7966
7971
|
loopStart;
|
|
7967
7972
|
/**
|
|
7968
|
-
*
|
|
7973
|
+
* The sample's loop end index, exclusive.
|
|
7974
|
+
* In sample data points, relative to the start of the sample.
|
|
7975
|
+
*
|
|
7976
|
+
* Maximum allowed value is the sample data length.
|
|
7969
7977
|
*/
|
|
7970
7978
|
loopEnd;
|
|
7971
7979
|
/**
|
|
@@ -7986,14 +7994,14 @@ var BasicSample = class {
|
|
|
7986
7994
|
*/
|
|
7987
7995
|
audioData;
|
|
7988
7996
|
/**
|
|
7989
|
-
* The basic representation of a sample
|
|
7990
|
-
* @param sampleName The sample's name
|
|
7991
|
-
* @param sampleRate The sample's rate in Hz
|
|
7992
|
-
* @param originalKey The sample's pitch as a MIDI note number
|
|
7993
|
-
* @param pitchCorrection The sample's pitch correction in cents
|
|
7994
|
-
* @param sampleType The sample's type, an enum that can indicate SF3
|
|
7995
|
-
* @param loopStart The sample's loop start relative to the sample start in sample points
|
|
7996
|
-
* @param loopEnd The sample's loop end relative to the sample start in sample points
|
|
7997
|
+
* The basic representation of a sample.
|
|
7998
|
+
* @param sampleName The sample's name.
|
|
7999
|
+
* @param sampleRate The sample's rate in Hz.
|
|
8000
|
+
* @param originalKey The sample's pitch as a MIDI note number.
|
|
8001
|
+
* @param pitchCorrection The sample's pitch correction in cents.
|
|
8002
|
+
* @param sampleType The sample's type, an enum that can indicate SF3.
|
|
8003
|
+
* @param loopStart The sample's loop start relative to the sample start in sample points.
|
|
8004
|
+
* @param loopEnd The sample's loop end relative to the sample start in sample points. Inclusive.
|
|
7997
8005
|
*/
|
|
7998
8006
|
constructor(sampleName, sampleRate, originalKey, pitchCorrection, sampleType, loopStart, loopEnd) {
|
|
7999
8007
|
this.name = sampleName;
|
|
@@ -13051,8 +13059,8 @@ function applySnapshot(snapshot) {
|
|
|
13051
13059
|
this.setSystemParameter("presetLock", false);
|
|
13052
13060
|
if (snapshot.patch) this.setPatch(snapshot.patch);
|
|
13053
13061
|
this.lockedSystem = snapshot.lockedSystem;
|
|
13054
|
-
for (const [parameter, value] of Object.entries(
|
|
13055
|
-
for (const [parameter, value] of Object.entries(
|
|
13062
|
+
for (const [parameter, value] of Object.entries(snapshot.midiParameters)) this.setMIDIParameter(parameter, value);
|
|
13063
|
+
for (const [parameter, value] of Object.entries(snapshot.systemParameters)) this.setSystemParameter(parameter, value);
|
|
13056
13064
|
}
|
|
13057
13065
|
//#endregion
|
|
13058
13066
|
//#region src/synthesizer/audio_engine/channel/parameters/midi.ts
|