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

Imported audio synthesis tools.
author samer
date Sun, 20 Jan 2013 19:05:05 +0000
parents
children 9e7be347b3a0
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dsp/synth/addsynth.m	Sun Jan 20 19:05:05 2013 +0000
@@ -0,0 +1,13 @@
+function y=addsynth(N,A,F,phi)
+% addsynth - Additive synthesis
+%
+% addsynth ::
+%    N:natural    ~'size of buffers to produce',
+%    seq([[K]])   ~'sequence of amplitudes for each component',
+%    seq([[K]])   ~'sequence of frequencies of sine waves to generate',
+%    [[K]]        ~'initial phases'
+% -> seq([[1,N]]) ~'sum of components'.
+
+phi=repmat_to(phi,size(F));
+y=sum(zipdata(@(a,x)spdiag(a)*x,2,A,blockdata(msine,N,phi,F)),1);
+