正确地开启语音信号

时间:2018-05-15 19:16:15

标签: matlab signal-processing fft speech-recognition speech

我正在将Hamming窗口应用于语音信号,以便执行音频声音的特征提取。

我将信号分成帧的方式是正确的吗?我应该使用窗口重叠吗?

  

这是我尝试使用MATLAB:

clear
close all

[data,fs] = audioread('speech_demo.wav');

timeWindow   = 20e-3;
lengthWindow = round(timeWindow*fs); % number of samples per window

L       = lengthWindow;
w_start = 0;
w_end   = lengthWindow;
j = 1;
for k = 1:round(length(data)/lengthWindow)

    x = w_start:w_end-1;
    hold on
    plot(x,hann(lengthWindow),'r:');
    plot(x,data(x+1),'k.-')
    plot(x,data(x+1).*hamming(lengthWindow),'m.-')
    wSignal(j:L*k,:) = data(x+1).*hamming(lengthWindow);

    w_start = w_start + L;
    w_end   = w_start + L;
    j       = L*k+1;

end
set(gcf,'color','w')

信号和窗口的图: enter image description here

放大: enter image description here

谢谢。

1 个答案:

答案 0 :(得分:1)

根据我对bufferbsxfun的评论。请考虑以下代码,

[y,Fs] = audioread('someAudioFile.wav');

timeWindow   = 20e-3;
lengthWindow = round(timeWindow*Fs); % number of samples per window

% third argument specifies the number of overlapping samples
yBuffer = buffer(y, lengthWindow, round(lengthWindow*0.2));
hammWin = hamming(lengthWindow);

yBufferWindowed = bsxfun(@times, yBuffer, hammWin);