# Understanding anti aliasing filter

I'm working on a project for the university about the anti aliasing filter.

I have a small audio file, which has a sampling rate of 22KHz. Now when I downsample it 8 times, the file sounds weird. So far so good.

Now I should design an anti aliasing filter to avoid that. But how do I choose the cut off frequency based on the spectrum of the 8-time downsampled signal?

Anyhelp would be appreciated.

From your statement, i understand a discrete-time downsampling of a sequence $$x[n]$$ already converted to digital, without aliasing, previously.
So to prevent any aliasing on the downsampled sequence $$y[n]$$, you should first apply an anti-aliasing lowpass filter to the input sequence $$x[n]$$. The cutoff frequency of the lowpass filter is given by the downsampling ratio $$D$$ and is:
$$\omega_c = \frac{ \pi }{D }$$ radians per sample. The gain of the lowpass filter is one.
The following Matlab\Octave code designs a linear phase, type-I, FIR lowpass filter of odd length $$L = 2K+1$$ with a group delay of $$K$$ samples :
D = 8;     % downsampling factor