# 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 & 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;

for (int n=0; n < 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.

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).

• i dunno what you're trying to do. the first code is the creation of a $\operatorname{sinc}(\cdot)$ function. the second code looks like it creates a Blackman window. i don't see any filtering or any audio data. Feb 4, 2017 at 20:46
• Are you aware of the difference between designing a filter (i.e., computing the filter coefficients), and implementing a filter (i.e., filtering data)? What you've done so far is a first step in implementing a simple procedure for the design of a FIR filter (the windowing method). Feb 4, 2017 at 21:39