comparison dsp/synth/specsynth.m @ 34:c75bb62b90a9

Imported audio synthesis tools.
author samer
date Sun, 20 Jan 2013 19:05:05 +0000
parents
children
comparison
equal deleted inserted replaced
33:5b7d90b6393a 34:c75bb62b90a9
1 function Y=specsynth(S,gen,N,M)
2 % specsynth - Spectral synthesis by FIR filtering white noise
3 %
4 % specsynth ::
5 % seq([[L]]) ~'sequence of L-point power spectra',
6 % (N:natural=>[[1,N]]) ~'generator of noise buffers',
7 % N:natural ~'size of buffers of noise signals to take'
8 % M:natural ~'frame overlap'
9 % -> seq([[1,M]]) ~'sequence of signal buffers'.
10
11 % NOTE: this should really take gen to be seq natural -> seq [[1,_]]
12 % eg
13 % gen = @(n)rndzip(sampler(gaussian),n,getrndstate)
14 % this should be the basic type of a buffered signal generator
15
16 if nargin<4, M=N; end
17 U=rndmap(gen,repeat(N),getrndstate);
18 Y=unbuffer(zipwith(@conv,map(@(s)spec2fir(sqrt(s)),S),U),M);