Filter, window function and audio signal: how to link them to each other? I have a question about the implementation of digital filters in CoreAudio. I'm in big trouble because it is a few weeks I'm trying to understand how to implement them. The basic idea is this: while I talk to the iPhone's microphone, my voice is filtered by a low-pass filter or high-pass or bandpass.

Reading the book "Digital Signal Processing" and following the algorithms mentioned in the book "Digital Sound &amp; Music" I came to write the following code (high pass filter):

float cutoff = 5000;
float rate = 44100;
int N = 1024;
float f_c = cutoff/rate;
float ω_c = 2*M_PI*f_c;
int middle = N/2;
int i = -N/2;
float fltr[N];



do {

    if (i == 0)  {
        fltr[middle] = 1 - 2*f_c;
    }
    else {
        fltr[i+middle] = -sin(ω_c*i)/(M_PI*i);
    }
    i++;

} while(i != N/2);


After writing the filter, in the book, you are instructed to run a windowing function. Here I have the problem: I do not understand what to do. Reading on Apple's official documentation, I find the function of Blackman.

int N = 1024;

float dataOut[1024];

for (int n=0; n &lt; 1024; ++n)
{
    dataOut[n] = 0.42 - (0.5 * cos(  2 * M_PI * n / N ) ) + (0.08 * cos( 4 * M_PI * n / N) );
}


But once inserted, what should I do? How can I connect the filter carrier, the Blackman function and the audio signal? I just can not understand it.

Thank you for your attention.

UPDATE 1

I answer to users bristow robert-johnson and Matt L. (I write here because the comment was too long to be invited)

Hi, thank you for answering. There is no filtering at this time because I do not understand how to connect the filter (?) With Blackman window.

What I understand from the chapters devoted to the book “Digital Signal Processing” filters: Create a filter, a sort of kernel filter that is a kind of "mask" to be applied to the signal itself. In this state the filter is said "Impulse Response" or also is said IIR. Now I apply the mask to signal by a function convolution becoming a FIR filter. What I have written is this correct?

As for calculating coefficients, as I understand it, they should be the coefficients Nyquist angular frequency. Is right? If yes, should be variables of "f_c" and "ω_c" (this is written in the commentary of the algorithms in the book).
Your sample code looks like it is trying to create a windowed Sinc FIR filter.  A Sinc function (the transform of a "brick-wall" rectangle filter) has infinite support, thus it must be windowed to create a finite length FIR filter kernel.  There is pseudo-code to generate such a filter, using a Hamming window, on my DSP web page.

You can apply such a FIR filter to audio by convolution with your audio samples (either directly convolution, or using FFT/IFFT overlap-add/save fast convolution on blocks of data).

If you are using iOS frameworks such as Core Audio, note that you can also use the vDSP_biquadm API in the iOS Accelerate framework for IIR filtering.