[PD] importing / using large equation into expr command

Andy Farnell padawan12 at obiwannabe.co.uk
Sun Sep 4 18:34:38 CEST 2011


Hi Rick,

As per the olde Dorset saying, to strangers seeking directions...

"You dont want to go from here"

Looks like a mistake of exchanging computational space
for data space. In other words, probably the program used to 
generate this text file file is closer to what you actually 
should do (some kind of convolution is it?)

You have a sum of some amplitude offset, times some tabulated value, times
alternately sin or cos terms, times some ratios of the sample number.

Only the table values really need dealing with.

modulo two will give you either 0 or 1 to determine whether to 
choose sin() or cos(), or better, multiply that by pi/2
and incorporate it into the trig term as cos(x) = sin(pi/2 -x)

The sample number is an int that keeps increasing by one and
everything else is constant.

[until] can be used to construct an iteration, and an integration
(running sum) can be done using the accumulator idiom.



On Sun, 4 Sep 2011 11:35:39 -0400
Hans-Christoph Steiner <hans at at.or.at> wrote:

> 
> A .pd file is a text file, so you can just open your Pd patch in a  
> text editor, and paste in the equation.  But honestly with something  
> that big, I think making a C external might be easier in the long run.
> 
> .hc
> 
> On Sep 4, 2011, at 9:22 AM, Rick T wrote:
> 
> > Greetings All
> >
> > I have 2 large equations that I would like to use with the expr  
> > command.  Is it possible to import a text file into the expr command?
> > Here's an example of 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
> >
> > I do have the ability to create a wave (audio) file of the equation  
> > first and import the wave file into PureDate, but will I have the  
> > same control over the frequency,amplitude,phase and vertical offset  
> > that the equation gives me?.
> >
> > If you want to know what I'm creating.
> > 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 know Puredata can do this very well with small equations and the  
> > expr command but using large equations I'm not sure.  Also if I  
> > should be doing this in a different way please let me know I'm  
> > always willing to learn something new.
> >
> > Thanks
> > -- 
> >
> > _______________________________________________
> > Pd-list at iem.at mailing list
> > UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
> 
> 
> 
> ----------------------------------------------------------------------------
> 
> If nature has made any one thing less susceptible than all others of  
> exclusive property, it is the action of the thinking power called an  
> idea, which an individual may exclusively possess as long as he keeps  
> it to himself; but the moment it is divulged, it forces itself into  
> the possession of everyone, and the receiver cannot dispossess himself  
> of it.            - Thomas Jefferson
> 
> 


-- 
Andy Farnell <padawan12 at obiwannabe.co.uk>



More information about the Pd-list mailing list