spessasynth_core 3.27.4 → 3.27.5
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
|
@@ -34,6 +34,20 @@ export const modulatorCurveTypes = {
|
|
|
34
34
|
switch: 3
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
|
|
38
|
+
export function getModSourceEnum(curveType, polarity, direction, isCC, index)
|
|
39
|
+
{
|
|
40
|
+
return (curveType << 10) | (polarity << 9) | (direction << 8) | (isCC << 7) | index;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const defaultResonantModSource = getModSourceEnum(
|
|
44
|
+
modulatorCurveTypes.linear,
|
|
45
|
+
1,
|
|
46
|
+
0,
|
|
47
|
+
1,
|
|
48
|
+
midiControllers.filterResonance
|
|
49
|
+
); // linear forwards bipolar cc 74
|
|
50
|
+
|
|
37
51
|
export class Modulator
|
|
38
52
|
{
|
|
39
53
|
/**
|
|
@@ -70,6 +84,7 @@ export class Modulator
|
|
|
70
84
|
* - still can be disabled if the soundfont has its own modulator curve
|
|
71
85
|
* - this fixes the very low amount of reverb by default and doesn't break soundfonts
|
|
72
86
|
* @type {boolean}
|
|
87
|
+
* @readonly
|
|
73
88
|
*/
|
|
74
89
|
isEffectModulator = false;
|
|
75
90
|
|
|
@@ -77,8 +92,9 @@ export class Modulator
|
|
|
77
92
|
* The default resonant modulator does not affect the filter gain.
|
|
78
93
|
* Neither XG nor GS responded to cc #74 in that way.
|
|
79
94
|
* @type {boolean}
|
|
95
|
+
* @readonly
|
|
80
96
|
*/
|
|
81
|
-
|
|
97
|
+
isDefaultResonantModulator = false;
|
|
82
98
|
|
|
83
99
|
/**
|
|
84
100
|
* 1 if the source is bipolar (min is -1, max is 1)
|
|
@@ -158,6 +174,7 @@ export class Modulator
|
|
|
158
174
|
* @param amount {number}
|
|
159
175
|
* @param transformType {0|2}
|
|
160
176
|
* @param isEffectModulator {boolean}
|
|
177
|
+
* @param isDefaultResonantModulator {boolean}
|
|
161
178
|
*/
|
|
162
179
|
constructor(sourceIndex,
|
|
163
180
|
sourceCurveType,
|
|
@@ -172,7 +189,8 @@ export class Modulator
|
|
|
172
189
|
destination,
|
|
173
190
|
amount,
|
|
174
191
|
transformType,
|
|
175
|
-
isEffectModulator = false
|
|
192
|
+
isEffectModulator = false,
|
|
193
|
+
isDefaultResonantModulator = false)
|
|
176
194
|
{
|
|
177
195
|
this.sourcePolarity = sourcePolarity;
|
|
178
196
|
this.sourceDirection = sourceDirection;
|
|
@@ -190,6 +208,7 @@ export class Modulator
|
|
|
190
208
|
this.transformAmount = amount;
|
|
191
209
|
this.transformType = transformType;
|
|
192
210
|
this.isEffectModulator = isEffectModulator;
|
|
211
|
+
this.isDefaultResonantModulator = isDefaultResonantModulator;
|
|
193
212
|
|
|
194
213
|
|
|
195
214
|
if (this.modulatorDestination > MAX_GENERATOR)
|
|
@@ -205,7 +224,7 @@ export class Modulator
|
|
|
205
224
|
*/
|
|
206
225
|
static copy(modulator)
|
|
207
226
|
{
|
|
208
|
-
|
|
227
|
+
return new Modulator(
|
|
209
228
|
modulator.sourceIndex,
|
|
210
229
|
modulator.sourceCurveType,
|
|
211
230
|
modulator.sourceUsesCC,
|
|
@@ -219,10 +238,9 @@ export class Modulator
|
|
|
219
238
|
modulator.modulatorDestination,
|
|
220
239
|
modulator.transformAmount,
|
|
221
240
|
modulator.transformType,
|
|
222
|
-
modulator.isEffectModulator
|
|
241
|
+
modulator.isEffectModulator,
|
|
242
|
+
modulator.isDefaultResonantModulator
|
|
223
243
|
);
|
|
224
|
-
m.isDefaultResonanceModulator = modulator.isDefaultResonanceModulator;
|
|
225
|
-
return m;
|
|
226
244
|
}
|
|
227
245
|
|
|
228
246
|
/**
|
|
@@ -322,7 +340,7 @@ export class Modulator
|
|
|
322
340
|
*/
|
|
323
341
|
sumTransform(modulator)
|
|
324
342
|
{
|
|
325
|
-
|
|
343
|
+
return new Modulator(
|
|
326
344
|
this.sourceIndex,
|
|
327
345
|
this.sourceCurveType,
|
|
328
346
|
this.sourceUsesCC,
|
|
@@ -336,10 +354,9 @@ export class Modulator
|
|
|
336
354
|
this.modulatorDestination,
|
|
337
355
|
this.transformAmount + modulator.transformAmount,
|
|
338
356
|
this.transformType,
|
|
339
|
-
this.isEffectModulator
|
|
357
|
+
this.isEffectModulator,
|
|
358
|
+
this.isDefaultResonantModulator
|
|
340
359
|
);
|
|
341
|
-
m.isDefaultResonanceModulator = modulator.isDefaultResonanceModulator;
|
|
342
|
-
return m;
|
|
343
360
|
}
|
|
344
361
|
}
|
|
345
362
|
|
|
@@ -396,16 +413,19 @@ export class DecodedModulator extends Modulator
|
|
|
396
413
|
this.modulatorDestination === generatorTypes.reverbEffectsSend
|
|
397
414
|
|| this.modulatorDestination === generatorTypes.chorusEffectsSend
|
|
398
415
|
);
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
this.isDefaultResonantModulator = (
|
|
419
|
+
sourceEnum === defaultResonantModSource
|
|
420
|
+
&& secondarySourceEnum === 0x0
|
|
421
|
+
&& this.modulatorDestination === generatorTypes.initialFilterQ
|
|
422
|
+
);
|
|
399
423
|
}
|
|
400
424
|
}
|
|
401
425
|
|
|
402
426
|
export const DEFAULT_ATTENUATION_MOD_AMOUNT = 960;
|
|
403
427
|
export const DEFAULT_ATTENUATION_MOD_CURVE_TYPE = modulatorCurveTypes.concave;
|
|
404
428
|
|
|
405
|
-
export function getModSourceEnum(curveType, polarity, direction, isCC, index)
|
|
406
|
-
{
|
|
407
|
-
return (curveType << 10) | (polarity << 9) | (direction << 8) | (isCC << 7) | index;
|
|
408
|
-
}
|
|
409
429
|
|
|
410
430
|
const soundFontModulators = [
|
|
411
431
|
// vel to attenuation
|
|
@@ -542,26 +562,18 @@ const customModulators = [
|
|
|
542
562
|
generatorTypes.initialFilterFc,
|
|
543
563
|
6000,
|
|
544
564
|
0
|
|
565
|
+
),
|
|
566
|
+
|
|
567
|
+
// cc 71 (filter Q) to filter Q (default resonant modulator)
|
|
568
|
+
new DecodedModulator(
|
|
569
|
+
defaultResonantModSource,
|
|
570
|
+
0x0, // no controller
|
|
571
|
+
generatorTypes.initialFilterQ,
|
|
572
|
+
250,
|
|
573
|
+
0
|
|
545
574
|
)
|
|
546
575
|
|
|
547
576
|
];
|
|
548
|
-
// cc 71 (filter Q) to filter Q
|
|
549
|
-
const resonanceModulator = new DecodedModulator(
|
|
550
|
-
getModSourceEnum(
|
|
551
|
-
modulatorCurveTypes.linear,
|
|
552
|
-
1,
|
|
553
|
-
0,
|
|
554
|
-
1,
|
|
555
|
-
midiControllers.filterResonance
|
|
556
|
-
), // linear forwards bipolar cc 74
|
|
557
|
-
0x0, // no controller
|
|
558
|
-
generatorTypes.initialFilterQ,
|
|
559
|
-
250,
|
|
560
|
-
0
|
|
561
|
-
);
|
|
562
|
-
|
|
563
|
-
resonanceModulator.isDefaultResonanceModulator = true;
|
|
564
|
-
customModulators.push(resonanceModulator);
|
|
565
577
|
|
|
566
578
|
/**
|
|
567
579
|
* @type {Modulator[]}
|
|
@@ -114,7 +114,7 @@ export function computeModulator(controllerTable, modulator, voice)
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
// resonant modulator: take its value and ensure that it won't change the final gain
|
|
117
|
-
if (modulator.
|
|
117
|
+
if (modulator.isDefaultResonantModulator)
|
|
118
118
|
{
|
|
119
119
|
// half the gain, negates the filter
|
|
120
120
|
voice.resonanceOffset = Math.max(0, computedValue / 2);
|