Question

In: Electrical Engineering

Assume you have a WAV file containing an audio with noise. The audio was sampled with...

Assume you have a WAV file containing an audio with noise. The audio was sampled with a sampling frequency of 8ksamples/second. If you play the audio file, you will be able to notice that there is a small tune along with a strong noise. Design a digital filter using Matlab or Octave to remove the noise. Write the code showing all steps of designing a digital filter? Need help please

Solutions

Expert Solution

Hello,
          Please find the answer attached as under. Please give a thumbs up rating if you find the answer useful! Have a rocking day ahead!

NOTE: I have designed a digital butterworth filter with cut off of 1000 Hz. The results are clearly visible in the spectrum pots attached:

****** Matlab Code *******

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% filtering audio signal

load handel.mat
filename = 'handel.wav';
audiowrite(filename,y,Fs);
samples = [1,2*Fs];
clear y Fs
% Read the 1st 2 seconds of data back into MATLAB using audioread.
[y,Fs] = audioread('handel.wav',samples);
t = 0:1/Fs:2-(1/Fs);
L = length(y);

%%%%%%%%%%%fft of original sound
Y = fft(y);
%Compute the two-sided spectrum P2.
%Then compute the single-sided spectrum P1 based on P2 and the even-valued signal length L.
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
plot(f,P1)
title('Single-Sided Amplitude Spectrum of original audio')
xlabel('f (Hz)')
ylabel('|P1(f)|')

%%%%%%%%% Designing digital filter

fc = 1000;                  % cut off freq
fs = Fs;

[b,a] = butter(6,fc/(fs/2));
dataIn = y;
dataOut = filter(b,a,dataIn);

%%%%%%%%%%%fft of original sound
Y = fft(dataOut);
%Compute the two-sided spectrum P2.
%Then compute the single-sided spectrum P1 based on P2 and the even-valued signal length L.
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
figure;
plot(f,P1)
title('Single-Sided Amplitude Spectrum of filtered audio')
xlabel('f (Hz)')
ylabel('|P1(f)|')

******* Output ********


Related Solutions

In Python: Assume a file containing a series of integers is named numbers.txt and exists on...
In Python: Assume a file containing a series of integers is named numbers.txt and exists on the computer's Disk. Write a program that reads al the numbers stored in the file and calculates their total. - create your own text file called numbers.txt and put in a set of 20 numbers (each number should be between 1 and 100). - Each number should be on its own line. - do not assume that the file will always have 20 numbers...
Assume a file containing a series of words is named words.txt and exists on the computer’s...
Assume a file containing a series of words is named words.txt and exists on the computer’s disk. The program should generate the set of unique words in the document and display the number of times each word in the list appears in the document.
{PYTHON }You have a CSV file containing the location and population of various cities around the...
{PYTHON }You have a CSV file containing the location and population of various cities around the world. For this question you'll be given a list of cities and return the total population across all those cities. Write a function named "total_population" that takes a string then a list as parameters where the string represents the name of a CSV file containing city data in the format "CountryCode,CityName,Region,Population,Latitude,Longitude" and the second parameter is a list where each element is itself a...
{PYTHON }You have a CSV file containing the location and population of various cities around the...
{PYTHON }You have a CSV file containing the location and population of various cities around the world. For this question you'll be given a list of cities and return the total population across all those cities. Write a function named "total_population" that takes a string then a list as parameters where the string represents the name of a CSV file containing city data in the format "CountryCode,CityName,Region,Population,Latitude,Longitude" and the second parameter is a list where each element is itself a...
1. You have just finished a 25-page paper that you have written using Emacs.The file containing...
1. You have just finished a 25-page paper that you have written using Emacs.The file containing the paper is called /assignments/data_sources.After your instructor has briefly looked at the paper, she recommends that you change all instances of the ref- erence “data is” to “data are” before you submit it.Which of the following com- mands can you use to locate these references in the file for a quick assessment of how much you have to change? a. find - i 'data...
Assume you work for OSHA (Occupational Safety and Health Administration) and have complaints about noise levels...
Assume you work for OSHA (Occupational Safety and Health Administration) and have complaints about noise levels from some of the workers at a state power plant. You charge the power plant with taking decibel readings at 2 different areas of the plant at different times of the day and week. The results of the data collection are listed. The safe hearing level is approximately 120 decibels Area1 Area 2 30 59 12 63 35 81 65 110 24 65 59...
Assume that you have a Saudi league player database. In this database, you have a table containing players’ attributes
Assume that you have a Saudi league player database. In this database, you have a table containing players’ attributes such as (Name, age, position, etc.) and you decided to add information about players’ agents. Would you represent the agent information as attributes in the player table or would you create an entity set for players’ agents? Justify your answer.
You have been given a style sheet file containing several errors. Locate all of the errors...
You have been given a style sheet file containing several errors. Locate all of the errors and fix the file. 1. Go to the code2-4.html file and within the head section insert link elements linking the page to the code2-4_layout.css and code2-4.css files. Review the contents of the files. 2.  Test the code2-4.css file in the CSS validator at the W3C website or with another validator of your choice. Make a note of the errors reported as a guide to debugging...
C programming: Assume you have the following spreadsheet as example.csv. This .csv file can have more...
C programming: Assume you have the following spreadsheet as example.csv. This .csv file can have more than 1000 lines of data. time latitude longitude depth mag 2020-10-19T23:28:33.400Z 61.342 -147.3997 12.3 1.6 2020-10-19T23:26:49.460Z 38.838501 -122.82684 1.54 0.57 2020-10-19T23:17:28.720Z 35.0501667 -117.6545 0.29 1.51 2020-10-19T22:47:44.770Z 38.187 -117.7385 10.8 1.5 2020-10-19T22:42:26.224Z 54.4198 -159.9943 18.7 2.9 2020-10-19T22:39:38.900Z 18.004 -66.761 14 2.87 Read the spreadsheet which is example.csv file in your new c program and then sort the above data by latitude in ascending order. Use...
Assume that you have a printer that can print an average file in two minutes. Every...
Assume that you have a printer that can print an average file in two minutes. Every two and a half minutes a user sends another file to the printer. Assuming both inter-arrival and service time follow the exponential distribution, in steady state condition, (a) As an average, how long does it take before a user can get their output? (10 points) (b) To speed things up you can buy two similar printers that is exactly the same as the one...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT