Speaker Identification using machine learning

14 visualizaciones (últimos 30 días)
Muhsin Yusif
Muhsin Yusif el 25 de Jun. de 2020
Respondida: Dat Le el 11 de Dic. de 2020
Hello,
Im writing a code on speaker identification systems and Im stuck at creating triangular mel filter bank. I got a wierd triangular filter bank when i plotted it. Please help any advice appreciated, thank in advance. The code and the Triangular filter plot are attached below.
% read voice file
[audio,fs] = audioread('B1.wav');
%resamplying fs to 16kHz
fs1 = 16000;
[p,q] = rat(fs1/fs);
new_audio = resample(audio,p,q);
plot(new_audio)
%Pre-emphasis
a=[1];
preemph=[1 -0.95];
x = filter(preemph,a,new_audio);
plot(x)
%Frame blocking
fd = 0.025;
frameoverlap = 0.01;
N = length(x);
framelength = round(fd * fs1);
framestep = round(frameoverlap * fs1);
N_frames = floor(N/framelength);
%creating frames
frames=[];
for i=1:N_frames
frame = x((i-1)*framestep + 1: ((i-1)*framestep)+framelength);
max_val=max(frame);
if (max_val>0.025)
frames=[frames;frame];
end
end
% Hamming window
plot(hamming(length(frames)))
win_frame = frames * hamming(length(frames));
plot(win_frame)
%FFT
ft = abs(fft(win_frame));
plot(ft);
% Mel Filter Bank
fl = 0;
fh = fs1/2;
N_filter = 12;
nfft = 512;
%computing band in mel-scale
mel_low = 2595*log10(1+(fl/700));
mel_high=2595*log10(1+(fh/700));
%creating the mel-scaled vector
mel = linspace(mel_low,mel_high,N_filter+2);
% mel to Hertz warping function
melinhz=700*(exp(mel/2595)-1);
%Converting to frequency resolution
f = floor((nfft+1)*melinhz/fs1);
%Creating triangular filter
for m =2:length(mel)-1
for k=1:nfft
if k<f(m-1)
H(m-1,k) = 0;
elseif (k>=f(m-1)&&k<=f(m))
H(m-1,k)= (k-f(m-1))/(f(m)-f(m-1));
elseif (k>=f(m)&&k<=f(m+1))
H(m-1,k)= (f(m+1)-k)/(f(m+1)-f(m));
elseif k>f(m+1)
H(m-1,k) = 0;
end
end
end

Respuestas (1)

Dat Le
Dat Le el 11 de Dic. de 2020
Could you give me your code about speaker identification?

Community Treasure Hunt

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

Start Hunting!

Translated by