Help with algorithm for modulating oscillator pitch using LFO
As said by Jason, this might simply be that you are not implementing your oscillator correctly - for example by multiplying the frequency by time instead of integrating it.

Note also - and this is unrelated to your topic but really worth observing - that your formula for frequency modulation implements a behavior very different to that of most synthesizers, and will sound uncanny to a musician.

For example, if lfo_y oscillates between -1 and 1 ; lfo_mod_depth is 0.5 ; and if note_frequency is equal to 220 Hz, osc_frequency will sweep between 110 and 330 - that is to say between -1 octave and +1 fifth around the note. So the pitch modulation will appear to be centered in the hertz scale, but will not be centered in the perceptual musical scale.

The correct behaviour is to have something like:

osc_frequency = note_frequency * 2 ** (tuning / 1200.0 + lfo_y * lfo_mod_depth)


Then:


tuning is expressed in cents, a musically relevant unit (100
cents = 1 semitone).
your pitch modulation is "musically centered",
and lfo_mod_depth is expressed in octaves.


This is called "exponential FM", and this is the norm on synthesizers. On analog synthesizers, this is implemented by summing the LFO signal to the CV that hits the exponential converter of the VCO. On digital synthesizers, this is implemented by applying the modulations on a high-resolution internal representation of pitch which is still on a musical scale - before converting to a frequency or a phase increment.