**Tasks to do: **

**Separation of signal into particular frequency bands.**- Split signal
*s0001.bin*(fs = 8 kHz, raw data, 16-bit PCM, use fcn loadbin.m) into two complementary and same wide frequency bands, i.e.*0 - fs/4*a*fs/4 - fs/2*. - Design filters as FIR ones using window method, i.e. use
fcn
*fir1*. Order of the filter should be*M = 50*. __STEP 1:__Creation of the signal in low-frequency band (LFB).- Design a filter for decimation into LFB
*0 - fs/4*and realize the filtering of above referenced signal. - 1st checked result (unclassified):
- Display frequency response of designed filter (to LFB).
- Draw waveform and spectrogram of processed signal
*s0001.bin*(for spectrogram computation use the length of short-time analysis frame*32 ms*. - Draw into one figure spectrograms of original and filtered signal.

- Design a filter for decimation into LFB
__STEP 2:__Creation of signal in high-frequency band (HFB)- Design a filter for decimation into HFB
*fs/4 - fs/2*and realize the filtering of above referenced signal. - Design this filter on the basis of transformation of filter for LFB.
**2nd checked result (1 point)**:- Draw into one figure frequency responses of desgned fiters (both LFB and HFB ones) and check the fulfilling of the condition for perfect reconstruction.
- Display spectrograms of both filtered signals (LFB and HFB).

- Design a filter for decimation into HFB

- Split signal
**Change of sampling rate**__STEP 3:__Realize the decimation with the factor 1:2 on the basis of even-sample removing in both frequency bands.- Observe spectrograms before and after decimation in both frequency bands - explain observed results !
- NOTE. Do not use fcn
*decimate*- it does not realize decimation in the sense of removing of each second sample! __STEP 4:__Realize the interpolation with the factor 1:2 for the reconstruction of original sampling rate using the following particular steps:- Interlace zeros between samples of decimated signal in both bands and observe spectrograms.
- Realize the interpolation using a suitable filtering. For the purpose of filtering, use the same filters as for the separation of input signal into particular frequency bands. Observe obtained spectrograms.
- Observe powers of particular signals before decimation and after both steps of interpolation. Explaind the difference and suggest suitable correction.

**3rd checked result (1 point)**: Compare spectrograms of signlas in both bands for signals:- after decimation,
- after the first step of interpolation (zero interlace),
- after the second step of interpolation (filtering).

**Composition of full-band output signal from particular bands**- Add interpolated signals from particular bands and compute a measure of distortion based on power of error signal (i.e. based on difference between input and output signal).
- ATTENTION! do not forget to take into account the delay generated by FIR filter during the computation of error signal.
**4th checked result (1 point)**:- Compute
*SNR_e = 10 * log P_s / P_e*for analyzed signals.

- Compute
- Take into account the error introduced by decimation and interpolation, compute again an error signal computed from an output composed from the sum of LFB and HFB signals before the decimation (compute again SNR_e).

HOMEWORK:

- What is the decimation factor for this case ?
- What changes in signal spectra can be observed ?
- What changes must be done in interpolation steps?