spessasynth_lib 3.22.8 → 3.22.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spessasynth_lib",
3
- "version": "3.22.8",
3
+ "version": "3.22.10",
4
4
  "description": "MIDI and SoundFont2/DLS library with no compromises",
5
5
  "browser": "index.js",
6
6
  "types": "@types/index.d.ts",
@@ -106,7 +106,7 @@ generatorLimits[generatorTypes.freqVibLFO] = { min: -16000, max: 4500, def: 0 };
106
106
  generatorLimits[generatorTypes.delayModEnv] = { min: -32768, max: 5000, def: -32768 }; // -32768 indicates instant phase, this is done to prevent click at the start of filter modenv
107
107
  generatorLimits[generatorTypes.attackModEnv] = { min: -32768, max: 8000, def: -32768 };
108
108
  generatorLimits[generatorTypes.holdModEnv] = { min: -12000, max: 5000, def: -12000 };
109
- generatorLimits[generatorTypes.decayModEnv] = { min: -7200, max: 8000, def: -12000 }; // min is set to -7200 to prevent lowpass clicks
109
+ generatorLimits[generatorTypes.decayModEnv] = { min: -12000, max: 8000, def: -12000 };
110
110
  generatorLimits[generatorTypes.sustainModEnv] = { min: 0, max: 1000, def: 0 };
111
111
  generatorLimits[generatorTypes.releaseModEnv] = { min: -7200, max: 8000, def: -12000 }; // min is set to -7200 to prevent lowpass clicks
112
112
  // keynum to mod env
@@ -56,14 +56,18 @@ export function readRegion(chunk)
56
56
  const waveSampleChunk = regionChunks.find(c => c.header === "wsmp");
57
57
  // cbSize
58
58
  readLittleEndian(waveSampleChunk.chunkData, 4);
59
- const originalKey = readLittleEndian(waveSampleChunk.chunkData, 2);
59
+ let originalKey = readLittleEndian(waveSampleChunk.chunkData, 2);
60
60
 
61
61
  // sFineTune
62
- const pitchCorrection = signedInt16(
62
+ let pitchCorrection = signedInt16(
63
63
  waveSampleChunk.chunkData[waveSampleChunk.chunkData.currentIndex++],
64
64
  waveSampleChunk.chunkData[waveSampleChunk.chunkData.currentIndex++]
65
65
  );
66
66
 
67
+ const pitchCorrectionSemitones = Math.trunc(pitchCorrection / 100);
68
+ originalKey += pitchCorrectionSemitones;
69
+ pitchCorrection -= pitchCorrectionSemitones * 100;
70
+
67
71
  // gain correction: Each unit of gain represents 1/655360 dB
68
72
  // it is set after linking the sample
69
73
  const gainCorrection = readLittleEndian(waveSampleChunk.chunkData, 4);
@@ -199,6 +199,13 @@ export function readDLSSamples(waveListChunk)
199
199
  wsmpChunk.chunkData[wsmpChunk.chunkData.currentIndex++],
200
200
  wsmpChunk.chunkData[wsmpChunk.chunkData.currentIndex++]
201
201
  );
202
+
203
+ // pitch correction: convert hundreds to root key
204
+ const samplePitchSemitones = Math.trunc(samplePitch / 100);
205
+ sampleKey += samplePitchSemitones;
206
+ samplePitch -= samplePitchSemitones * 100;
207
+
208
+
202
209
  // gain is applied it manually here (literally multiplying the samples)
203
210
  const gainCorrection = readLittleEndian(wsmpChunk.chunkData, 4);
204
211
  // convert to signed and turn into decibels
@@ -252,6 +259,7 @@ export function readDLSSamples(waveListChunk)
252
259
  sampleDbAttenuation
253
260
  ));
254
261
 
262
+
255
263
  sampleID++;
256
264
  SpessaSynthInfo(
257
265
  `%cLoaded sample %c${sampleName}`,