2 of 3 videos blocked....
I hooked my Arduino Uno to the computer, hooked an audio input (my computer's audio out) to the arduino,and did a Sine wave sweep test.
your FFT shows all harmonics I think!
FFT is beyond my mathematical & programming abilities... I've never seen a perfect FFT spectrum. It's my understanding that it theoretically takes an infinite number of samples and in infinitely-long unchanging signal to get a perfect result. In the real world, a window of a certain number of samples it taken (representing a small amount of time). There's a discontinuity where the window starts & stops, so there are various window shaping and window overlapping algorithms to compensate. These all have various compromises. The bit depth and sample rate may also affect FFT accuracy (or sample rate may just be a different way of thinking about window size).
Haven't try Open Music software, but looking at video #2, I'm sure you have a problem in this part:QuoteI hooked my Arduino Uno to the computer, hooked an audio input (my computer's audio out) to the arduino,and did a Sine wave sweep test.How exactly you connect audio input? Video shows great amount of DC and all harmonics above 2-nd, which is remarkable indicator that sampling heavy distorted. Show your connection diagram.
In order to get a "perfect" FFT spectrum:1. you must use an anti-aliasing filter at the ADC input2. you have to use a "FFT window" function applied over your input data, there are at least of dozen of various ones (see wiki)3. you have to average many FFT spectra, the accuracy with S spectra is sqrt(S) with FFT4. you have to cut off the spectral lines from N/2..N (N - number of input samples)5. you have to use floating point math with FFTHappy ffting
Keep in mind that with 10-bit sampling, the highest frequency that can be "minimally" sampled by the Arduino (according to the Nyquist Theorem) is about 4.5 kHz. If any frequencies higher than 4.5 kHz are present in the input to the FFT, the result will show strong aliasing, which show up as signals of frequency (f - 4.5 kHz). This aliasing effect is very clearly shown in the first video that you posted. Much of the distortion or clipping in the signal shows up as aliasing.DC signals, necessarily present initially because the ADC samples only from 0 to 5 V (or 3.3V), show up as strong peaks in the lowest bins, unless you subtract off the DC average before transforming.Also, you don't say what representation of the spectrum you are displaying. If it is a log scale power spectrum, the large peaks in the spectrum are compressed downwards and there will always be a noise level visible.
Computer Audio Out Ground > Arduino GroundComputer Audio Out Left > Arduino Analog 0
@Pete: On the Atmega-based Arduino, the number of bits per sample does determine the upper sampling frequency. If you choose 8 bit sampling, then you can sample at about 40 kHz, with a 20 kHz upper frequency (Nyquist limit).@OP: If you want to see what the FFT is capable of, you have to make certain of your input signal. A mathematically pure, single tone (unachievable in practice) will give a single sharp peak. You can approximate this by feeding the FFT input with a precalculated sine wave, pretending that it came from the ADC and see what happens. As it is, your actual audio signal probably is quite noisy and distorted.
QuoteComputer Audio Out Ground > Arduino GroundComputer Audio Out Left > Arduino Analog 0Don't. You are not only getting wrong results, but potentially could destroy your arduino. Here is right way to feed AC to analog input:http://interface.khm.de/index.php/lab/experiments/arduino-realtime-audio-processing/