This is my matlab code to get an input via mic and another one that will be a pre-recorded one ,i have used fft in order to plot the graphs in freq domain.Please could anyone suggest me the way or any algorithm to be used to compare these 2 plots ?

%Necessary Variable initialisation and Functions function[norm_voice,h] = Voice_Rec(sample_freq); option = 'n'; option='a'; record_len = 1; %Record time length in seconds sample_freq = 8192; %Sampling frequency in Hertz sample_time=sample_freq * record_len;
%Get ready to record your voice To Give The Command option_rec = input('Press y to give the command: ','s'); if option_rec=='y' input('Press enter when ready to record--> '); record = wavrecord(sample_time, sample_freq); %Records the input through the sound card to the variable with specified sampling frequency end
%using Fast fourier Transformation the Run Time Command of frequency domain %Spectrum is Generated [H,W]=freqz(record,1,1000,sample_freq); subplot(211) plot(W,abs(H)),title('Frequency Spectrum of the recorded command'),xlabel('Frequency (Hz)'),ylabel('Ampltide') xlim([100 500])
%Taking FFT x=fft(record)
%The Saved Wav File Frequency Domain Spectrum file = 'DESKTOP/balaji start.wav'; a= wavread(file);
%FFT For Saved Wav File in Frequency Domain spectrum [H,W]=freqz(a,1,2048,sample_freq); subplot(212) plot(W,abs(H)),title('Frequency Spectrum of balaji start'),xlabel('Frequency (Hz)'),ylabel('Ampltide') xlim([100 500])
%Takin FFT y=fft(a)

Community Treasure Hunt

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

Start Hunting!

Translated by