Formulae for generating sinusoidal waveforms y = f(x) // any function with two varibles y = sin(x) // generic sine function y = sin(2¹Ft) // sine as a function of time y = Asin(2¹Ft) // variable amplitude sine y = Asin(2¹Ft+¿) // include possible phase offset (e.g., ¹/2 yields a cosine wave) y = Asin(2¹Fn/R+¿) // digital (discrete) equivalent where x = any arbitrary domain y = output value A = amplitude F = frequency t = time ¿ = phase offset n = sample number R = sampling rate ----- Some useful formulae for fixed-wavetable synthesis given that y = output value A = amplitude factor table[] = an array of values making a wavetable x = precise location in table for any given sample L = length of table R = sampling rate I = increment (size of step to take forward through the table for each sample) then to determine the correct increment, I= FL/R to get the precise table location for sample n, x = ((previous x)+I)%L and the output is then y = A*table[x] for a truncating, non-interpolating oscillator, y = A*table[(int)x] or for a linear-interpolating oscillator, y = A*((table[(int)x]*((int)x+1-x))+(table[(int)x+1]*(x-(int)x))) or a more complex interpolation scheme such as polynomial interpolation