view 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
line wrap: on
line source
function obj = buffer(obj,wLength,overlap,window,method)

%% Check inputs & Defaults
error(nargchk(2, 5, nargin, 'struct'));

if ~exist('overlap','var') || isempty(overlap), overlap = 0; end
if ~exist('method','var') || isempty(method), method = 'standard'; end

%% Buffer audio
switch lower(method)
	case 'standard'
		if ~exist('window','var') || isempty(window), window = @rectwin; end
		validWindows = {'hanning','hamming','triang','rectwin'};
		if ~sum(strcmpi(validWindows,func2str(window)));
			error('The window chosen is not valid because it cannot be inverted!');
		end
		obj.S = diag(window(wLength))*buffer(obj.s,wLength,overlap,'nodelay');
	case 'lot'
		if ~exist('window','var') || isempty(window), window = 'sin2'; end
		s_lot = lot(obj.s,wLength,'id',overlap,window);
		obj.S = buffer(s_lot,wLength);
	otherwise
		error('Please specify a valid buffer method');
end

obj.bufferOperator = struct('wLength',wLength,'overlap',...
	overlap,'window',window,'method',method);