This is just a note to self, for remembering the little details about NumPy's FFT implementation.

To get the FFT bins to line up perfectly, without any "skirts" or spectral leakage,
you need to make a perfect cycle, where the next sample after
this chunk lines up with the first. (In other words, the first and last samples should not be the same.)

To get a sinusoid of amplitude 1 to produce 2 complex exponentials of amplitude 0.5, you need to divide the fft() results by the number of samples.

The fft() output is from 0 Hz to Nyquist frequency to sampling rate. To plot the spectrum from negative Nyquist frequency to positive Nyquist frequency, with 0 in the center, use fftshift() on both the freqs and ampl variables. You can also just use fftfreq() to generate a horizontal axis for plotting, but the plot will have extraneous lines on it.

If the result of an IFFT has some complex residue, use real() to get rid of it, not abs().

This comment has been minimized.

Is there an equation to get the frequency in hz from the sample output? I thought is was (fs * k/N) but in implementing that I don't get 8 with the numbers here. So that would be (64*56)/64 and that just gives 56...
So to recap:
N = sample width
fs = sample frequency
k = index that we get our spike on.
I am definitely confused here so sorry if I am unclear. Let me know if you need more info concerning the question and thank you very much for your work.

Is there an equation to get the frequency in hz from the sample output? I thought is was (fs * k/N) but in implementing that I don't get 8 with the numbers here. So that would be (64*56)/64 and that just gives 56...
So to recap:
N = sample width
fs = sample frequency
k = index that we get our spike on.
I am definitely confused here so sorry if I am unclear. Let me know if you need more info concerning the question and thank you very much for your work.