*This preview shows
pages
1–4. Sign up
to
view the full content.*

This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*
**Unformatted text preview: **EE 261 The Fourier Transform and its Applications Fall 2009 Problem Set Seven Due Wednesday, November 11 1. (20 points) Handel’s Hallelujah In this problem we will explore the effects of sampling with or without anti-aliasing filters. As we saw in lecture there is a significant distortion of music due to aliasing if we sample slower than twice the highest frequency component. However if we can suppress the high frequency components before sampling we can possibly avoid distortion due to aliasing. In this problem we will use an anti-aliasing filter H ( s ) whose Fourier transform is shown below. H ( s ) is available on the class web site in the Matlab file anti-aliasing.mat , which contains H ( s ) in the vector Hs .-4000-3000-2000-1000 1000 2000 3000 4000 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 s(Hz) H(s) Figure 1: Anti aliasing filter Built into Matlab is a snippet of Handel’s Hallelujah Chorus, you load it into the workspace by typing load handel 1 This loads two variables into the workspace y that contains about 8 seconds of Handel’s Hallelujah Chorus and Fs which is the sampling frequency used. Finally here is the problem, resample the snippet of Handel’s Hallelujah Chorus down to a sampling frequency of f s = 4096hz that should be half of the original sampling frequency. Now apply the anti-aliasing filter to Handel’s Hallelujah Chorus so that you cut off all frequencies higher than 2048hz, and then resample down to f s = 4096hz. Is there any audible difference between the two versions? Why or why not. Turn in your (commented!) Matlab code along with a short discussion (2 paragraphs) of any audible difference you heard or did not hear. Hints: To resample at half the sampling rate, you can use xhalf = x(1:2:length(x)); Remember to adjust the sampling rate correctly when you use sound or wavwrite . Recall that you can use fft to take the Fourier transform, and ifft to take the inverse Fourier transform. Hs has been arranged in the same way Matlab’s fft returns Fourier transforms. To evaluate H ( s ) X ( s ) try using the .* operator. Solution: Just from observing the transfer function of the anti-aliasing filter, we expect a more “base” version when we apply the anti-aliasing filter, but that version will be free of aliasing artifacts. We implement a Matlab script to make the two versions, shown below load handel % we downsample directly yhalf = y(1:2:length(y)); % and since I have not installed OSS on my Linux box % yet, I write out to a wavfile wavwrite(yhalf,Fs/2,16,’handel2.wav’); % alternatively I could use % sound(yhalf,Fs/2,16) % and then with an AA filter... load anti-aliasing 2 % we take the fourier transform Y = fft(y); % and filter Z = Y.*Hs; % then back into the time domain z = ifft(Z); % and downsample zhalf = z(1:2:length(z)); % we scale zhalf since wavwrite wants inputs % ranging from -1 to 1 zhalf = zhalf/max(abs(zhalf)); % we write out to a file wavwrite(zhalf,Fs/2,16,’handel3.wav’); % or if I had OSS installed...

View
Full
Document