0
votes

I'm trying to do FFT on the iPhone, and I realised that I had not overlapped my input prior to windowing. I was wondering if anyone could give me some insight on to how to properly overlap my input buffer.

I am wanting to overlap bufferSamples by a factor of 4, and I understand that it is to be done using memove functions, but I can't figure out how to get it to work in regard to overlapping.

enum
{
    frameSize   = 2048,
    overlap     = 4,
    range       = 8192,
    step        = frameSize/overlap,
};

static COMPLEX_SPLIT    A;

    // For each sample in buffer...
    for (int j = 0; j < audioBufferList.mNumberBuffers; j++)
    {

        // Declaring samples from audio buffer list
        SInt16 *bufferSamples = (SInt16*)audioBufferList.mBuffers[j].mData;

        // Overlapping here?

        ////////////////////////
        //// vDSP FUNCTIONS ////
        ////////////////////////

        // Creating Hann window function
        for (int i = 0; i < frameSize; i++)
        {
            double window = 0.5 * (1.0 - cos((2.0 * M_PI * i) / (frameSize -  1)));

            // Applying window to each sample
            A.realp[i] = window * bufferSamples[i];
            A.imagp[i] = 0;
        }

        // Further DSP...
1

1 Answers

0
votes

To get an overlap factor of 4, you need to save the last 75% of the data that, before windowing, was input to the previous FFT. Then use that saved data as the first 75% of the current FFT, with only the last 25% from current or not yet used data. memmove can be used to copy data to and from the temporary save data buffers. Repeat as necessary to use up the data available.