blockframes.m

来自「speaker recognition matlab code」· M 代码 · 共 30 行

M
30
字号
function M3 = blockFrames(s, fs, m, n)
% blockFrames: Puts the signal into frames
%
% Inputs: s  contains the signal to analize
%         fs is the sampling rate of the signal
%         m  is the distance between the beginnings of two frames
%         n  is the number of samples per frame
%
% Output: M3 is a matrix containing all the frames
%
%

    l = length(s);
    nbFrame = floor((l - n) / m) + 1;
    
    for i = 1:n
        for j = 1:nbFrame
            M(i, j) = s(((j - 1) * m) + i);
        end
    end
    
    h = hamming(n);
    M2 = diag(h) * M;
    
    for i = 1:nbFrame
        M3(:, i) = fft(M2(:, i));
    end
    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?