C# C# FFT Troubleshooting: Sampling at 44100 Hz, 16384 Samples

  • Thread starter Thread starter btb4198
  • Start date Start date
  • Tags Tags
    Fft
Click For Summary
The discussion revolves around troubleshooting FFT issues in a C# program that samples audio at 44100 Hz using 16384 samples. The user is experiencing discrepancies between their FFT output and expected values, particularly when compared to MATLAB results. Key suggestions include ensuring proper windowing of sample data, verifying that the audio data is correctly interpreted as signed 16-bit integers, and testing with known sine wave inputs to validate the FFT implementation. Additionally, there are concerns about whether the microphone is capturing stereo or mono audio, which could affect the input samples. The user is encouraged to isolate and test different components of their code to identify the source of the inaccuracies.
  • #31
btb4198 said:
however, I am still getting half the Frequencies...
I can just do * by 2 at the very end and get the right Frequencies but I really want to know why it is doing this
Are you looking at stereo information?
 
Technology news on Phys.org
  • #32
I do not know... how can I find out ?
I am using the default microphone on my computer..
what is the different between stereo and mono for a microphone ?
mono is one.. so one mic
so it stereo more that one mic?

how would did affect the input samples ?
 
  • #33
btb4198 said:
I do not know... how can I find out ?
I am using the default microphone on my computer..
what is the different between stereo and mono for a microphone ?
mono is one.. so one mic
so it stereo more that one mic?

how would did affect the input samples ?
I don't know how you are grabbing the information. At some point you must have specified 44100Hz, 16 bits per sample. When you did that, the same data structure should have included whether the signal would be stereo or mono.
 
  • #34
AlephZero
this code:
Code:
    int tempint = 0;
            for (int index = 0; index < 32768; index += 2)
            {

                buffer1[tempint] = ((buffer[index + 1] << 8) |
                                        buffer[index + 0]);
                if (buffer1[tempint] > 32767)
                    buffer1[tempint] = buffer1[tempint] - 65536;
                tempint++;

            }
I am really reading in 44100 bytes at a time from the Microphone and not 32768
I am sending 16384 samples to the FFT because I am 2^N sample for the FFT

anynow so should the code really be
Code:
 int tempint = 0;
            for (int index = 0; index < 32768; index += 2)
            {

                buffer1[tempint] = ((buffer[index + 1] << 8) |
                                        buffer[index + 0]);
                if (buffer1[tempint] > 44100)
                    buffer1[tempint] = buffer1[tempint] - 88200;
                tempint++;
because the Microphone is sending 44100 bytes
I am not sure about this
so i maybe thinking of this all wrong
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 0 ·
Replies
0
Views
1K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K