more engines

This commit is contained in:
2025-10-12 11:04:54 +02:00
parent 94a36b1a29
commit 7b99dc0f0d
4371 changed files with 2187 additions and 92 deletions

View File

@ -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];
}