I'm writing a program in which you can synthesize waves by adding to a sound's Fourier transform, and then inverse the transform to get the modified sound. In order to do this, I need to know what to add to the DFT to synthesize a pure wave. I've tried to learn about Fourier synthesis from many sources, but they all talk about the Fourier series instead of the Fourier transform, and they all say that for a pure wave all you need is a value in the coefficient of that wave's frequency, and 0 everywhere else. But the Fourier transform being a continuous function. And you can see here what the Fourier transform of a pure 12KHz sine wave looks like (on a logarithmic scale). As you can see, it's not just an instantaneous peak and 0 everywhere else.
So I tried to do the math myself. To put it formally, say we have a sampled signal $S_t=A cos(\frac{-2 \pi k}{N} t + \phi)$, where , $N$ is the number of samples in our signal, $0 \le t < N$, $A$ is an amplitude $0 \le k < \frac{N}{2}$ determines the wave's frequency, and $\phi$ is the phase of the wave. The DFT of this signal would be a sequence $F_0,...,F_{N-1}$ where:
$$ F_r = \sum_{t=0}^{N-1}{{S_t}e^{\frac{-2 \pi i t r}{N}}} $$
My hope was that since our signal is a pure wave, there will be a direct formula for calculating $F_r$ that can be computed much quicker than by directly doing the math above, and that that formula will be the shape of that spike in the image I linked, because that's what I'm really interested in. For the sake of simplicity, I assumed that $\phi=0$, since once I figure out how to solve that case I'll probably be able to generalize it. I won't bore you with all the math because it's not important and you probably already know the answer. What I got in the end is that $F_k = F_{N-k} = \frac{NA}{2}$, and for all other $0 \le r < N, F_r = 0$.
Shocker. So in the end I found that it does equal to 0 everywhere except the frequency of the wave. But then I don't understand where that spike shape from the graph I linked is coming from. I'm still after it though, because just adding to the one sample which corresponds to the frequency I'm interested in doesn't work for me (I've tried).
So I guess my question is: how come plotting the Fourier transform of a pure wave doesn't actually produce zero in all samples except the one corresponding to that wave's frequency, and what's the formula for that spike that you do see.