view dsp/synth/fir2snd.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
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