Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8927389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:12:52+00:00 2026-06-15T08:12:52+00:00

first time asking though i have been visiting for some time. Here’s the problem:

  • 0

first time asking though i have been visiting for some time.

Here’s the problem:

I’m currently trying to isolate the base frequenciy of a signal contained in a WAVE data file with these properties:

  • PCM Audio Format i.e Liner Quantization
  • 8000 Hz Sample Rate
  • 16 Bits Per Sample
  • 16000 Byte Rate

One Channel only there is no interleaving.

Getting the byte value:

System.IO.FileStream WaveFile = System.IO.File.OpenRead(@"c:\tet\fft.wav");
        byte[] data = new byte[WaveFile.Length];
        WaveFile.Read(data,0,Convert.ToInt32(WaveFile.Length));

Converting it to an Array of Doubles:

 for (int i = 0; i < 32768; i++)//this is only for a relatively small chunk of the file 
        {
           InReal[i] =BitConverter.ToDouble(data, (i + 1) * 8 + 44);
        }

and finanly passing it to a Transform Function.

       FFT FftObject = new FFT();
       FftObject.Transform(InReal, InImg, 0, 32768, out outReal, out outImg, false);

Now the first question, as i understand the PCM values of the wav file should be in the boundaries of
-1 and 1, but when converting to Double i get this values:

 2.65855908666825E-235
 2.84104982662944E-285
-1.58613492930337E+235
-1.25617351166869E+264
 1.58370933499389E-242
 6.19284549187335E-245
-2.92969500042228E+254
-5.90042665390976E+226
 3.11954507295188E-273
 3.06831908609091E-217
 NaN
 2.77113146323761E-302
 6.76597919848376E-306
-1.55843653898344E+291

These are the firs few of the array in those limits is the rest of array too.

My conclusion of this is that i have some sort of code malfunction but i can seem to be able to find it.
Any help would be appreciated.

And the second question, because i’m only providing real data to the FFT algorithm in the response vector should i expect only Real part data too??

Thank you very much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:12:53+00:00Added an answer on June 15, 2026 at 8:12 am

    I was finally able to find out what was going wrong it seems that i didn’t accounted for the pulse code modulation of the signal in the data representation, and because i found many unanswered questions here on wave file preparing for Fourier transformation here is the code in a function that prepares the wave file.

    public static Double[] prepare(String wavePath, out int SampleRate)
    
        {
            Double[] data;
            byte[] wave;
            byte[] sR= new byte[4];
            System.IO.FileStream WaveFile = System.IO.File.OpenRead(wavePath);
            wave = new byte[WaveFile.Length];
            data = new Double[(wave.Length - 44) / 4];//shifting the headers out of the PCM data;
            WaveFile.Read(wave,0,Convert.ToInt32(WaveFile.Length));//read the wave file into the wave variable
            /***********Converting and PCM accounting***************/
            for (int i = 0; i < data.Length - i * 4; i++)
            {
                data[i] = (BitConverter.ToInt32(wave, (1 + i) * 4)) / 65536.0;
                //65536.0.0=2^n,       n=bits per sample;
            }
            /**************assigning sample rate**********************/
            for (int i = 24; i < 28; i++)
            {
                sR[i-24]= wave[i];
            }
            SampleRate = BitConverter.ToInt32(sR,0);
            return data;
        }
    

    all you need to do now is to send the sample rate and the returned result to your FFT algorithm.
    The code is not handled so do your own handling as needed.
    I has been tested for phone recordings, of busy, ringing and speech, it functions correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It's my first time asking for help in here, my department (a Government), have
my first time asking something here. I have a text file of names, 1
this is my first time asking a question here. I tried to be well
first time posting here so be gentle :) On my web pages I have
First time asking a question here. Usually I can find my answer without having
this is my first time asking something here, so don't be too harsh on
Well this is not the first time im asking these question here but I
this is my first time asking a question so bear with me. I am
this is my first time asking a question on stackoverflow. I'm working on a
(Long time reader of SO, first time asking a q. I'm quite new to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.