Hello everybody this is my first post, I thank everyone in advance for any help. I am trying to calculate the SNR and THD of an MP3 player that is playing a 1KHz tone. I am using a digitizer card (A to D) to capture 70000 samples at 700,000 Hertz. I then use the FFTW C library to find the DFT. To calculate the THD I am using the following formula: THD = SQRT(FFT[200]^2 + FFT[300]^2 + FFT[400]^2 + FFT[500]^2)/FFT[100] My bin spacing is 10 hertz (samplerate divided by samplenumber), so index 100 in the array corresponds to the 1000hertz signal and so on. I then take the 20*Log10(THD) to get the value in dB. For calculating the SNR I am finding the Root Sum Square of all the noise bins by doing: for(i=1; i<=2000; i++) { if(i!=100 && (i mod 100) != 0) //Find squared sum of all non harmonics Noise = Noise + FFT[i]^2; y++; } Noise = SQRT(Noise); Noise = Noise/y //Should I be dividing to average? SNR = FFT[100]/Noise; SNR = 20*log10(SNR); This is the psuedo code of what I'm doing, does this seem right? Are these the correct methods to find THD and SNR? For the SNR calculation should I divide the summation by the total number of noise bins (variable y) added together in the for loop?

# Trying to find SNR and THD for MP3 player

Started by ●August 17, 2007