How do you sample a sine wave?
Digitizing the sine wave
We can thus use the formula sn = A � sin(2πfn/sr) where n is a positive integer to generate samples for a frequency of f cycles per second. To make the arithmetic easier, imagine sr = 10,000 and f = 100. n should then range over 0 to 100 for one complete cycle to be output.