From 5e299471609bccf99fa28a8d6073b295ee16a7c7 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 11 Oct 2021 01:19:45 -0400 Subject: [PATCH] Make voltage-to-frequency conversion in VCO and LFO a bit more clear. --- src/LFO.cpp | 2 +- src/VCO.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LFO.cpp b/src/LFO.cpp index 5cd410c..fe49273 100644 --- a/src/LFO.cpp +++ b/src/LFO.cpp @@ -15,7 +15,7 @@ struct LowFrequencyOscillator { void setPitch(T pitch) { pitch = simd::fmin(pitch, 10.f); - freq = dsp::approxExp2_taylor5(pitch + 30) / 1073741824; + freq = dsp::approxExp2_taylor5(pitch + 30.f) / std::pow(2.f, 30.f); } void setPulseWidth(T pw) { const T pwMin = 0.01f; diff --git a/src/VCO.cpp b/src/VCO.cpp index 1ae6b4a..b1ddc9f 100644 --- a/src/VCO.cpp +++ b/src/VCO.cpp @@ -52,7 +52,7 @@ struct VoltageControlledOscillator { T sinValue = 0.f; void setPitch(T pitch) { - freq = dsp::FREQ_C4 * dsp::approxExp2_taylor5(pitch + 30) / 1073741824; + freq = dsp::FREQ_C4 * dsp::approxExp2_taylor5(pitch + 30.f) / std::pow(2.f, 30.f); } void setPulseWidth(T pulseWidth) {