spessasynth_lib 3.21.13 → 3.21.14
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/synthetizer/synthetizer.d.ts +4 -0
- package/package.json +1 -1
- package/soundfont/dls/read_samples.js +3 -2
- package/synthetizer/synthetizer.js +26 -6
- package/synthetizer/worklet_processor.min.js +10 -10
- package/synthetizer/worklet_system/main_processor.js +5 -2
- package/synthetizer/worklet_system/worklet_methods/controller_control.js +2 -2
- package/synthetizer/worklet_system/worklet_methods/snapshot.js +1 -0
- package/synthetizer/worklet_system/worklet_methods/voice_control.js +4 -17
- package/synthetizer/worklet_system/worklet_utilities/stereo_panner.js +25 -22
package/package.json
CHANGED
|
@@ -41,15 +41,16 @@ export function readDLSSamples(waveListChunk)
|
|
|
41
41
|
{
|
|
42
42
|
throw new Error("No fmt chunk in the wave file!");
|
|
43
43
|
}
|
|
44
|
+
// https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.14393.0/shared/mmreg.h#L2108
|
|
44
45
|
const waveFormat = readLittleEndian(fmtChunk.chunkData, 2);
|
|
45
46
|
if (waveFormat !== 1)
|
|
46
47
|
{
|
|
47
|
-
throw new Error(
|
|
48
|
+
throw new Error(`Only PCM format in WAVE is supported. Fmt reports ${waveFormat}`);
|
|
48
49
|
}
|
|
49
50
|
const channelsAmount = readLittleEndian(fmtChunk.chunkData, 2);
|
|
50
51
|
if (channelsAmount !== 1)
|
|
51
52
|
{
|
|
52
|
-
throw new Error(
|
|
53
|
+
throw new Error(`Only mono samples are supported. Fmt reports ${channelsAmount} channels`);
|
|
53
54
|
}
|
|
54
55
|
const sampleRate = readLittleEndian(fmtChunk.chunkData, 4);
|
|
55
56
|
// skip avg bytes
|
|
@@ -127,6 +127,24 @@ export class Synthetizer
|
|
|
127
127
|
processorChannelCount = [32];
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
// check for config data in snapshot
|
|
131
|
+
if (startRenderingData?.snapshot?.effectsConfig !== undefined)
|
|
132
|
+
{
|
|
133
|
+
/**
|
|
134
|
+
* @type {EffectsConfig}
|
|
135
|
+
*/
|
|
136
|
+
this.effectsConfig = startRenderingData.snapshot.effectsConfig;
|
|
137
|
+
// remove from config as it can't be cloned
|
|
138
|
+
delete startRenderingData.snapshot.effectsConfig;
|
|
139
|
+
}
|
|
140
|
+
else
|
|
141
|
+
{
|
|
142
|
+
/**
|
|
143
|
+
* @type {EffectsConfig}
|
|
144
|
+
*/
|
|
145
|
+
this.effectsConfig = effectsConfig;
|
|
146
|
+
}
|
|
147
|
+
|
|
130
148
|
// first two outputs: reverb, chorsu, the others are the channel outputs
|
|
131
149
|
try
|
|
132
150
|
{
|
|
@@ -143,6 +161,7 @@ export class Synthetizer
|
|
|
143
161
|
}
|
|
144
162
|
catch (e)
|
|
145
163
|
{
|
|
164
|
+
console.error(e);
|
|
146
165
|
throw new Error("Could not create the audioWorklet. Did you forget to addModule()?");
|
|
147
166
|
}
|
|
148
167
|
|
|
@@ -175,18 +194,17 @@ export class Synthetizer
|
|
|
175
194
|
* @type {function(WorkletSequencerReturnMessageType, any)}
|
|
176
195
|
*/
|
|
177
196
|
this.sequencerCallbackFunction = undefined;
|
|
178
|
-
|
|
179
197
|
// add reverb
|
|
180
|
-
if (effectsConfig.reverbEnabled && !oneOutputMode)
|
|
198
|
+
if (this.effectsConfig.reverbEnabled && !oneOutputMode)
|
|
181
199
|
{
|
|
182
|
-
this.reverbProcessor = getReverbProcessor(this.context, effectsConfig.reverbImpulseResponse);
|
|
200
|
+
this.reverbProcessor = getReverbProcessor(this.context, this.effectsConfig.reverbImpulseResponse);
|
|
183
201
|
this.reverbProcessor.connect(targetNode);
|
|
184
202
|
this.worklet.connect(this.reverbProcessor, 0);
|
|
185
203
|
}
|
|
186
204
|
|
|
187
|
-
if (effectsConfig.chorusEnabled && !oneOutputMode)
|
|
205
|
+
if (this.effectsConfig.chorusEnabled && !oneOutputMode)
|
|
188
206
|
{
|
|
189
|
-
this.chorusProcessor = new FancyChorus(targetNode, effectsConfig.chorusConfig);
|
|
207
|
+
this.chorusProcessor = new FancyChorus(targetNode, this.effectsConfig.chorusConfig);
|
|
190
208
|
this.worklet.connect(this.chorusProcessor.input, 1);
|
|
191
209
|
}
|
|
192
210
|
|
|
@@ -361,6 +379,7 @@ export class Synthetizer
|
|
|
361
379
|
this._snapshotCallback = s =>
|
|
362
380
|
{
|
|
363
381
|
this._snapshotCallback = undefined;
|
|
382
|
+
s.effectsConfig = this.effectsConfig;
|
|
364
383
|
resolve(s);
|
|
365
384
|
};
|
|
366
385
|
this.post({
|
|
@@ -821,6 +840,7 @@ export class Synthetizer
|
|
|
821
840
|
setReverbResponse(buffer)
|
|
822
841
|
{
|
|
823
842
|
this.reverbProcessor.buffer = buffer;
|
|
843
|
+
this.effectsConfig.reverbImpulseResponse = buffer;
|
|
824
844
|
}
|
|
825
845
|
|
|
826
846
|
/**
|
|
@@ -829,12 +849,12 @@ export class Synthetizer
|
|
|
829
849
|
*/
|
|
830
850
|
setChorusConfig(config)
|
|
831
851
|
{
|
|
832
|
-
console.log(config);
|
|
833
852
|
this.worklet.disconnect(this.chorusProcessor.input);
|
|
834
853
|
this.chorusProcessor.delete();
|
|
835
854
|
delete this.chorusProcessor;
|
|
836
855
|
this.chorusProcessor = new FancyChorus(this.targetNode, config);
|
|
837
856
|
this.worklet.connect(this.chorusProcessor.input, 1);
|
|
857
|
+
this.effectsConfig.chorusConfig = config;
|
|
838
858
|
}
|
|
839
859
|
|
|
840
860
|
reverbateEverythingBecauseWhyNot()
|