I have been attempting to model an analog phaser for rakarrack based upon the existing phaser (from ZynAddSubfx), since the only necessary changes lie within a few lines of code at the core of phaser.c.
I have modeled the algorithm in FreeMat (Matlab work-alike) and produced plots that agree with theory.
My inexperience with C and C++ must be causing me some problems in the way I am dealing with parameters...such as type casting int to float etc....or maybe I am just making a dumb "off by 1" mistake in the loop.
Argghhh. I have decided to take on a reverse delay feature request from the rakarrack forum. This seems a simple enough hack, starting with echo.c...and maybe port the functionality to MusicDelay.c.
If anyone reads this blog, here is the section of code modified. It is yet untested, but if the relevant parts are copy/pasted into echo.c, and make sure the extra variables are declared in echo.h, then I anticipate this will produce the reverse delay. I hope to compile and test this later this week. I have a bunch of meat to butcher, so my next couple of evenings are pretty well tied up with the joy of hunting season.
Comments are welcome:
* Effect output
Echo::out (REALTYPE * smpsl, REALTYPE * smpsr)
int reverse = 1; //Notice this is hard-coded to reverse delay mode. This variable declaration will needed to be deleted from here, declared in echo.h, and controlled from the GUI.
REALTYPE l, r, ldl, rdl;
for (i = 0; i < PERIOD; i++)
ldl = ldelay[kl];
rdl = rdelay[kr];
l = ldl * (1.0 - lrcross) + rdl * lrcross;
r = rdl * (1.0 - lrcross) + ldl * lrcross;
ldl = l;
rdl = r;
ldl = smpsl[i] * panning - ldl * fb;
rdl = smpsr[i] * (1.0 - panning) - rdl * fb;
efxoutl[i] = ldelay[rvkl] * 2.0;
efxoutr[i] = rdelay[rvkr] * 2.0;
efxoutl[i] = ldl * 2.0;
efxoutr[i] = rdl * 2.0;
ldelay[kl] = ldl = ldl * hidamp + oldl * (1.0 - hidamp);
rdelay[kr] = rdl = rdl * hidamp + oldr * (1.0 - hidamp);
oldl = ldl;
oldr = rdl;
if (++kl >= dl)
kl = 0;
if (++kr >= dr)
kr = 0;
rvkl = dl - kl;
rvkr = dr - kr;