/* Spiral Synthesis * May 1999 - Bradley Bell * this is a csound implementation of code from Tracy Lind Petersen's * "Spiral Synthesis" which can be read at: * http://staff.washington.edu/bradleyb/spiralsynth/ * * don't forget to add something like these to entry.c: * 75a76 * > #include "spiral.h" * 318a320 * > void spiralset(void*), spiral(void*); * 1058a1061 * > { "spiral",S(SPIRAL), 5, "aa", "kkkk", spiralset, NULL, spiral } * */ #include "cs.h" #include "spiral.h" #include void spiralset(SPIRAL *p) { p->phz = 0.0; p->dr = p->di = 0.0; p->xr = 1.0; } void spiral(SPIRAL *p) { int nsmps=ksmps; float *real = p->real; float *imag = p->imag; float *acar = p->acar; float *fcar = p->fcar; float *amod = p->amod; float *fmod = p->fmod; do { p->angl = 2 * M_PI * *fcar++ / esr; p->phzdel = 2 * M_PI * *fmod++ / esr; p->mod = *amod++ * sin(p->phz); p->phz += p->phzdel; p->mg2 = *acar++ + p->mod; p->angl2 = p->angl + p->mod; p->a = p->mg2 * cos(p->angl2); p->b = p->mg2 * sin(p->angl2); p->yr = p->xr + p->a * p->dr - p->b * p->di; p->yi = p->b * p->dr + p->a * p->di; p->dr = p->yr; p->di = p->yi; p->xr = 0; *real++ = p->yr; *imag++ = p->yi; } while (--nsmps); }