To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

The primary repository for this project is hosted at git://github.com/rmeddis/MAP.git .
This repository is a read-only copy which is updated automatically every hour.

Statistics Download as Zip
| Branch: | Revision:

root / utilities / enframe.m @ 38:c2204b18f4a2

History | View | Annotate | Download (2.03 KB)

1
function f=enframe(x,win,inc)
2
%ENFRAME split signal up into (overlapping) frames: one per row. F=(X,WIN,INC)
3
%
4
%	F = ENFRAME(X,LEN) splits the vector X(:) up into
5
%	frames. Each frame is of length LEN and occupies
6
%	one row of the output matrix. The last few frames of X
7
%	will be ignored if its length is not divisible by LEN.
8
%	It is an error if X is shorter than LEN.
9
%
10
%	F = ENFRAME(X,LEN,INC) has frames beginning at increments of INC
11
%	The centre of frame I is X((I-1)*INC+(LEN+1)/2) for I=1,2,...
12
%	The number of frames is fix((length(X)-LEN+INC)/INC)
13
%
14
%	F = ENFRAME(X,WINDOW) or ENFRAME(X,WINDOW,INC) multiplies
15
%	each frame by WINDOW(:)
16

    
17
%	   Copyright (C) Mike Brookes 1997
18
%      Version: $Id: enframe.m,v 1.4 2006/06/22 19:07:50 dmb Exp $
19
%
20
%   VOICEBOX is a MATLAB toolbox for speech processing.
21
%   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
22
%
23
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24
%   This program is free software; you can redistribute it and/or modify
25
%   it under the terms of the GNU General Public License as published by
26
%   the Free Software Foundation; either version 2 of the License, or
27
%   (at your option) any later version.
28
%
29
%   This program is distributed in the hope that it will be useful,
30
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
31
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32
%   GNU General Public License for more details.
33
%
34
%   You can obtain a copy of the GNU General Public License from
35
%   http://www.gnu.org/copyleft/gpl.html or by writing to
36
%   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
37
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38

    
39
nx=length(x(:));
40
nwin=length(win);
41
if (nwin == 1)
42
   len = win;
43
else
44
   len = nwin;
45
end
46
if (nargin < 3)
47
   inc = len;
48
end
49
nf = fix((nx-len+inc)/inc);
50
f=zeros(nf,len);
51
indf= inc*(0:(nf-1)).';
52
inds = (1:len);
53
f(:) = x(indf(:,ones(1,len))+inds(ones(nf,1),:));
54
if (nwin > 1)
55
    w = win(:)';
56
    f = f .* w(ones(nf,1),:);
57
end
58

    
59