From 40774471029000003829dd67c18dfa4541a7997a Mon Sep 17 00:00:00 2001 From: Gordon JC Pearce Date: Thu, 8 Jan 2026 16:17:42 +0000 Subject: [PATCH] levels balanced a bit better --- plugin/module.cpp | 13 ++++++------- plugin/voice.cpp | 6 +++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/plugin/module.cpp b/plugin/module.cpp index 17d7c88..358a576 100644 --- a/plugin/module.cpp +++ b/plugin/module.cpp @@ -85,7 +85,7 @@ void Module::runLFO() { pw = (lfoState & 0x02) ? lfoPhase + 0x2000 : 0x2000 - lfoPhase; // PW LFO is unipolar pw = (patchRam.switch2 & 0x01) ? 0x3fff : pw; // either LFO or "all on" - pw = 0x3fff - ((pw * patchRam.pwmLfo) >> 7); // scaled by PWM pot + pw = 0x3fff - ((pw * (int)(patchRam.pwmLfo*1.45)) >> 7); // FIXME tidy up this bit } void Module::run(Voice* voices, uint32_t blockSize) { @@ -104,12 +104,12 @@ void Module::run(Voice* voices, uint32_t blockSize) { // originally I had 0.28, 0.36, 0.4 // measurement suggests that saw and square are around 100mV each with sub 160mV - square = (patchRam.switch1 & 0x08) ? 0.3 : 0; - saw = (patchRam.switch1 & 0x10) ? .3 : 0; - sub = (patchRam.sub / 127.0f) * 0.48; + square = (patchRam.switch1 & 0x08) ? 1 : 0; + saw = (patchRam.switch1 & 0x10) ? 1 : 0; + sub = (patchRam.sub / 127.0f) * 1.4; res = patchRam.vcfReso / 127.0; - noise = (patchRam.noise / 127.0) * 0.4; + noise = (patchRam.noise / 127.0); // FIXME the exp in these is expensive, don't call it all the time chorus->setChorus(patchRam.switch1 & 0x60); @@ -143,7 +143,6 @@ void Module::run(Voice* voices, uint32_t blockSize) { pitchBase += lfoToVco; pitchBase += /* pitch bend FIXME */ 0; - // int16_t vcf = (patchRam.vcfEnv << 7) * ((patchRam.switch2 & 0x02) ? -1 : 1); vcfBase = (patchRam.vcfFreq << 7) + /* vcf bend FIXME */ 0; vcfBase += lfoToVcf; if (vcfBase > 0x3fff) vcfBase = 0x3fff; @@ -183,7 +182,7 @@ void Module::run(Voice* voices, uint32_t blockSize) { v->omega = px / (sampleRate * 8.0f); // FIXME recalculate table using proper scaler // per voice we need to calculate the key follow amount and envelope amount - v->vcfCut = vcfBase + (((v->env * patchRam.vcfEnv)>>7) * ((patchRam.switch1 & 0x02) ? -1 : 1)); + v->vcfCut = vcfBase + (((v->env * patchRam.vcfEnv)>>7) * ((patchRam.switch2 & 0x02) ? -1 : 1)); v->vcfCut += (int)((v->note - 36) * (patchRam.vcfKey << 1) * 0.375); diff --git a/plugin/voice.cpp b/plugin/voice.cpp index 92ecf8f..6f6f80b 100644 --- a/plugin/voice.cpp +++ b/plugin/voice.cpp @@ -72,7 +72,7 @@ void Voice::run(Module* m, float* buffer, uint32_t framePos, uint32_t samples) { float r = 5 * m->res; - float amp = vcaEnv / 4096.0f; + float amp = vcaEnv / 32768.0f; for (uint32_t i = 0; i < samples; i++) { out = delay; @@ -117,8 +117,8 @@ void Voice::run(Module* m, float* buffer, uint32_t framePos, uint32_t samples) { fb = y3; // hard clip fb = ((out * 0.5) - fb) * r; - if (fb > 2) fb = 2; - if (fb < -2) fb = -2; + if (fb > 6) fb = 6; + if (fb < -6) fb = -6; y0 = ((out + fb - y0) * vcfRC) + y0; y1 = ((y0 - y1) * vcfRC) + y1;