spessasynth_lib 3.20.32 → 3.20.34
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.
|
@@ -330,7 +330,6 @@ export class WorkletVolumeEnvelope
|
|
|
330
330
|
// fallthrough
|
|
331
331
|
|
|
332
332
|
case 1:
|
|
333
|
-
let gain;
|
|
334
333
|
// attack phase: ramp from 0 to attenuation
|
|
335
334
|
while(env.currentSampleTime < env.attackEnd)
|
|
336
335
|
{
|
|
@@ -339,8 +338,7 @@ export class WorkletVolumeEnvelope
|
|
|
339
338
|
|
|
340
339
|
// Special case: linear gain ramp instead of linear db ramp
|
|
341
340
|
let linearAttenuation = 1 - (env.attackEnd - env.currentSampleTime) / env.attackDuration; // 0 to 1
|
|
342
|
-
|
|
343
|
-
audioBuffer[filledBuffer] *= gain;
|
|
341
|
+
audioBuffer[filledBuffer] *= linearAttenuation * decibelAttenuationToGain(env.attenuation + decibelOffset);
|
|
344
342
|
// set current attenuation to peak as its invalid during this phase
|
|
345
343
|
env.currentAttenuationDb = env.attenuation;
|
|
346
344
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { modulatorSources } from '../../../soundfont/read_sf2/modulators.js'
|
|
2
2
|
import { getModulatorCurveValue, MOD_PRECOMPUTED_LENGTH } from './modulator_curves.js'
|
|
3
3
|
import { NON_CC_INDEX_OFFSET } from './worklet_processor_channel.js'
|
|
4
|
-
import { generatorTypes } from '../../../soundfont/read_sf2/generators.js'
|
|
4
|
+
import { generatorLimits, generatorTypes } from '../../../soundfont/read_sf2/generators.js'
|
|
5
5
|
import { WorkletVolumeEnvelope } from './volume_envelope.js'
|
|
6
6
|
import { WorkletModulationEnvelope } from './modulation_envelope.js'
|
|
7
7
|
|
|
@@ -123,7 +123,9 @@ export function computeModulators(voice, controllerTable, sourceUsesCC = -1, sou
|
|
|
123
123
|
// All modulators mode: compute all modulators
|
|
124
124
|
modulatedGenerators.set(generators);
|
|
125
125
|
modulators.forEach(mod => {
|
|
126
|
-
|
|
126
|
+
const limits = generatorLimits[mod.modulatorDestination];
|
|
127
|
+
const newValue = modulatedGenerators[mod.modulatorDestination] + computeWorkletModulator(controllerTable, mod, voice);
|
|
128
|
+
modulatedGenerators[mod.modulatorDestination] = Math.max(limits.min, Math.min(newValue, limits.max));
|
|
127
129
|
});
|
|
128
130
|
WorkletVolumeEnvelope.recalculate(voice);
|
|
129
131
|
return;
|
|
@@ -158,7 +160,10 @@ export function computeModulators(voice, controllerTable, sourceUsesCC = -1, sou
|
|
|
158
160
|
modulators.forEach(m => {
|
|
159
161
|
if (m.modulatorDestination === destination)
|
|
160
162
|
{
|
|
161
|
-
|
|
163
|
+
const limits = generatorLimits[mod.modulatorDestination];
|
|
164
|
+
const current = modulatedGenerators[mod.modulatorDestination];
|
|
165
|
+
const newValue = current + computeWorkletModulator(controllerTable, m, voice);
|
|
166
|
+
modulatedGenerators[mod.modulatorDestination] = Math.max(limits.min, Math.min(newValue, limits.max));
|
|
162
167
|
}
|
|
163
168
|
});
|
|
164
169
|
computedDestinations.add(destination);
|
|
@@ -183,16 +188,16 @@ const transforms = [];
|
|
|
183
188
|
for(let curve = 0; curve < 4; curve++)
|
|
184
189
|
{
|
|
185
190
|
transforms[curve] =
|
|
186
|
-
[
|
|
187
191
|
[
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
[
|
|
193
|
+
new Float32Array(MOD_PRECOMPUTED_LENGTH),
|
|
194
|
+
new Float32Array(MOD_PRECOMPUTED_LENGTH)
|
|
195
|
+
],
|
|
196
|
+
[
|
|
197
|
+
new Float32Array(MOD_PRECOMPUTED_LENGTH),
|
|
198
|
+
new Float32Array(MOD_PRECOMPUTED_LENGTH)
|
|
199
|
+
]
|
|
200
|
+
];
|
|
196
201
|
for (let i = 0; i < MOD_PRECOMPUTED_LENGTH; i++) {
|
|
197
202
|
|
|
198
203
|
// polarity 0 dir 0
|