annotate util/classes/@audio/unbuffer.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
rev   line source
daniele@166 1 function s = unbuffer(obj)
daniele@166 2
daniele@166 3 %% Check inputs and Defaults
daniele@166 4 if ~isprop(obj,'bufferOperator') || isempty(obj.bufferOperator)
daniele@166 5 error('You must buffer a signal before unbuffer it, come on!');
daniele@166 6 end
daniele@166 7
daniele@166 8 switch lower(obj.bufferOperator.method)
daniele@166 9 %Unbuffer using overlap-add method
daniele@166 10 case 'standard'
daniele@166 11 w = obj.bufferOperator.window(obj.bufferOperator.wLength);
daniele@166 12 S = diag(1./w)*obj.S;
daniele@166 13 %Non overlapping case
daniele@166 14 if obj.bufferOperator.overlap == 0
daniele@166 15 s = S(:);
daniele@166 16 %Overlapping case
daniele@166 17 else
daniele@166 18 Stemp = S(1:obj.bufferOperator.wLength-obj.bufferOperator.overlap,1:end);
daniele@166 19 s = [Stemp(:); S(obj.bufferOperator.wLength-obj.bufferOperator.overlap+1:end,end)];
daniele@166 20 end
daniele@166 21 %Unbuffer using inverse lot with identity local transform
daniele@166 22 case 'lot'
daniele@166 23 s = ilot(obj.S(:),obj.bufferOperator.wLength,'id',...
daniele@166 24 obj.bufferOperator.overlap,obj.bufferOperator.window);
daniele@166 25 otherwise
daniele@166 26 error('Please specify a valid buffer method');
daniele@166 27 end