Mercurial > hg > smallbox
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/util/classes/@audio/unbuffer.m Mon Sep 19 14:53:23 2011 +0100 @@ -0,0 +1,27 @@ +function s = unbuffer(obj) + +%% Check inputs and Defaults +if ~isprop(obj,'bufferOperator') || isempty(obj.bufferOperator) + error('You must buffer a signal before unbuffer it, come on!'); +end + +switch lower(obj.bufferOperator.method) + %Unbuffer using overlap-add method + case 'standard' + w = obj.bufferOperator.window(obj.bufferOperator.wLength); + S = diag(1./w)*obj.S; + %Non overlapping case + if obj.bufferOperator.overlap == 0 + s = S(:); + %Overlapping case + else + Stemp = S(1:obj.bufferOperator.wLength-obj.bufferOperator.overlap,1:end); + s = [Stemp(:); S(obj.bufferOperator.wLength-obj.bufferOperator.overlap+1:end,end)]; + end + %Unbuffer using inverse lot with identity local transform + case 'lot' + s = ilot(obj.S(:),obj.bufferOperator.wLength,'id',... + obj.bufferOperator.overlap,obj.bufferOperator.window); + otherwise + error('Please specify a valid buffer method'); +end