# Smoothing an LFO Sawtooth Wave

I'm trying to smooth a Sawtooth wave coming out of my LFO. Effectively the transition from 1.0 to -1.0 in a 1 sample step is causing clicks and pops if I modulate my audio signals amplitude with this LFO output.

What is the best way to smooth this basic waveform to eliminate the clicks without adversely affecting performance (significantly)?

• Thanks hotpaw2. I can use this to smooth a square wave as well. – cixelsyd Mar 21 '16 at 8:34
• low-pass filter. – robert bristow-johnson Mar 21 '16 at 17:58

Reason that it's clicking is that you are jumping from 1 to 0 in the time that the audio signal reads the last of the 1 control signal and then the 0 control signal.

You have to slow fast signal transitions over multiple samples, for example 1 to 0 should take 5ms or 10ms which is dozens or 100ds of samples.

To do that, you can use a lowpass filter at about 300Hz more or less, which can actually be very cheap for a single monophone LFO its less that 1% cpu useage, or you can use a signal smoothing algorithm, for exampel a linear interpolation function or a SmoothStep which is awesome general knowledge for audio programmers. http://paulbourke.net/miscellaneous/interpolation/

BTW what is the platform? i can't give you code exampels if i dont know what code you use.

the cool thing about smoothstep is how easy it is, its very good knowldedge in synths: https://en.wikipedia.org/wiki/Smoothstep

Multiply by $\pi$ and feed to a sinewave lookup table.