[PD] Csound opcode Moogladder to Pd?
Martin Peach
martin.peach at sympatico.ca
Wed Aug 27 15:11:30 CEST 2008
Anton Hörnquist wrote:
>> Here is a dll of Frank's moogladder~ v.02 compiled against pd 0.40_2
>> The code should go in svn somewhere.
>> ( I replaced 2*M_PI in the code with TWO_PI to avoid a multiply
>> (compiler optimisation maybe does that already)).
>
> Thanks, Martin!
>
> Out of curiosity - what compiler did you use? I've never compiled
> externals on win xp but would like to learn how. Is it possible to use
> the free version of MS Developer Studio? Other alternatives?
Yes I used the free VisualC++ 2005 Express Edition. I use pd.lib from
Miller's pd, to link against when building an external as a dll. The
setup function is the only symbol that needs to be exported..
You can also do it using MinGW (pd-extended is built that way) but I
haven't yet found the patience to jump through all the hoops to get it
working. Cygwin's gcc should work as well for externals.
>
> I'd like to try to make a stereo version of moogladder~ and also try
> tanh optimizations to reduce the cpu load.
I'm not sure tanh can be optimized much more. If your CPU has a floating
point unit built in, which they all do nowadays, that ought to be the
fastest way to calculate it apart from having a huge lookup table.
If tanh(x) = (e^x - (1/e^x)) / (e^x + (1/e^x)) the e^x only needs to be
calculated once, a = e^x, then b = 1/(e^x), then tanh = (a-b)/(a+b).
I would imagine that the FPU already does it that way but I don't know.
Probably it could be approximated faster, but isn't the idea to have the
most accurate value?
Martin
More information about the Pd-list
mailing list