view dsp/synth/fir2snd.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
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