annotate arrows/delay.m @ 42:ae596261e75f

Various fixes and development to audio handling
author samer
date Tue, 02 Dec 2014 14:51:13 +0000
parents 672052bd81f8
children
rev   line source
samer@0 1 % delay - arrow implementing a delay line
samer@0 2 %
samer@0 3 % delay ::
samer@0 4 % W:natural ~'width of buffer',
samer@0 5 % A ~'a value to pad delay line with'
samer@0 6 % -> arrow({[[N,1]->A]}, {[[N,1]->A]}, {[W]->[[N]->A]}).
samer@0 7
samer@0 8 function a=delay(n,pad)
samer@0 9 a=loop(@delayfn,@(sz)repmat({repmat(pad,sz)},1,n));
samer@0 10 function [out,buf]=delayfn(in,buf)
samer@0 11 out=buf{1};
samer@0 12 buf=[buf(2:end),{in}];
samer@0 13 end
samer@0 14 end