Speaker Identification using machine learning

조회 수: 15 (최근 30일)
Muhsin Yusif
Muhsin Yusif 2020년 6월 25일
답변: Dat Le 2020년 12월 11일
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

답변 (1개)

Dat Le
Dat Le 2020년 12월 11일
Could you give me your code about speaker identification?

카테고리

Help CenterFile Exchange에서 Signal Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by