Aplying FFT to Wav file data

Technology: C++, CodeBlocks IDE.

I've just read sample wav file (source - http://www.wavsource.com/snds_2015-12-13_4694675918641206/movies/2001/daisy.wav ) with an txt output (https://paste.ee/p/pXGvm), which i get from using this code:

    WavAnalysis wav_analyse;
static const uint16_t BUFFER_SIZE = 1024;
uint8_t* buffer = new uint8_t[BUFFER_SIZE];
std::cout << "Buffering data... " << std::endl;
fseek(wavFile, 44, SEEK_SET); // skip header data
while ((bytesRead = fread(buffer, sizeof buffer[0], BUFFER_SIZE / (sizeof buffer[0]), wavFile)) > 0)
{
//do sth with buffer data
wav_analyse.FFT(buffer); // currently shows data only
}


• 1 channel PCM,

• 8 bits per sample,

• sampling rate is 11025Hz.

In next step I'm normalising values to the range of [-1;1) with function:

float WavAnalysis::normaliseValuetoFloat(uint8_t value){
float normalisedValue = (float)value;
normalisedValue -= 128;
normalisedValue /= 128;
return normalisedValue;
}


My goal is to create my own library for voice activity detection, now I'm working on FFT module. I need this data to calculate signal energy and its entropy in chosen signal parts.

After reading commented sources, I've learned that average and sufficient length of data for feeding FFT algorythm is 1024 (or any other that is equal to power of two).

Question now: FFT changes signal domain from time (real values) to frequency (which contains complex numbers). Why does available sources populates the FFT algorithm with complex array? Ex.: https://stackoverflow.com/questions/10121574/safe-and-fast-fft

• You should be more specific about your programming environment, after having done your research, with these links: dsp.stackexchange.com/questions/11062/…, dsp.stackexchange.com/questions/19422/… Dec 15 '15 at 20:23
• Also: please clarify what do you mean by "with an txt output".
– MBaz
Dec 15 '15 at 20:41
• @MBaz, the second linked file is a printout of each 8-bit sample value as ascii. Dec 15 '15 at 22:26
• That isn't likely to work. The data is encoded as integers in offset binary.
– MBaz
Dec 15 '15 at 23:58