Solving FFT Issues in Real World - Hi, I'm Using YouTube Vid

  • Thread starter Thread starter btb4198
  • Start date Start date
  • Tags Tags
    Fft Real world
Click For Summary

Discussion Overview

The discussion revolves around issues encountered while implementing a Fast Fourier Transform (FFT) for analyzing sound waves captured from a microphone. Participants explore potential errors in the implementation and the impact of noise on the results.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant reports that their FFT outputs a frequency of 3951.066 Hz when analyzing sound waves, but they observe unexpected peaks at other frequencies such as 41951, 42112, 20062, and 24035 Hz.
  • Another participant suggests that there may be an error in the program implementation, implying that the results may not be reliable.
  • A request is made for the original poster to share their code to facilitate troubleshooting and provide meaningful assistance.
  • The provided code for the FFT implementation is shared, which includes functions for performing the FFT and computing complex numbers.
  • One participant expresses frustration with reading through the code and suggests using established libraries for FFT instead of debugging the implementation, while also emphasizing the learning opportunity in debugging.
  • The original poster defends their implementation, stating they believe it is functioning correctly despite the discrepancies in the output.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the correctness of the FFT implementation. There are competing views regarding the reliability of the results and the necessity of debugging the code versus using existing libraries.

Contextual Notes

There are unresolved questions regarding the impact of noise from computer speakers on the FFT results, as well as potential assumptions about the input signal quality and sampling parameters.

btb4198
Messages
570
Reaction score
10
Hi
so I have a working FFT. I tested it but inputting sin waves into it.
will not i am inputting sound waves from a Mic and it is not looking to do...
example:
I am using to youtube vid

it outputs B7 (Musical note) b′′′′ Four-lined 3951.066 Frequency
and I run my program this is what I am getting 3951.066

I am getting more action around 41951, 42112, 20062, and 24035

then
3951.066

so is there anything I am add to my FFT that would help ?

oh I am sampling at 44100 Hz
and my N = 88200

I also tried this one
http://www.youtube.com/watch?v=tgMQOAWeVs0&list=PLE558EB4A35F28F6A

and I got a higher magnitude from 424.5 and 435.5
then
from 528
do you think there too much noise coming from the computer speakers ?
 
Last edited by a moderator:
Engineering news on Phys.org
As I wrote in your other thread, you most probably made an error in your program.
 
If you want meaningful help please consider posting your code.
 
public polar1[] FFT(polar1[] x)
{
int N2 = x.Length;
polar1[] X = new polar1[N2];
if (N2 == 1)
{
return x;
}
polar1[] odd = new polar1[N2 / 2];
polar1[] even = new polar1[N2 / 2];
polar1[] Y_Odd = new polar1[N2 / 2];
polar1[] Y_Even = new polar1[N2 / 2]; for (int t = 0; t < N2 / 2; t++)
{
even[t].img = x[t * 2].img;
even[t].real = x[t * 2].real;
odd[t].img = x[(t * 2) + 1].img;
odd[t].real = x[(t * 2) + 1].real;
}
Y_Even = FFT(even);
Y_Odd = FFT(odd);
polar1 temp4;

for (int k = 0; k < (N2 / 2); k++)
{
temp4 = Complex1(k, N2);
X[k].real = Y_Even[k].real + (Y_Odd[k].real * temp4.real);
X[k + (N2 / 2)].real = Y_Even[k].real - (Y_Odd[k].real * temp4.real);
X[k].img = Y_Even[k].img + (Y_Odd[k].real * temp4.img);
X[k + (N2 / 2)].img = Y_Even[k].img - (Y_Odd[k].real * temp4.img);
}

return X;
} public polar1 Complex1(int K, int N3)
{
polar1 temp;
double temp1;
temp1 = (2D * Math.PI *K) / N3;
temp.real = Math.Cos(temp1);
temp.img = Math.Sin(temp1);
return temp;

} public struct polar1
{
public double real;
public double img;

};
 
DrClaude

have you had time to look at the code ?
what do you think?
that is the same code i use in my other thread
 
I'm sorry, but I don't have the patience to read through an implementation of a FT. If you just need the result, then use one of the many wonderful implementations available (GSL, FFTW, etc.). If you are doing it to learn about numerical methods, then roll up your sleves and debug the code as if there was no tomorrow. You will probably not learn as much if someone else just points out the error.
 
that is cool.. but I do think it is working
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 29 ·
Replies
29
Views
7K
Replies
38
Views
5K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 24 ·
Replies
24
Views
5K
Replies
3
Views
3K
  • · Replies 11 ·
Replies
11
Views
9K
  • · Replies 8 ·
Replies
8
Views
3K