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
}
Wav file header informations:
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.
updates:
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