better mixing

This commit is contained in:
Gordon JC Pearce 2025-01-07 12:25:10 +00:00
parent b913e9bb9c
commit 81904ead80

View File

@ -102,47 +102,43 @@ void AlphaOsc::run(const float **, float **outputs, uint32_t frames, const MidiE
pwg = (float)((osc & 0x7f) >= pw) != 0; pwg = (float)((osc & 0x7f) >= pw) != 0;
// calculate the oscillator output // calculate the oscillator output
in = wave = 0;
switch (sqrmode) { switch (sqrmode) {
case 0: case 0:
case 4: case 4:
wave = 0; sqr = 0; // oscillator is off
break; // oscillator is off
case 1:
wave = sqr;
break; break;
case 1: // do nothing, sqr is fine
break;
case 2: case 2:
wave = sqr * oct1; // 25% pulse sqr *= oct1; // 25% pulse
break; break;
case 3: case 3:
wave = sqr * pwg; // pwm sqr *= pwg; // pwm
break; break;
} }
in += (wave * 0.63); // scaled similarly to Juno 106
switch (sawmode) { switch (sawmode) {
case 0: case 0:
wave = 0; saw = 0;
break; // oscillator is off break; // oscillator is off
case 1: case 1:
wave = saw; break; // saw is fine, do nothing
break;
case 2: case 2:
wave = saw * oct1; // pulsed saw *= oct1; // pulsed
break; break;
case 3: case 3:
wave = saw * pwg; // pwm saw *= pwg; // pwm
break; break;
case 4: case 4:
wave = saw * oct3; // oct3 pulse saw *= oct3; // oct3 pulse
break; break;
case 5: case 5:
wave = saw * oct1 * oct3; // both pulse saw *= oct1 * oct3; // both pulse
break; break;
} }
in += (wave * 0.8); // scaled similarly to Juno 106 // mix the signals, probably done with some resistors in the chip
in = (saw * 0.8) + (sqr * 0.63); // scaled similarly to Juno 106
// DC removal highpass filter // DC removal highpass filter
// this is very approximately 6Hz at 44.1kHz and 48kHz // this is very approximately 6Hz at 44.1kHz and 48kHz