Hello, I\'m working on MATLAB.I have a speech file which recorded using by matla
ID: 2084977 • Letter: H
Question
Hello, I'm working on MATLAB.I have a speech file which recorded using by matlab and i want to process it with following instructions.l need MATLAB codes for it. Plot the signal in time domain Plot the amplitude and phase spectrum using FFI Design and apply a lowpass filter with corner frequency of 8kHz, plot amplitude spectrum, listen an comment Design and apply a highpass filter with corner frequency of 2kHz, plot amplitude spectrum and convert it to wav file again to listen. These Codes must be written before the instructions.Explanation / Answer
Code:
clc;
clear all;
close all;
info = audiodevinfo;
speech_file = audiorecorder(44100,8,1);
record(speech_file);
pause(3);
stop(speech_file);
y = getaudiodata(speech_file);
figure,
plot(y);
y_modified = downsample(y,2);
downsampled_speechfile = audioplayer(y_modified, 22050, 8);
play(speech_file);
play(downsampled_speechfile);
%%b
info = audiodevinfo;
speech_file = audiorecorder(8000,8,1);
record(speech_file);
pause(5);
stop(speech_file);
y = getaudiodata(speech_file);
figure,
plot(y);
y_modified = downsample(y,2);
downsampled_speechfile = audioplayer(y_modified, 4000, 8);
play(speech_file);
play(downsampled_speechfile);
y1 = fft(y);
figure, plot(abs(y1)), title('Amplitude plot')
figure, plot(angle(y1)), title('Phase plot')
Fs = 44100;
t = linspace(0,1,Fs);
%x =wavread('sound.wav');
% Specifying the filter
%'Fp,Fst,Ap,Ast' (passband frequency, stopband frequency, passband ripple, stopband attenuation)
lowpf = fdesign.lowpass('Fp,Fst,Ap,Ast',8.0e3,8.1e3,0.5,50,40e3);
% Designing the filter
D = design(lowpf);
% Applying the filter
y_lw_8 = filter(D,y);
y1 = fft(y_lw_8);
figure, plot(abs(y1)), title('Amplitude plot (8 kHz Low passed )')
figure, plot(angle(y1)), title('Phase plot (8 kHz Low passed )')
% Specifying the filter
%'Fp,Fst,Ap,Ast' (passband frequency, stopband frequency, passband ripple, stopband attenuation)
highpf = fdesign.highpass('Fst,Fp,Ast,Ap',1.9e3,2.0e3,0.5,50,40e3);
% Designing the filter
D1 = design(highpf);
% Applying the filter
y_hgh_8 = filter(D1,y);
y1 = fft(y_hgh_8);
figure, plot(abs(y1)), title('Amplitude plot (2 kHz High passed )')
figure, plot(angle(y1)), title('Phase plot (2 kHz High passed )')
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.