view dsp/synth/fir2snd.m @ 42:ae596261e75f

Various fixes and development to audio handling
author samer
date Tue, 02 Dec 2014 14:51:13 +0000
parents c75bb62b90a9
children
line wrap: on
line source
function X=fir2snd(A,u)
% fir2snd - Generate sound by applying FIR filters to a noise grain
%
% fir2snd ::
%    [[N,L]]              ~'array of M FIR filters of length N',
%    ([[M]] | seq([[M]])) ~'noise grain or sequence of noise grains'
% -> [[abs(M-N)+1,L]]       ~'columns of filtered noise'.

n=size(A,1);
l=size(A,2);
m=size(u,1);

% want to extract the valid portion of the convolution only
if m>n, seg=n:m;
else seg=m:n; end

if ~isseq(u), u=repeat(u); end

X=zeros(length(seg),l);
for k=1:l
	x=conv(A(:,k),head(u));
	X(:,k)=x(seg);
	u=next(u);
end