Frequency modulation audio synthesis: clicks/pops when changing modulator frequency dynamically
If you change modulator frequency, do note that it changes a sudden jump in phase, as it changes the result of the equation where the phase is calculated from frequency. This is largely unnecessary, as having a certain frequency means the phase change is constant per sample. Thus, if you change the frequency to be a phase increment per sample, then changing the frequency does not cause a sudden phase jump but just changes the phase increment from that point on. That's how FM synth chips work.