Integrating a sine wave function is indeed easy, but things gets a lot complicated when it comes to other waveforms. Here follow the equations I'm using to display the waveforms: Sawtooth wave: f(x) = bmod(f_c x, ); Square wave: f(x) = operatorname{sign}(cos(f_c x)); Triangle wave: f(x) = frac{1}{f_c}|bmod(x, f_c) frac{1}{2}f_c|