resonance, crappy noise

This commit is contained in:
Gordon JC Pearce 2025-12-20 23:16:37 +00:00
parent b04304f242
commit b736c6534e
3 changed files with 6 additions and 4 deletions

View File

@ -39,6 +39,9 @@ void Module::run(Voice* voice) {
sub = patchRam.sub / 127.0f; sub = patchRam.sub / 127.0f;
lfoPhase += lfoRateTable[patchRam.lfoRate]; lfoPhase += lfoRateTable[patchRam.lfoRate];
res = patchRam.vcfReso / 127.0 * 5;
noise = patchRam.noise / 127.0;
if (lfoPhase & 0x4000) if (lfoPhase & 0x4000)
lfo = 0x1fff - (lfoPhase & 0x3fff); lfo = 0x1fff - (lfoPhase & 0x3fff);
else else

View File

@ -32,7 +32,7 @@ class Module {
void run(Voice* voice); void run(Voice* voice);
// Voice voices[NUM_VOICES]; // Voice voices[NUM_VOICES];
float vcfCutoff = 0, vcfReso = 0; float res = 0;
// precomputed values for all voices // precomputed values for all voices
float pw; //, saw, square, sub; float pw; //, saw, square, sub;

View File

@ -98,14 +98,13 @@ void Voice::run(Module* m, float* buffer, uint32_t samples) {
delay += m->sub * subosc; delay += m->sub * subosc;
// delay += (1-(m->noisegen/(float)(1<<30))) * m->noise; FIXME figure out what to do about noise // delay += (1-(m->noisegen/(float)(1<<30))) * m->noise; FIXME figure out what to do about noise
//out = 0.5-(rand() & 0xffff) / 65536.0; out += m->noise * (0.8-1.6 *(rand() & 0xffff) / 65536.0);
out *= 0.5; out *= 0.5;
float res = 3;
for (uint8_t ovs = 0; ovs < 4; ovs++) { for (uint8_t ovs = 0; ovs < 4; ovs++) {
fb = b4; fb = b4;
// hard clip // hard clip
fb = ((out*0.5) - fb) * res; fb = ((out*0.5) - fb) * m->res;
if (fb > 4) fb = 4; if (fb > 4) fb = 4;
if (fb < -4) fb = -4; if (fb < -4) fb = -4;
// fb = 1.5 * fb - 0.5 * fb * fb * fb; // fb = 1.5 * fb - 0.5 * fb * fb * fb;