I have 2 large equations that I would like to create an external for. One of the 2 equations http://dl.dropbox.com/u/6576402/questions/eq1.txt Basically it's a 1 second periodic signal with sample rate at 44100 which the equation gives me control over the frequency,amplitude,phase and vertical offset
So my logic is to have 4 inlets for the frequency,amplitude,phase and vertical offset and an output for the signal.
If you want to know what type of PD I'm creating and it's options. 1) The first option will import a text file into a table/array that will control the variables of the equations that will vary frequency,amplitude,phase and vertical offset over time. 2) The second option will allow the variables to be controllable/variable using a midi controller and it's audio signal played
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. It makes sense to make a C external and create inputs for the values of frequency,amplitude,phase and vertical offset. That way I can cleanly feed/control those values with a midi controller or a table/array in PureData.
Thanks
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
Greetings All
I'm having trouble getting my external to work, It compiles with 5 warnings sineq.c:48: warning: unused variable ‘x’ sineq.c:49: warning: unused variable ‘in1’ sineq.c:50: warning: unused variable ‘in2’ sineq.c:51: warning: unused variable ‘in3’ sineq.c:52: warning: unused variable ‘in4’
It does a "make" successfully but I get this warning message /usr/bin/ld: warning: cannot find entry symbol xport_dynamic; defaulting to 00000000000007f0
but when I try and add it in PD it says "couldn't create". I've looked at the pan~ tutorial and the d_osc.c file as recommended, which did help. I tried to take pieces from the two which I thought were applicable to my situation but I'm still having some issues.
Here's a link to the workflow (dropbox) http://dl.dropbox.com/u/6576402/questions/pd/Sine_EQ_Diagram.jpg
Here's a link to the C code online (pastebin) http://pastebin.com/9rK3szUE
My external is a reproduction of the sinewave equation with 4 inputs and one output my logic is to have 4 inlets one for the frequency,amplitude,phase and vertical offset and an output for the created signal. Granted this isn't the final equation but this will help me understand how to create the full equation once done. If you want to see the full equation I'll be using here's a link to it below. Basically it's a 1 second periodic signal with the sample rate at 44100 which the equation gives me control over the frequency,amplitude,phase and vertical offset, which will be controlled by a usb midi controller.
Another question I have is what do I use for the t (time) for my final equation is that the t_sample object in PD? or do I need to create a for loop counting from 1-44100 for a 1 second 44100 sampled equation?
http://dl.dropbox.com/u/6576402/questions/eq1.txt
PS: I'm compiling on ubuntu 10.04 using gcc
On Sun, Sep 4, 2011 at 12:13 PM, Martin Peach martin.peach@sympatico.cawrote:
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_wavehttps://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.htmlhttp://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