Hello! I am making a basic chorus effect by duplicating the signal and modulating the delay time of the duplicate signal with an LFO. Every calculation I’ve seen to create a basic LFO goes like this:
lfoRate = 2 * pi / (lfoFrequency / sampleRate);
lfo += lfoRate;
if (lfo >= 2 * pi) lfo -= 2 * pi;
I’m assuming I would then take sin(lfo) and use that value to change the delay time in some way. However, in using these calculations, if I make lfoFrequency 5Hz, and the sampleRate 44100, the lfoRate becomes extremely large, and instead of incrementing the LFO by tiny values between 0 and (2 * pi) which it should be doing, the LFO is being incremented by these massive amounts. It’s obvious to me why the values I’m getting are huge when I do the calculation by hand, and it seems like the calculation itself is wrong, considering an LFO is always relatively small (0.0Hz - 20.0Hz), while sample rate is always relatively large (typically 44100), meaning I’ll almost always be incrementing the LFO by way too much every time.
Since I’m very new to DSP, JUCE, and C++, I’m going to assume I’m being dumb here, so feel free to roast me or ask for clarification.