more engines
This commit is contained in:
@ -467,6 +467,20 @@ export class Benjolin implements SynthEngine<BenjolinParams> {
|
||||
osc2LastOutput = osc2Output;
|
||||
}
|
||||
|
||||
// Normalize the output to use full dynamic range
|
||||
let peak = 0;
|
||||
for (let i = 0; i < numSamples; i++) {
|
||||
peak = Math.max(peak, Math.abs(left[i]), Math.abs(right[i]));
|
||||
}
|
||||
|
||||
if (peak > 0.001) {
|
||||
const normalizationGain = 0.95 / peak;
|
||||
for (let i = 0; i < numSamples; i++) {
|
||||
left[i] *= normalizationGain;
|
||||
right[i] *= normalizationGain;
|
||||
}
|
||||
}
|
||||
|
||||
return [left, right];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user