annotate 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 |
|
rev |
line source |
samer@34
|
1 function X=fir2snd(A,u)
|
samer@34
|
2 % fir2snd - Generate sound by applying FIR filters to a noise grain
|
samer@34
|
3 %
|
samer@34
|
4 % fir2snd ::
|
samer@34
|
5 % [[N,L]] ~'array of M FIR filters of length N',
|
samer@34
|
6 % ([[M]] | seq([[M]])) ~'noise grain or sequence of noise grains'
|
samer@34
|
7 % -> [[abs(M-N)+1,L]] ~'columns of filtered noise'.
|
samer@34
|
8
|
samer@34
|
9 n=size(A,1);
|
samer@34
|
10 l=size(A,2);
|
samer@34
|
11 m=size(u,1);
|
samer@34
|
12
|
samer@34
|
13 % want to extract the valid portion of the convolution only
|
samer@34
|
14 if m>n, seg=n:m;
|
samer@34
|
15 else seg=m:n; end
|
samer@34
|
16
|
samer@34
|
17 if ~isseq(u), u=repeat(u); end
|
samer@34
|
18
|
samer@34
|
19 X=zeros(length(seg),l);
|
samer@34
|
20 for k=1:l
|
samer@34
|
21 x=conv(A(:,k),head(u));
|
samer@34
|
22 X(:,k)=x(seg);
|
samer@34
|
23 u=next(u);
|
samer@34
|
24 end
|
samer@34
|
25
|
samer@34
|
26
|