Unformatted text preview:

Handout 6 – Sampling and aliasingBONUS EXERCISEExercise 6.1 – Listening to aliasingExercise 6.2 – How to tell if there’s aliasing distortionSPHSC 503 – Speech Signal Processing UW – Summer 2006 Handout 6 – Sampling and aliasing Before looking into sampling and aliasing, first a general note. There’s a new Matlab function called update.m for download on the class website. This function takes care of any other downloads you may need for the lab sessions. Once you have downloaded the update function, you can quickly download all the materials such as M-files and WAV-files that you need for today’s lab to Matlab’s current directory by typing >> update or >> update today If you instead want to download all the materials for the lab session of another day, you can specify the date. For example, type >> update 6/28 And if you want to download all the materials for all the lab sessions, simply type >> update all Try it for today! Download the update.m file from the class website to the folder C:\Temp\SPHSC503\, set Matlab’s current directory to the that current directory, and type >> update In the future, just change Matlab’s directory to C:\Temp\SPHSC503\ , and run update again at the start of the lab. BONUS EXERCISE After some online searching, I’ve found a publication describing another way to remove noise from a speech signal, and a Matlab M-file that implements that method. This technique, proposed in 1996 by Pascal Scalart and Jozue Vierra Filho, is a significant improvement over the spectral subtraction method that we saw in previous lab. Here is briefly how it works: • The method operates entirely on the spectrogram of the input signal • Like spectral subtraction, it needs an estimate of the noise spectrum • It uses the average of the first 0.25 seconds of the signal’s spectrogram as the initial noise estimate • It compares each column of the spectrogram in turn to the estimate of the noise spectrum o If the column is similar to the noise spectrum, the column is marked as noise, and the noise estimate is updated with the information from the spectrogram column. The column of the spectrogram is then set to zero. o If the column is not similar to the noise spectrum, it is marked as speech. The column is then multiplied by a weighting vector that is based on the content of the column and the noise estimate. The weighting vector is designed to increase the SNR of that column. • An output signal is reconstructed from the modified spectrogram – 1 –SPHSC 503 – Speech Signal Processing UW – Summer 2006 As this explanation shows, Scalart’s method does not use subtraction to suppress the noise, but uses a time-varying filter to increase the SNR in speech, and silences the output when there’s only noise. As a result, this method does not suffer from the musicality and reverberant artifacts of the spectral subtraction method. To apply this method to a speech signal, try the following commands: >> [y,fs] = wavread('0zk.wav'); >> soundsc(y,fs) >> y = scalart(y,fs); >> soundsc(y,fs); Simple and impressive, isn’t it? Keep the processed signal, y, on hand for the next exercise. Exercise 6.1 – Listening to aliasing Since we can only work with sequences and sampled signals in Matlab, we need a bit of a trick to illustrate sampling and aliasing. In this exercise, we will explain it by means of ‘resampling’. We will take a speech signal, and ‘resample’ it to a lower sampling rate. In a way, we are pretending that the original speech signal is an analog signal, which we sample at the lower sampling rate. We will resample the signal in two ways: • by selecting every one out of N samples, where N is the downsampling factor • by using the resample function from the Signal Processing Toolbox, which applies an anti-aliasing filter to the signal before downsampling it a. Use the noise-free version of the 0zk.wav file, see the bonus exercise above for details. b. Plot the noise-free signal y against time in seconds. >> t = (0:length(y)-1)/fs; >> figure, plot(t,y), xlabel('Time (s)'), title('Original signal') >> soundsc(y,fs); Part 1: sampling without anti-aliasing filter c. Define two new sampling frequencies, as follows >> fs2 = fs / 2; >> fs3 = fs / 3; d. Create two downsampled signals by selecting 1 out of every 2, and 1 out of every 3 samples: >> y2 = y(1:2:end); >> y3 = y(1:3:end); e. Plot the downsampled signals against time in seconds. Do you see anything different compared to the original signal? >> t2 = (0:length(y2)-1)/fs2; >> t3 = (0:length(y3)-1)/fs3; >> figure, plot(t2,y2), xlabel('Time (s)'), title('Downsampled by 2') >> figure, plot(t3,y3), xlabel('Time (s)'), title('Downsampled by 3') f. Play the downsampled signals. >> soundsc(y2,fs2); >> soundsc(y3,fs3); – 2 –SPHSC 503 – Speech Signal Processing UW – Summer 2006 These signals should sound low-pass in nature, with some (in case of y2) or a lot (in case of y3) distortion. Is that what you hear as well? Part 2: sampling with anti-aliasing filter g. Create two ‘resampled’ signals using the resample function. >> y2r = resample(y,fs2,fs); % downsample by 2 with anti-alias filter >> y3r = resample(y,1,3); % downsample by 3 with anti-alias filter The resample function takes three parameters: the input signal, the target sampling rate and the original sampling rate. The sampling rates must be specified as integers. The resample function doesn’t use the target and original sampling rates directly, but resamples the signal by the ratio of the two rates, i.e., target / original. This property of the resample function is used in the second line, because we can’t use fs3 in that case because it is not an integer. For more details on the resample function, see help resample. h. Plot the resampled signals against time in seconds. Do you see anything different compared to the original signal? >> figure, plot(t2,y2r), xlabel('Time (s)'), title('Resampled by 2') >> figure, plot(t3,y3r), xlabel('Time (s)'), title('Resampled by 3') i. Play the resampled signals. >> soundsc(y2r,fs2); >> soundsc(y3r,fs3); These signals should sound low-pass in nature, like y2 and y3, but without any aliasing distortion. Keep y, y2, y3, y2r and y3r and their sampling rates for the next exercise. Exercise 6.2 – How to tell if there’s aliasing distortion a. Plot spectrograms of all the signals generated in Exercise 6.1 >>


View Full Document

UW SPHSC 503 - Sampling and aliasing

Download Sampling and aliasing
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Sampling and aliasing and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Sampling and aliasing 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?