📄 blockframes.m
字号:
function M3 = blockFrames(s, fs, m, n)
%function name is blockFrames,分帧、加窗、预加重,结果存放于M3。
% Inputs: s
% fs 采样频率
% m 开始2帧的距离
% n 每帧采样的点数
% M3 是输出的矩阵
%s='1\s1.wav';
%m=100,n=400;
l=length(s);
nbFrame = floor((l - n) / m) + 1;%floor 是对括号里的数进行取整运算,nbFrame得到的是信号一共分成多少帧
for i = 1:n
for j = 1:nbFrame
M3(i,j) = s(((j-1)*m)+i);
end
end
%function f=enframe(x,win,inc)
%ENFRAME split signal up into (overlapping) frames: one per row. F=(X,WIN,INC)
%
% F = ENFRAME(X,LEN) splits the vector X(:) up into
% frames. Each frame is of length LEN and occupies
% one row of the output matrix. The last few frames of X
% will be ignored if its length is not divisible by LEN.
% It is an error if X is shorter than LEN.
%
% F = ENFRAME(X,LEN,INC) has frames beginning at increments of INC
% The centre of frame I is X((I-1)*INC+(LEN+1)/2) for I=1,2,...
% The number of frames is fix((length(X)-LEN+INC)/INC)
%
% F = ENFRAME(X,WINDOW) or ENFRAME(X,WINDOW,INC) multiplies
% each frame by WINDOW(:)
% Copyright (C) Mike Brookes 1997
% Version: $Id: enframe.m,v 1.5 2007/05/04 07:01:38 dmb Exp $
%
% VOICEBOX is a MATLAB toolbox for speech processing.
%nx=length(x(:));
%nwin=length(win);
%if (nwin == 1)
%len = win;
%else
%len = nwin;
%end
%if (nargin < 3)
%inc = len;
%end
%nf = fix((nx-len+inc)/inc);
%f=zeros(nf,len);
%indf= inc*(0:(nf-1)).';
%inds = (1:len);
%f(:) = x(indf(:,ones(1,len))+inds(ones(nf,1),:));
%if (nwin > 1)
%w = win(:)';
%f = f .* w(ones(nf,1),:);
%end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -