how to filter noise?

2 views (last 30 days)
abc
abc on 17 Dec 2012
How to play the sound to compare the filter sound..?? tq
[y,Fs,bits] = wavread('voice.wav');
Nsamps = length(y);
t = (1/Fs)*(1:Nsamps); %Prepare time data for plot
%Do Fourier Transform
y_fft = abs(fft(y)); %Retain Magnitude
y_fft = y_fft(1:Nsamps/2); %Discard Half of Points
f = Fs*(0:Nsamps/2-1)/Nsamps; %Prepare freq data for plot\][p
%Plot Sound File in Time Domain
figure
plot(t, y)
xlabel('Time (s)')
ylabel('Amplitude')
title('Tuning Fork A4 in Time Domain')
%Plot Sound File in Frequency Domain
figure
plot(f, y_fft)
xlim([0 1000])
ylim([0 1800])
xlabel('Frequency (Hz)')
ylabel('Amplitude')
title('Frequency Response of voice')
Fs = 44100; % Sampling Frequency
N = 1000; % Order
Fc1 = 800; % First Cutoff Frequency
Fc2 = 1000; % Second Cutoff Frequency
flag = 'scale'; % Sampling Flag
% Create the window vector for the design algorithm.
win = hamming(N+1);
% Calculate the coefficients using the FIR1 function.
b = fir1(N, [Fc1 Fc2]/(Fs/2), 'stop', win, flag);%
newy=conv(y,b);
wavwrite(newy,Fs,bits,'your-group-number');

Answers (2)

Walter Roberson
Walter Roberson on 17 Dec 2012
sound()

NORZALINA AKHARUDDIN
NORZALINA AKHARUDDIN on 30 Dec 2020
sound (y,fs);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!