Mercurial > hg > ishara
view dsp/synth/unbuffer_nu.m @ 36:9e7be347b3a0
Renamed sequence classes to avoid clashes with seq methods;
Fixed default slicing dimension while retaining behaviour of window.m;
Updated use of sequences in dsp/synth.
author | samer |
---|---|
date | Thu, 24 Jan 2013 14:51:23 +0000 |
parents | c75bb62b90a9 |
children |
line wrap: on
line source
% unbuffer_nu - Non-uniform hop overlap and add % % unbuffer_nu :: % seq([[1,_]]) ~'sequence of overlapping frames', % seq(natural) ~'sequence of hop sizes' % -> seq([[1,_]]) ~'sequence of de-overlapped frames'. function Y=unbuffer_nu(X,hop) Y=zipaccum(@olap,[],hop,X); function [y,s1]=olap(hop,x,s) ls=length(s); lx=length(x); if lx>=hop if ls>=hop % NB: this will fail if ls>lx, but this shouldn't happen since ls<=lx-hop y=(x(1:hop)+s(1:hop))'; s1=[s(hop+1:ls)+x(hop+1:ls);x(ls+1:end)]; else y=[x(1:ls)+s;x(ls+1:hop)]'; s1=x(hop+1:end); end else if ls>=hop y=[s(1:lx)+x;s(lx+1:hop)]'; s1=s(hop+1:end); else y=zeros(1,hop); y(1:ls)=y(1:ls)+s'; y(1:lx)=y(1:lx)+x'; end end end end