[PD-dev] Creating an external / sinewave equation example

Martin Peach martin.peach at sympatico.ca
Mon Sep 5 00:13:55 CEST 2011


On 2011-09-04 16:52, Rick T wrote:
...

> I've been able to find instructions on how to create a hello world
> C-external but not one that creates a simple sine wave from a sinewave
> equation like A*sin(w*t+p)
> (https://secure.wikimedia.org/wikipedia/en/wiki/Sine_wave) Does anyone
> have one or know where to find one.

The canonical reference is here:
http://iem.at/pd/externals-HOWTO/node6.html
You just need to plug your equation into the perform routine.
Also check the source for osc~ in d_osc.c of the Pd source, which uses a 
fancy 32-bit float cosine table scanning method that was useful when it 
mattered but is getting obsolete as a call to sin() is probably just as 
fast nowadays.

Martin



More information about the Pd-dev mailing list