spessasynth_lib 3.22.9 → 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
|
@@ -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
|
-
|
|
59
|
+
let originalKey = readLittleEndian(waveSampleChunk.chunkData, 2);
|
|
60
60
|
|
|
61
61
|
// sFineTune
|
|
62
|
-
|
|
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}`,
|