BogaudioModules

BogaudioModules for VCV Rack
Log | Files | Refs | README | LICENSE

commit 1958033b1b680ce8b71f8126c4f964aad06467f0
parent 2ed77bca75efcbfe4ab4627f541df532d1fc1962
Author: Matt Demanett <matt@demanett.net>
Date:   Sun, 12 Jun 2022 17:47:28 -0400

VCF: fix handling of the FM input (e.g. a zero value should have no effect), and improve documentation for VCF cutoff CVs. #205

Diffstat:
MREADME-prerelease.md | 6+++---
Msrc/VCF.cpp | 11+++++++----
2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/README-prerelease.md b/README-prerelease.md @@ -259,10 +259,10 @@ A general-purpose filter with a selectable lowpass, highpass, bandpass or bandre - Smoothly modulatable bandwidth in bandpass and bandreject modes. - Very accurate V/OCT tracking. -The large knob sets the filter's base cutoff frequency (for lowpass and highpass modes) or center frequency (for bandpass and bandreject). There are three CV inputs that affect the cutoff; each input is converted to a HZ value and added to the base value set by the knob: +The large knob sets the filter's base cutoff frequency (for lowpass and highpass modes) or center frequency (for bandpass and bandreject). There are three CV inputs that affect the cutoff, in this order: - CV: a general, linear input expecting bipolar +/-5V signals. The input is attenuverted by the CV knob. - - V/OCT: an input here is interpreted as a pitch CV. Use this and set the main knob to 0HZ for accurate key tracking. - - FM: an exponential FM input; the input here is attenuated by the FM knob, then added to the V/OCT input (which normals to 0V) before being converted to HZ. + - V/OCT: an input here is interpreted as a pitch CV; if connected, the input voltage is interpreted as a frequency and added to the cutoff. Use this and set the main knob to 0HZ for accurate key tracking. + - FM: an exponential FM input; the input here is attenuated by the FM knob. It is implemented by converting the cutoff to a V/Octave pitch CV, adding the attenuated FM signal to that, and converting back to frequency. The RES/BW knob has two functions, depending on mode: - In lowpass and highpass modes, it controls the resonance of the filter at the cutoff frequency. The filter does not self-resonate. diff --git a/src/VCF.cpp b/src/VCF.cpp @@ -157,13 +157,16 @@ void VCF::modulateChannel(int c) { } f *= f; f *= maxFrequency; - if (inputs[PITCH_INPUT].isConnected() || inputs[FM_INPUT].isConnected()) { - float fm = inputs[FM_INPUT].getPolyVoltage(c); - fm *= clamp(params[FM_PARAM].getValue(), 0.0f, 1.0f); + if (inputs[PITCH_INPUT].isConnected()) { float pitch = clamp(inputs[PITCH_INPUT].getPolyVoltage(c), -5.0f, 5.0f); - pitch += fm; f += cvToFrequency(pitch); } + if (inputs[FM_INPUT].isConnected()) { + float fm = inputs[FM_INPUT].getPolyVoltage(c); + fm *= clamp(params[FM_PARAM].getValue(), 0.0f, 1.0f); + float pitchCV = frequencyToCV(std::max(minFrequency, f)); + f = cvToFrequency(pitchCV + fm); + } f = clamp(f, minFrequency, maxFrequency); e.setParams(