comparison util/classes/@audio/buffer.m @ 166:1495bdfa13e9 danieleb

Updated grassmanian function (restored old computation of the dictionary) and added functions to the audio class
author Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk>
date Mon, 19 Sep 2011 14:53:23 +0100
parents
children f8bc99a5470c
comparison
equal deleted inserted replaced
162:88578ec2f94a 166:1495bdfa13e9
1 function obj = buffer(obj,wLength,overlap,window,method)
2
3 %% Check inputs & Defaults
4 error(nargchk(2, 5, nargin, 'struct'));
5
6 if ~exist('overlap','var') || isempty(overlap), overlap = 0; end
7 if ~exist('method','var') || isempty(method), method = 'standard'; end
8
9 %% Buffer audio
10 switch lower(method)
11 case 'standard'
12 if ~exist('window','var') || isempty(window), window = @rectwin; end
13 validWindows = {'hanning','hamming','triang','rectwin'};
14 if ~sum(strcmpi(validWindows,func2str(window)));
15 error('The window chosen is not valid because it cannot be inverted!');
16 end
17 obj.S = diag(window(wLength))*buffer(obj.s,wLength,overlap,'nodelay');
18 case 'lot'
19 if ~exist('window','var') || isempty(window), window = 'sin2'; end
20 s_lot = lot(obj.s,wLength,'id',overlap,window);
21 obj.S = buffer(s_lot,wLength);
22 otherwise
23 error('Please specify a valid buffer method');
24 end
25
26 obj.bufferOperator = struct('wLength',wLength,'overlap',...
27 overlap,'window',window,'method',method);