Informe P4 (2016)Pràctica Inglés
Vista previa del texto
Interfering Tone Suppression
Sergi Garreta Serra and Maria Vallès, students of EETAC (UPC)
The purpose of this practice is to design a digital system
capable of improving the quality of a signal contaminated by a
disturbing beep. In particular, the music is played by a record
player. To remove the interference of the analogue signal, this
signal has to be first digitalized and after digitally processed.
The steps we are going to follow are the following: - Spectral analysis of the digitalized signal containing the disturbance - Design of the necessary filtering algorithm to remove the unwanted tone or beep We plot the waveform signal of one of the mono channel, in this case the xR: II. BACKGROUND STUDY To reject only one specific frequency we need a band-stop filter. We have two different ways to implement it: FIR and IIR. Here we have the zero-pole diagram of them: Fig. 2: xR plot Now, to know which is the digital frequency (Ω) of the interference tone, we plot the fft of xR with the following instructions: ft=abs(fft(xR, 2^nextpow2(2000000)); plot(ft) Fig. 1: FIR and IIR zero-pole diagram The transfer functions are the following: FIR: H(z)=k ·((z-ejΩo)·(z- e-jΩo))/(z2) IIR: H(z)= k ·((z-ejΩo)·(z- e-jΩo))/((z-r·ejΩo)·(z-r·e-jΩo)) III. PRACTICAL REALIZATION First of all, we listen to the jaguai.wav file. We notice that the song has been contaminated by a disturbing beep.
We open Matlab and load the file in a variable named xstereo and split it into two mono signals (one for the right channel and one for the left one) with the function: xR=xstereo(:,1); Fig. 3: FFT of xR 2 Once we have the plot, we execute this command to get the amplitude and the index of the peak: [y,i] = max (ft); The values we obtain are y = 1,9858·10 5 and i = 45178, so the digital frequency of the peak is 45177, because the vector starts at 1. We also calculate omega [rad/sample] with the formula (i*2*pi) / N, and the value calculated is 0,1354.
The analog frequency of the interference tone is calculated with the formula f = (i·fs) / N [Hz] and we get the value 950,0264 Hz.
As we have said in the background study, the digital filter we are going to use to suppress the interference tone is a bandstop filter.
We are going to analyze both FIR and IIR implementations and discover which is better to delete the interference.
Fig. 5: FIR zero-pole diagram Here the most relevant aspect is that the zeros are really near to the 0 and, as we can see in the Figure 4, the module is zero in values near to 0 and 2π.
Finite Impulse Response (FIR) To plot its zero-pole diagram and module we use the instruction fvtool and the roots of the polynomial with the Now, we are going to find the impulse response (h(n)) of this filter with the following instruction and save it into a new variable, and after we plot the result using stem command: command poly.
fvtool(poly(([exp(j*omega) exp (j*omega))], [1 0 0]) hnfir = dimpulse (poly(([exp(j*omega) exp (-j*omega))], [1 0 0]); stem(hnfir(1:10)) Fig. 4: FIR module plot Fig. 6: Stem plot of H(n) FIR The most important aspect of this graphic is that it has two different amplitudes, so although the interference is deleted, the original signal is distorted.
Finally, to end the study of the FIR implementation of the filter, we calculate the output doing the convolution of the signal and the filter: ynfir=conv(xR,hnfir); 3 The plot of the response obtained is the following: Fig. 8: IIR module plot The most important thing about the last figure is that we only have one amplitude, and we have to remember that this response is infinite but MATLAB limit it.
Fig. 7: Plot of Y(n) FIR The last step to end is to listen the response and check if the interference has disappeared. We do this using a function developed in one of the last practices: digital_to_analog: function  = digital_to_analog( signal, fs ) player=audioplayer(signal, fs); playblocking(player); end Con formato: Fuente: 10 pto, Inglés (Estados Unidos) We substitute signal by ynfir and fs by the value of the original signal frequency and listen it; the interference has disappeared.
Infinite Impulse Response (IIR) Fig. 9: IIR zero-pole diagram As we have done with the FIR, we use the fvtool instruction to plot the pole-zero diagram and the module: To find the impulse response (h(n)), we follow the same steps as in the last system: fvtool(poly([exp(j*omega) exp (-j*omega)], poly ([r*exp(j*omega) r*exp(-j*omega)]) hniir = dimpulse(poly([exp(j*omega) exp (j*omega)], poly ([r*exp(j*omega) r*exp(j*omega)]); stem(hniir(1:70)) 4 Fig. 10: Stem plot of H(n) IIR Fig. 12: Plot of Y(n) IIR Finally, we calculate the output doing the convolution: yniir = conv(xR, hniir); We plot the result: IV. CONCLUSIONS This laboratory session has been really interesting.
The first thing that has to be highlighted is the fact that there is a lot of differences between the response reached with the FIR and the IIR implementations.
In both, the interference disappears, but in the first one the sound is distorted. That happens because the filter has different amplitudes and, when the original signal passes through it, it is altered. With the second one, in addition to achieving the objective of eliminate the interference, it also allows us to get the signal as similar as possible to the original one.
Fig. 11: CANVIARRRRR Plot of Y(n) IIR When we use the digital_to_analog function and listen to it (substituting the attributes correctly), we notice that the interference has disappeared, but not at all; we can already listen to it.
Then, to correct our error, we try to adjust the value of the r parameter and make it a little bit lower: 0,9 instead of 0,97.
We redo all the calculus and listen the new response and, effectively, the interference has totally disappeared.
On the other hand, there is another aspect that is important to explain. Why the first IIR system did not remove at all the interference? This type of filter is really selective, and more if the r value is very close to 1. In our first try, we determined the r value as 0,97, and the error was that the peak was not situated exactly in the correct “place”???, so it could not be deleted at all. When we made the r value smaller (0,9), we “open” the filter and make it less strict, so if the peak is not in the exact point we need, it is also deleted.
Recapitulating, the best filter to delete interferences is the IIR one, but only if the r value is adequately chosen.
5 V. REFERENC ES  EETAC-UPC Website: http://atenea.upc.edu/moodle.