% matlab online: https://ww2.mathworks.cn/en/products/matlab-online.html 
% https://ww2.mathworks.cn/en/support/learn-with-matlab-tutorials.html
close all %close all figures
clear
%capture voiced sound
fname="s1.wav";
 
[sig,fs]=audioread(fname);%x=data,fs=sampling_rate,nbits=num_bits
s=sig(:,1); %get one channel from stereo sound
%start=13470; %starting place for voiced sound (vowel sound)
start=7470; %starting place for voiced sound (vowel sound)
frame_size=1024; % one frame
x=s(start:start+frame_size-1);
figure(1)
clf
subplot(3,1,1);
plot(x)
ylabel("x signal frame")
xlabel("time 1024 samples")
 
 
subplot(3,1,2);
hamming=hamming(frame_size);
plot(hamming)
ylabel("hamming")
xlabel("time 1024 samples")
 
subplot(3,1,3);
 
x1=hamming.*x;
plot(x1)
ylabel("x1 windowed")
xlabel("time 1024 samples")
 
'you may use x1 and s for assignments';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'mfcc calculation'
 
coeffs = mfcc(s,fs,"LogEnergy","Ignore") %
size(coeffs)
% since the 1st column is for m0, if we ignore m0, we use mfcc(frame_number, 2:end) to get the mfcc vector
mfcc1=coeffs(20,2:end) %frame 20, mfcc0 (indexed 1 in matlab mfcc) is not used
%write your code here
