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

Imported audio synthesis tools.
author samer
date Sun, 20 Jan 2013 19:05:05 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dsp/synth/specsynth.m	Sun Jan 20 19:05:05 2013 +0000
@@ -0,0 +1,18 @@
+function Y=specsynth(S,gen,N,M)
+% specsynth - Spectral synthesis by FIR filtering white noise 
+%
+% specsynth ::
+%    seq([[L]])    ~'sequence of L-point power spectra',
+%    (N:natural=>[[1,N]]) ~'generator of noise buffers',
+%    N:natural     ~'size of buffers of noise signals to take'
+%    M:natural     ~'frame overlap'
+% -> seq([[1,M]])  ~'sequence of signal buffers'.
+
+% NOTE: this should really take gen to be seq natural -> seq [[1,_]]
+% eg
+% gen = @(n)rndzip(sampler(gaussian),n,getrndstate)
+% this should be  the basic type of a buffered signal generator
+
+if nargin<4, M=N; end
+U=rndmap(gen,repeat(N),getrndstate);
+Y=unbuffer(zipwith(@conv,map(@(s)spec2fir(sqrt(s)),S),U),M);