spessasynth_lib 3.20.22 → 3.20.24
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/@types/soundfont/dls/dls_zone.d.ts +2 -1
- package/@types/synthetizer/synthetizer.d.ts +1 -1
- package/@types/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.d.ts +3 -3
- package/package.json +1 -1
- package/soundfont/dls/dls_zone.js +14 -0
- package/soundfont/dls/read_region.js +9 -4
- package/synthetizer/synthetizer.js +2 -2
- package/synthetizer/worklet_processor.min.js +9 -9
- package/synthetizer/worklet_system/main_processor.js +2 -2
- package/synthetizer/worklet_system/message_protocol/handle_message.js +2 -2
- package/synthetizer/worklet_system/worklet_methods/data_entry.js +4 -20
- package/synthetizer/worklet_system/worklet_methods/snapshot.js +2 -2
- package/synthetizer/worklet_system/worklet_methods/vibrato_control.js +3 -3
- package/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.js +2 -2
- package/utils/buffer_to_wav.js +2 -2
|
@@ -13,10 +13,11 @@ export class DLSZone extends BasicInstrumentZone {
|
|
|
13
13
|
* @param sampleKey {number}
|
|
14
14
|
* @param sample {BasicSample}
|
|
15
15
|
* @param sampleID {number}
|
|
16
|
+
* @param samplePitchCorrection {number} cents
|
|
16
17
|
*/
|
|
17
18
|
setWavesample(attenuationCb: number, loopingMode: number, loop: {
|
|
18
19
|
start: number;
|
|
19
20
|
end: number;
|
|
20
|
-
}, sampleKey: number, sample: BasicSample, sampleID: number): void;
|
|
21
|
+
}, sampleKey: number, sample: BasicSample, sampleID: number, samplePitchCorrection: number): void;
|
|
21
22
|
}
|
|
22
23
|
import { BasicInstrumentZone } from '../basic_soundfont/basic_zones.js';
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* @property {boolean} lockPreset - indicates whether the program on the channel is locked
|
|
20
20
|
* @property {boolean} presetUsesOverride - indcates if the channel uses a preset from the override soundfont.
|
|
21
21
|
*
|
|
22
|
-
* @property {boolean}
|
|
22
|
+
* @property {boolean} lockGSNRPNParams - indicates whether the GS NRPN parameters are enabled
|
|
23
23
|
* @property {Object} channelVibrato - vibrato settings for the channel
|
|
24
24
|
* @property {number} channelVibrato.depth - depth of the vibrato effect (cents)
|
|
25
25
|
* @property {number} channelVibrato.delay - delay before the vibrato effect starts (seconds)
|
|
@@ -119,9 +119,9 @@ export type WorkletProcessorChannel = {
|
|
|
119
119
|
*/
|
|
120
120
|
presetUsesOverride: boolean;
|
|
121
121
|
/**
|
|
122
|
-
* - indicates whether the
|
|
122
|
+
* - indicates whether the GS NRPN parameters are enabled
|
|
123
123
|
*/
|
|
124
|
-
|
|
124
|
+
lockGSNRPNParams: boolean;
|
|
125
125
|
/**
|
|
126
126
|
* - vibrato settings for the channel
|
|
127
127
|
*/
|
package/package.json
CHANGED
|
@@ -22,6 +22,7 @@ export class DLSZone extends BasicInstrumentZone
|
|
|
22
22
|
* @param sampleKey {number}
|
|
23
23
|
* @param sample {BasicSample}
|
|
24
24
|
* @param sampleID {number}
|
|
25
|
+
* @param samplePitchCorrection {number} cents
|
|
25
26
|
*/
|
|
26
27
|
setWavesample(
|
|
27
28
|
attenuationCb,
|
|
@@ -30,6 +31,7 @@ export class DLSZone extends BasicInstrumentZone
|
|
|
30
31
|
sampleKey,
|
|
31
32
|
sample,
|
|
32
33
|
sampleID,
|
|
34
|
+
samplePitchCorrection,
|
|
33
35
|
)
|
|
34
36
|
{
|
|
35
37
|
if(loopingMode !== 0)
|
|
@@ -39,6 +41,18 @@ export class DLSZone extends BasicInstrumentZone
|
|
|
39
41
|
this.generators.push(new Generator(generatorTypes.initialAttenuation, attenuationCb));
|
|
40
42
|
this.isGlobal = false;
|
|
41
43
|
|
|
44
|
+
// correct tuning if needed
|
|
45
|
+
const coarseTune = Math.trunc(samplePitchCorrection / 100);
|
|
46
|
+
if(coarseTune !== 0)
|
|
47
|
+
{
|
|
48
|
+
this.generators.push(new Generator(generatorTypes.coarseTune, coarseTune));
|
|
49
|
+
}
|
|
50
|
+
const fineTune = samplePitchCorrection - (coarseTune * 100);
|
|
51
|
+
if(fineTune !== 0)
|
|
52
|
+
{
|
|
53
|
+
this.generators.push(new Generator(generatorTypes.fineTune, fineTune));
|
|
54
|
+
}
|
|
55
|
+
|
|
42
56
|
// correct loop if needed
|
|
43
57
|
const diffStart = loop.start - (sample.sampleLoopStartIndex / 2);
|
|
44
58
|
const diffEnd = loop.end - (sample.sampleLoopEndIndex / 2);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readLittleEndian } from '../../utils/byte_functions/little_endian.js'
|
|
1
|
+
import { readLittleEndian, signedInt16 } from '../../utils/byte_functions/little_endian.js'
|
|
2
2
|
import { findRIFFListType, readRIFFChunk } from '../basic_soundfont/riff_chunk.js'
|
|
3
3
|
import { Generator, generatorTypes } from '../read_sf2/generators.js'
|
|
4
4
|
import { DLSZone } from './dls_zone.js'
|
|
@@ -57,8 +57,12 @@ export function readRegion(chunk)
|
|
|
57
57
|
// cbSize
|
|
58
58
|
readLittleEndian(waveSampleChunk.chunkData, 4);
|
|
59
59
|
const originalKey = readLittleEndian(waveSampleChunk.chunkData, 2);
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
|
|
61
|
+
// sFineTune
|
|
62
|
+
const pitchCorrection = signedInt16(
|
|
63
|
+
waveSampleChunk.chunkData[waveSampleChunk.chunkData.currentIndex++],
|
|
64
|
+
waveSampleChunk.chunkData[waveSampleChunk.chunkData.currentIndex++]
|
|
65
|
+
);
|
|
62
66
|
|
|
63
67
|
// gain correction: Each unit of gain represents 1/655360 dB
|
|
64
68
|
const gainCorrection = readLittleEndian(waveSampleChunk.chunkData, 4);
|
|
@@ -124,6 +128,7 @@ export function readRegion(chunk)
|
|
|
124
128
|
loop,
|
|
125
129
|
originalKey,
|
|
126
130
|
sample,
|
|
127
|
-
sampleID
|
|
131
|
+
sampleID,
|
|
132
|
+
pitchCorrection);
|
|
128
133
|
return zone;
|
|
129
134
|
}
|
|
@@ -401,9 +401,9 @@ export class Synthetizer {
|
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
/*
|
|
404
|
-
*
|
|
404
|
+
* Disables the GS NRPN parameters like vibrato or drum key tuning
|
|
405
405
|
*/
|
|
406
|
-
|
|
406
|
+
disableGSNRPparams()
|
|
407
407
|
{
|
|
408
408
|
// rate -1 disables, see worklet_message.js line 9
|
|
409
409
|
// channel -1 is all
|