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)?

  • $\begingroup$ Thanks hotpaw2. I can use this to smooth a square wave as well. $\endgroup$ – cixelsyd Mar 21 '16 at 8:34
  • 1
    $\begingroup$ low-pass filter. $\endgroup$ – 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


check the filtered sawtooth there.

You can also a smoother that says "if difference between last signal and this signal was larger than 0.02, signal - 0.02... and create a secondary smothed signal... there are fairly simple smoothing algo's based on that it's pretty straightforward.

There is also an entire page on the topic.


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

  • $\begingroup$ That's will result in a sine wave, he wants to have LFO shapes just without 1-0 transitions over a singe sample. $\endgroup$ – com.prehensible Mar 21 '16 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.