=== Pulses === [[http://en.wikipedia.org/wiki/Pulse_wave]] A pulse wave form can simple be constructed by adding two saw waves; the phase difference will control the pulse width. double pw = pulseWidth / 2. + 1.; double y1 = ((int)(f * i) % n) / n1; double y2 = ((int)(f * i + pw) % n) / n1; double y = (y1 - y2) * (1 + pulseWidth / n1); === Comb Filters === [[http://en.wikipedia.org/wiki/Comb_filter]] The frequency response of a discrete-time system expressed in the Z domain is obtained by making the substitution z=exp(j*omega) double omega = 2 * pi * f/n; double y = sqrt((1. + pow(alpha, 2.)) + 2 * alpha * cos(omega * K)) / 2;