Discrete Summation Formula (DSF)

References : Stylson, Smith and others... (posted by Alexander Kritov)
Notes :
Buzz uses this type of synth.
For cool sounds try to use variable,
for example a=exp(-x/12000)*0.8 // x- num.samples
Code :
double DSF (double x,  // input
            double a,  // a<1.0
            double N,  // N<SmplFQ/2,
            double fi) // phase
  double s1 = pow(a,N-1.0)*sin((N-1.0)*x+fi);
  double s2 = pow(a,N)*sin(N*x+fi);
  double s3 = a*sin(x+fi);
  double s4 =1.0 - (2*a*cos(x)) +(a*a);
  if (s4==0)
     return 0;
     return (sin(fi) - s3 - s2 +s1)/s4;

from : dfl[*AT*]ccrma[DOT]stanford[DOT]edu
comment : According to Stilson + Smith, this should be double s1 = pow(a,N+1.0)*sin((N-1.0)*x+fi); ^ ! Could be a typo though?

from : Alex
comment : yepp..

from : TT
comment : So what is wrong about "double" up there? For DSF, do we have to update the phase (fi input) at every sample? Another question is what's the input x supposed to represent? Thanks!

from : David Lowenfels
comment : input x should be the phase, and fi is the initial phase I guess? Seems redundant to me. There is nothing wrong with the double, there is a sign typo in the original posting.

from : nobody[AT]nowhere[DOT]com
comment : I'm not so sure that there is a sign typo. (I know--I'm five years late to this party.) The author of this code just seems to have an off-by-one definition of N. If you expand it all out, it looks like Stilson & Smith's paper, except you have N here where S&S had N+1, and you have N-1 where S&S had N. I think the code is equivalent. You just have to understand how to choose N to avoid aliasing. I don't have it working yet, but that's how it looks to me as I prepare a DSF oscillator. More later.

from : mysterious T
comment : Got it working nicely, but it took a few minutes to pluck it apart. Had to correct it for my pitch scheme, too. But it's quite amazing! Funny concept, though, it's like a generator with a built in filter. It holds up into very high pitches, too, in terms of aliasing, as far as I can tell... ehm...and without any further oversampling (so far). Really, really nice! I was looking for a way to give my sinus an edge! ;)