Channel Equalization
Po-Han Huang
Abhinandan Majumdar
MS. Electrical Engineering
MS Computer Engineering
[email protected]
[email protected]
Digital Signal Processing Final Project EE 4810 2007 Fall Professor Dan Ellis
IDEX 1. ITRODUCTIO ..................................................................................................................1 1.1 Channel Equalization ..........................................................................................................1 1.2 Types ...................................................................................................................................2 1.2.1 Linear Equalizer ......................................................................................................2 1.2.2 Decision Feedback Equalizer ..................................................................................2 1.2.3 Adaptive Equalizer ..................................................................................................3 2. THEORY .................................................................................................................................4 2.1 The Problem Statement .......................................................................................................4 2.2 System Identification ..........................................................................................................4 2.3 Algorithm ............................................................................................................................6 3. RESULT ..................................................................................................................................7 3.1 Actual Input Signal for Sxx .................................................................................................7 3.1.1 Zero Phase Filter .....................................................................................................7 3.1.2 Linear Phase Filter ................................................................................................10 3.2 Different Signal for Sxx .....................................................................................................11 3.2.1 Zero Phase Filter ...................................................................................................12 3.2.2 Linear Phase Filter ................................................................................................13 3.3 Approximated Sxx .............................................................................................................14 3.3.1 Zero Phase Filter ...................................................................................................15 3.3.2 Linear Phase Filter ................................................................................................16 4. COCLUSIO .....................................................................................................................18 4.1 Concise Result ..................................................................................................................18 4.2 Future Work ......................................................................................................................18 4.3 Experience .........................................................................................................................18 5. REFERECE ........................................................................................................................19 APPEDIX ..................................................................................................................................20
1. ITRODUCTIO In audio processing, equalization is the process of changing the frequency envelope of a sound. In passing through any channel, temporal/frequency spreading of a signal occurs. Etymologically, it means to correct, or make equal, the frequency response of a signal. The term "equalizer" is often incorrectly applied as a general term for audio filters. These are in fact general all-purpose all filters, which can be arranged to pproduce roduce the effect of low pass, high pass, band pass and band stop filters. Only when these filters are arranged so as to reverse the effects of the internal circuitry on sound output, are they operating as equalizers. 1.1
Channel Equalization
To combat the distortive tortive channel effects, or in other words, invert the FIR filter (time-invariant (time or time-varying) varying) representing the channel, a so so-called called equalizer is needed. In a communication system, the transmitter sends the information over an RF channel. On passing through th the channel, the signal gets distorted before actually it gets received at the receiver end. Hence, it is the receiver ”task” is to figure out what signal was transmitted and turn the received signal in understandable information.
Fig 1.1 Inter symbol Interference
The purpose of an equalizer is to reduce the ISI as much as possible to maximize the probability of correct decisions. 1
1.2
Types
1.2.1
Linear Equalizer In a Linear Equalizer, the the current and the past values of the received signal are linearly weighted by equalizer coefficients and and summed to produce the output, using the relation below.
a) Zero forcing equalizer – In such type of equalizers, it removes the complete ISI without taking ng in consideration the resul resulting ting noise enhacement. enhacement Using this, there is a substantial increment of the noise power power.
b) Mean-Square Square Error equalizer – Such type of equlaizers attempt to minimize the total error between the slicer input and the transmitted data symbol.
1.2.2
Decision Feedback Equalizer It is a simple imple nonlinear equalizer which is particulary useful for channel with severe amplitude distortion. It uses desicion feedback to cancel the interferfence from symbols which have already have been detected. The basic idea is that if the values of the symbols already detected are known (past decisions are assumed correct), then the ISI contributed by these symbols can be canceled exactly. In a Decision Feedback Equalizer Architecture, tthe he forward and feedback coefficients may be adjusted simultaneously to minimize the M Mean ean Square Error.
Fig 1.2 Decision Feedback Equalizer
2
1.2.3
Adaptive Equalizers This type of equlaizers adapt the coefficients to minimize the noise and intersymbol interference (depending on the type of equalizer) at the output.
Fig 1.3 Adaptive Equalizers
There are two modes that adaptive equalizers work; a) Decision Directed Mode: The he receiver decisions are used to generate the error signal. Decision directed equalizer adjustment is effective in in tracking slow variations in the channel response. However, this approach is not effective during initial acqusition .
b) Training Mode: To make equalizer suitable in the initial acqusition duration, a training signal is needed. In this mode of operation, the transmitter generates a data symbol sequence known to the receiver. Once an agreed time has elapsed, the slicer output is used as a training signal and the actual data transmission begins.
3
2. THEORY 2.1
The Problem Statement
The problem being dealt here is an unknown unk input signal X underwent unwanted filtering after being passed through unknown channel. The object is to regenerate the original sample(X) from the filtered sample(Y).
Fig 2.1 Channel Equalization
2.2
System Identification
In an Energy Density Spectrum technique of system identification, we compute the input signal
x[n] from Energy Density Spectrum of input signal Sxx(݁௪ ) and that of output signal Syy(݁௪ ). This spectrum can be evaluated by taking the DTFTs of the autocorrelation sequence rxx[l] of input sequence x[n] and the autocorrelation sequence ryy[l] of output sequence y[n]. y[n] Considering a stable LTI discrete time system with an impulse response h[n], ஶ
ݕሾ݊ሿ ൌ ݄ሾ݇ ሿݔሾ݊ െ ݇ሿ ୀିஶ
And our application, the input signal x[n] is not known, this system system can be identified by computing the autocorrelation of the output signal y[n] defined by,
4
ஶ
ݎ௬௬ ሾ݈ ሿ ൌ ݕሾ݊ሿݕሾ݊ െ ݈ሿ ୀିஶ
From the above equations, ஶ
ஶ
ஶ
ୀିஶ
ୀିஶ
ୀିஶ
ݎ௬௬ ሾ݈ሿ ൌ ൭ ݄ሾ݇ሿݔሾ݊ െ ݇ሿ൱ ൭ ݄ሾ݉ െ ݈ሿݔሾ݊ െ ݉ + ݈ሿ൱ ஶ
ஶ
ஶ
ୀିஶ
ୀିஶ
ൌ ݄ሾ݇ሿ ݄ሾ݉ ൌ ݈ ሿ ൭ ݔሾ݊ െ ݇ ሿ ݔሾ݊ െ ݉ + ݈ ሿ൱ ஶ
ୀିஶ
ஶ
ൌ ݄ሾ݇ ሿ ݄ሾ݉ ൌ ݈ ሿ ݎ௫௫ ሾ݉ െ ݈ െ ݇ሿ ൌ ݄ሾ݈ ሿ ⊛ ݄ሾെ݈ ሿ ⊛ ݎ௫௫ ሾ݈ሿ ୀିஶ
ୀିஶ
Hence, in the z – domain, the equation becomes, ܵ௬௬ ሺݖሻ ൌ ܪሺݖሻ ܪሺି ݖଵ ሻܵ௫௫ ሺݖሻ
where, ܵ௬௬ ሺݖሻ is the z – transform of ݎ௬௬ ሾ݈ ሿ. On the unit circle, the above equation reduces to ଶ
ܵ௬௬ ൫݁ ௪ ൯ ൌ หܪ൫݁ ௪ ൯ห ܵ௫௫ ሺ݁ ௪ ሻ
From, the above relation, the autocorrelation of the output signal can provide only the magnitude response of the system but not the phase response.
5
2.3
Algorithm
Fig 2.2 Block Diagram of Algorithm
Here, we only have the filtered sample. Hence we kind of approximate Sxx values, which is the average of various speech samples considered for our experiment. Hence, we find the autocorrelation of the sequence y, and then pass it through FFT block to get the Frequency response of ryy as Syy. Then we perform division of Syy and Sxx to get |H(z)|2. Then we perform the square root of it and divide it to Y which is the DTFT of output sample to get frequency components of regenerated erated input sample. Then we perform Inverse DTFT by passing it through IFFT block to get the regenerate input sample in time domain. As discussed before, by this approach, we lose the phase information being added by the filter, hence we need to make approximation roximation on filter characteristics so as to minimize θH, resultantly θx ≈ θy. Hence in a nutshell, approximations being made are listed below. a) We approximate on Sxx values by taking the DTFT of the autocorrelation of average of the input speech samples. b) We approximate that the filter channel characteristics are that of zero phase or linear phase filter so as θH ≈ 0. 6
3. RESULTS For our experimentation purpose, we ran three type of simulation each with zero and linear phase which are described in detail below. 3.1
Actual Input Signal for Sxx
3.1.1
Zero Phase Filter
Here we passed through a length 11 zero-phase FIR lowpass filter designed using the Remez exchange algorithm. The matlab code for designing this filter is as follows: N b M h
= = = =
11; [0 0.1 0.2 0.5]*2; [1 1 0 0 ]; remez(N-1,b,M);
% % % %
filter length - must be odd band edges desired band values Remez multiple exchange design
The impulse response is returned in linear-phase form, so it must be left-shifted (N-1)/2 samples to make it zero phase.
Figure 3.1: Impulse response and frequency response of a length 11 zero-phase FIR lowpass filter. Here the frequency response is real because the filter is zero phase. Also plotted (in dashed lines) are the desired passband and stopband gains.
7
Figure 3.2 shows the amplitude and phase responses of the FIR filter designed by remez. The phase response is zero throughout the passband and transition band. However, each zero-crossing in the stopband results in a phase jump of π radians, so that the phase alternates between zero and π in the stopband. This is typical of practical zero-phase filters.
Fig3.2 : Amplitude response and phase response of the length 11 zero-phase FIR lowpass filter in Fig.3.1.
We passed our original input sample through the zero phase filter generated, and here’s the spectral analysis of the original and filtered sample showing the energies at lower frequencies are kept intact while that of in higher frequencies are removed.
Fig 3.3 Spectrum of Original Signal and Filtered Signal (Zero-Phase)
8
We compute sqrt(Syy/Sxx) which is the magnitude response of the unknown filter. By doing this, we loose phase information and hence it remains 0 as shown in graph with small glitches in middle.
Fig 3.4 Magnitude and Phase Response of the Zero Phase filter
After we got the filter response, we tried to regenrate x by dividing y by magnitude response of filter obtained and did an inverse DTFT on that. Through this, we could successfully regenerate original sample, and energy spectrum looks exactly same as per the original sample as per the spectral analysis.
Fig 3.5 Spectrum of Original Signal and Regenerated Signal (Zero-Phase)
9
3.1.2
Linear Phase Filter
For this, we used the same filter code without shifting it by (N-1)/2. Here is the spectrum of input and filtered sample showing the energy in the higher frequency area are removed.
Fig 3.6 Spectrum of Original Signal and Filtered Signal (Linear-Phase)
The maginitude and phase response (almost zero as expected) obtained are as follows
Fig 3.7 Magnitude and Phase Response of the Linear Phase filter
10
We could regenrate the input sample but had some ringing sound. In the spectral analysis, we see some energy at higher frequency (blue spots) are missing in the regenerated sample.
Fig 3.8 Spectrum of Original Signal and Regenerated Signal (Linear-Phase)
3.2
Different Signal for Sxx
For this part of simulation, we took a completely different sample to approximate Sxx. Below is the spectral analysis of the original sample and approximated sample.
Fig 3.9 Spectrum of Original Signal and Used Signal for Sxx
11
3.2.1
Zero Phase Filter
Below is the magnitude and phase response which we could recover (some what corrupted).
Fig 3.10 Magnitude and Phase Response of the Zero Phase filter
After regeneration of the input sample, we found it similar to the input sample, but with lot of noise being added in the background. From the spectral analysis, we see the input and regenerated sample have similar enery spectrum but have lot of distortion in higher frequencies.
Fig 3.11 Spectrum of Original Signal and Regenerated Signal (Zero-Phase) (Using different signal for Sxx)
12
3.2.2
Linear Phase Filter
We repeated the same process considering a Linear Phase Filter Channel, and got a corrupted magnitude and phase response for the filter.
Fig 3.12 Magnitude and Phase Response of the Linear Phase filter
The regenerated sample sounded much like the original sample but with lot of noise being added in background. Also, from the spectral analysis, the energy spectrum looks quite similar with lot of distortion in higher frequency area.
Fig 3.13 Spectrum of Original Signal and Regenerated Signal (Linear-Phase) (Using different signal for Sxx)
13
3.3
Approximated Sxx
Here we took a complete different input sample, and used three samples which was the same speech but spoken by different speaker and at different timing. Here is the spectral analysis of three samples with energy spectrum similar but different in sense of timing and frequency.
Fig 3.14 Spectrum of Sample 1,Sample 2 and Sample 3
To approximate Sxx, we took the average of the frequency components of their autocorrelation values. This is because Sxx values for a human speech are nearly same, hence taking an average of different samples.
Fig 3.15 Sxx Magnitude of Sample 1,Sample 2 and Sample 3
14
3.3.1
Zero Phase Filter
This is the spectrum of original sample, after being passed through low pass zero phase filter, which enerdies removed at higher frequencies.
Fig 3.16 Spectrum of Original Signal and Filtered Signal (Zero-Phase)
Here’s the magnitude and phase response of the filter. It looks less corrupted and more close to the original filter response as obtained in 3.1.1.
Fig 3.17 Magnitude and Phase Response of the Zero Phase filter
15
The regenerated sample sounded less noisy than that of 3.2.1. Also the energy spectrum is more close to the original at lower frequencies.
Fig 3.18 Spectrum of Original Signal and Regenerated Signal (Zero-Phase) (Using Average of 3 samples for Sxx)
3.3.2
Linear Phase Filter
When passed through Linear Phase , it removes the energy at higher frequency.
Fig 3.19 Spectrum of Original Signal and Filtered Signal (Linear-Phase)
16
The magnitude response of the filter appears more closer to the original one that 3.1.2 than 3.2.2
Fig 3.20 Magnitude and Phase Response of the Linear Phase filter
The regenerated sample sounded less noisy than that of 3.2.2 case. Also through the spectral analysis, enery spectrum at lower frequency are nearly same and less noisy than 3.2.2.
3.21 Spectrum of Original Signal and Regenerated Signal (Linear-Phase) (Using Average of 3 samples for Sxx)
17
4. COCLUSIO 4.1
Concise Result
From the simulation, we could finally summarize following results Values used of Sxx Original Sample Different Sample Average of various Sample 4.2
Filter Type Zero Phase Linear Phase Zero Phase Linear Phase Zero Phase Linear Phase
Result Regenerated Exact Input Sample Regained Original Sample with feeble ringing sound Regenerated Noisy Input Sample Regenerated Noisy Input Sample Regenerated Less Noisy Input Sample Regenerated Less Noisy Input Sample
Future Work
From the work done, we can have better approximation algorithms so as the regenerated sample is more close both in terms of magnitude and phase, closer to the original sample. Also, as this approach of System Identification has a major contraint of losing the phase response of the filter, this technique cannot be used for general case, and hence lot of approximation on the filter specification has to be done. For other filter like that of IIR filters such as Butterforth or Elliptical filter, this technique could be used to recover the magnitude response of the sample, so if we have a technique to predict the phase modification being added by the filter, we can recover the original sample. 4.3
Experience
Working directly upon the filter characteristics, modifying its properties, playing with sound samples, analyzing the sound spectrum and comparing various tradeoffs affecting equalization characteristics gave us a through insight upon a real world problem. Also it gave us an experience of implementing the theoritical aspect of Digital Signal Processing over an actual application. Hence, we are kind of thankful to everyone especially Prof. Dan Ellis and TA Wei Jiang, whose constant guidance and motivation saved our work to go into pitfalls.
18
5. REFERECES [1]
Digital Signal Processing – Sanjit Mitra
[2]
Channel Equalization Techniques by Fernando Gregorio.
[3]
http://en.wikipedia.org/wiki/Equalization
[4]
Blind System Identification and Channel Equalization of IIR Systems without Statistical Information, Signal Processing, IEEE Transactions on Acoustics, Speech, and Signal Processing, Erwei Bai and Minyue Fu.
19
APPEDIX Code for 3.1.1, 3.1.2, 3.2.1, 3.2.2 num = 512*64; a = 0; %Start from the beginning (a=0), a can be 0~77482 [x,r] = wavread('mssp3.wav'); %ORIGINAL Sound [x2,r] = wavread('mssp2.wav'); %Another Sound x=x(a+1:a+num); % shorten the original sound(110250) into (32768) x2=x2(a+1:a+num); N = 11; % filter length - must be odd b = [0 0.1 0.2 0.5]*2; % band edges M = [1 1 0 0 ]; % desired band values h = remez(N-1,b,M); % Remez multiple exchange design hh = h(6:N); % Shift (N-1)/2=5 samples to make h zero-phase hh(7:11) = 0; % Pass it through the filter y = filter(hh,1,x); % Zero Phase Ly = filter(h,1,x); % Linear Phase % Autocorrelation %AutoCorrelation:using Original signal as estimated x rxx=xcorr(x(1:num)); rxx2=xcorr(x2(1:num)); %AutoCorrelation:using Different signal as estimated x ryy=xcorr(y); rLyy=xcorr(Ly); rxysize = size(rxx); num1 = 2^ceil(log2(rxysize(1))); %make num into even Ex.65535 into 65536 % Do FFT to get frequency response of autocorrelation sxx = fft(rxx,num1); sxx2= fft(rxx2,num1); syy = fft(ryy,num1); sLyy = fft(rLyy,num1); Y = fft(y,num1); LY =fft(Ly,num1); for i = 1 : num1 if (syy(i) == 0) XX(i) = 999999999999999; XX2(i) = 999999999999999; else %|ܪሺiሻ| ଶ = syy(i)/sxx(i); XX(i)=Y(i)/H(i) XX(i) = Y(i)*sqrt(abs(sxx(i)/syy(i))); XX2(i)= Y(i)*sqrt(abs(sxx2(i)/syy(i))); end end for i = 1 : num1 if (sLyy(i) == 0) LXX(i) = 999999999999999;
20
LXX1(i) = 999999999999999; else %%|ܪሺiሻ| ଶ = syy(i)/sxx(i); XX(i)=Y(i)/H(i) LXX(i) = LY(i)*sqrt(abs(sxx(i)/sLyy(i))); LXX1(i) = LY(i)*sqrt(abs(sxx2(i)/sLyy(i))); end end xx = ifft(XX,num1); xx2 = ifft(XX2,num1); Lxx= ifft(LXX,num1); Lxx1= ifft(LXX1,num1); % Zero-Phase Filter case soundsc(x,r); %Original Sound soundsc(y,r); %Original Sound passed soundsc(xx,r); %Regenerated signal by soundsc(xx2,r); %Regenerated signal by % Linear-Phase Filter case soundsc(x,r); %Original Sound soundsc(Ly,r); %Original Sound passed soundsc(Lxx,r); %Regenerated signal by soundsc(Lxx1,r);%Regenerated signal by
through Zero-Phase Filter using original signal as estimated x using other signal as estimated x through Linear-Phase Filter using original signal as estimated x using other signal as estimated x
Code for 3.3.1, 3.3.2 num = 512*64; %ORIGINAL Sound [x,r] = wavread('sf1_cln.wav'); [x1,r] = wavread('sf2_cln.wav'); %BASE Sound [x2,r] = wavread('sf3_cln.wav'); %BASE Sound x=x(1:num); N = 11; % filter length - must be odd b = [0 0.1 0.2 0.5]*2; % band edges M = [1 1 0 0 ]; % desired band values % Remez multiple exchange design h = remez(N-1,b,M); hh = h(6:N); % Shift (N-1)/2=5 samples to make h zero-phase hh(7:11) = 0; % Pass it through the filter y = filter(hh,1,x); % Zero Phase Ly = filter(h,1,x); % Linear Phase % Autocorrelation rxx=xcorr(x(1:num)); %AutoCorrelation: ORIGINAL Sound rxx1=xcorr(x1(1:num)); %AutoCorrelation: BASE Sound rxx2=xcorr(x2(1:num)); %AutoCorrelation: BASE Sound ryy=xcorr(y); rLyy=xcorr(Ly); rxysize = size(rxx); num1 = 2^ceil(log2(rxysize(1))); %make num into even Ex.65535 into 65536 % Do FFT to get frequency response of autocorrelation sxx = fft(rxx,num1); sxx1= fft(rxx1,num1); sxx2= fft(rxx2,num1); sxx3= (sxx+sxx1+sxx3)/3; %Average the original and base sound as estimated Sxx syy = fft(ryy,num1); sLyy = fft(rLyy,num1);
21
Y = fft(y,num1); LY =fft(Ly,num1); % Zero-Phase Filter for i = 1 : num1 if (syy(i) == 0) XX(i) = 999999999999999; else %|ܪሺiሻ| ଶ = syy(i)/sxx(i); XX(i)=Y(i)/H(i) XX(i) = Y(i)*sqrt(abs(sxx3(i)/syy(i))); end end % Linear-Phase Filter for i = 1 : num1 if (sLyy(i) == 0) LXX(i) = 999999999999999; else %%|ܪሺiሻ| ଶ = syy(i)/sxx(i); XX(i)=Y(i)/H(i) LXX(i) = LY(i)*sqrt(abs(sxx3(i)/sLyy(i))); end end xx = ifft(XX,num1); Lxx= ifft(LXX,num1); % Zero-Phase Filter case soundsc(x,r); %Original Sound %Original Sound passed soundsc(y,r); soundsc(xx,r); %Regenerated signal by % Linear-Phase Filter case soundsc(x,r); %Original Sound soundsc(Ly,r); %Original Sound passed soundsc(Lxx,r); %Regenerated signal by
through Zero-Phase Filter using average spectrum as Sxx through Linear-Phase Filter using average spectrum as Sxx
22