Question

For this homework, you will be filtering noise from a sound recording. The assignment is broken...

For this homework, you will be filtering noise from a sound recording. The assignment is broken into simple steps you can follow. Please follow instructions carefully and remember that you will only upload one workspace (*.mat) file. Make sure to name the clean_speech variable correctly.
1) Download the Matlab workspace from the link provided in Canvas. Move the downloaded file to the same folder as your script to make things simpler.
2) Load the downloaded workspace into Matlab.
You can use the following command: load noisy_speech.mat
3) You will see two variables. fs = 16000Hz is the sampling frequency and noisy_speech is the vector that contains a recording of a spoken sentence with a very harsh noise.
4) You can use “soundsc” command to play the speech file: soundsc(noisy_speech,fs)
NOTE: If you are working through USF AppGateway (Citrix), you can’t use soundsc command because it runs on USF servers, not your computer. You will either need a computer that runs a local copy of Matlab or save the sound file, download it to your computer and play it there. See the following link to see how to save an audio file. You can use the *.vaw format.
https://www.mathworks.com/help/matlab/ref/audiowrite.html
5) Determine what frequency band your desired signal is in, and what frequency band your noise occupy. You can do a frequency analysis (using FFT) to determine the noise frequency band. You will not be able to see your desired signal because the noise will dominate it.
NOTE: Feel free to use the internet for determining the frequency range of your desired signal (human speech).
6) Design a filter to filter out the noise using any method you would like, Matlab’s filterBuilder tool for example. Filter the noisy_speech signal to obtain a clean speech signal. Name this variable as clean_speech.
7) Do another frequency analysis (using FFT) to the filtered signal and compare it with the frequency domain of the noisy signals. Verify that your desired signal is visible in the frequency domain plot.
8) Listen to your resulting sound file with soundsc(clean_speech,Fs). The speech signal should be clean without any harsh noise, something you wouldn’t mind hearing on a phone call. See the note under 4) if you are using Citrix.
9) When you are happy with the sound quality, save your workspace with:
save lastname_firstname_hw4.mat
10) Upload your workspace file, which includes all the variables as well as your filter.

Homework Answers

Answer #1

clc;
clear all;
close all;
clear workspace;
%% Load Noise free Voice signal and Draw its Magnitude Spectrum
%%
[Filename Pathname] = uigetfile('Dataset\*.mat','Select an Original Voice Signal');
load('originalsignal.mat');
fs=4000;
x=w(:,1);
figure(1);
plot(x);
soundsc(x,fs)
xlabel('Time in Sec.');
ylabel('Magnitude in Volt');
title('Noise-free voice Signal');
%plot magnitude spectrum of the Noise-free voice signal
yf=fft(x);
xf=linspace(0,16000,length(yf));
figure(2);
plot(xf/16000,abs(yf));
xlabel('frequency in Hz');
ylabel('Magnitude');
title('Magnitude Spectrum of Noise free voice Signal');
%% Load Noisy Voice signal and Draw its Magnitude Spectrum
%%
[Filename Pathname] = uigetfile('Dataset\*.mat','Select a Noisy Voice Signal');
load('noisy_speech.mat');
y=z(:,1);
figure(3);
plot(y);
soundsc(y,fs)
xlabel('Time in Sec.');
ylabel('Magnitude in Volt');
title('Noisy voice Signal');
%plot magnitude spectrum of the Noisy voice signal
yf1=fft(y);
xf1=linspace(0,16000,length(yf1));
figure(4);
plot(xf1/4000, abs(yf1));
xlabel('frequency in Hz');
ylabel('Magnitude');
title('Magnitude Spectrum of Noisy voice Signal');
%% Apply Low Pass filter on noisy voice signal with cutoff frequency 1000Hz, consider where sampling frequency 16000 Hz.
%%
b=fir1(1000, 1000/16000,'low');
y_filtered=filter(b,1,y);
figure(5);
plot(y_filtered);
xlabel('Time in Sec.');
ylabel('Magnitude in Volt');
title('Filtered Noisy-voice Signal');
%plot magnitude spectrum of the Filtered Noisy-voice Signal
y_filtered1=fft(y_filtered);
x_filtered=linspace(0,1,length(y_filtered1));
figure(6);
plot(x_filtered, abs(y_filtered1));
xlabel('frequency in Hz');
ylabel('Magnitude');
title('Magnitude Spectrum of filtered Noisy-voice Signal');
%% Apply Apply Low Pass filter on noisy voice signal with cutoff frequency 1000Hz using windowing method, where consider sampling frequency 4000 Hz.
%%
n=1000; %% Order
b1=fir1(n, 1000/16000,'low',window);
y_filtered2=filter(b1,1,y);
figure(7);
plot(y_filtered2);
xlabel('Time in Sec.');
ylabel('Magnitude in Volt');
title('Filtered Noisy-voice Signal using Windowing Technique');
%plot magnitude spectrum of the Filtered Noisy-voice Signal
y_filtered3=fft(y_filtered2);
x_filtered3=linspace(0,1,length(y_filtered3));
figure(6);
plot(x_filtered3, abs(y_filtered3));
xlabel('frequency in Hz');
ylabel('Magnitude');
title('Magnitude Spectrum of filtered Noisy-voice Signal using Windowing Technique');

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions