[PD] help making a square wave?

David Merrill dmerrill at media.mit.edu
Fri Mar 7 18:39:23 CET 2003


Hi there -

I've been trying to make a square wave, but my pd knowledge is a little 
rusty.  I know of osc~ and phasor~ for a cosine and sawtooth wave, 
respectively, but I haven't been able to find a square-wave generator.  I 
think I ought to be able to use an osc, and just output 1 when the output 
is positive, and -1 when it's negative, but I've become hung on the 
details.  Is the following a good overview of what needs to be done?

osc~ -> snapshot~ -> moses 0 -> b (one for each moses output) -> -1.0 or 
1.0 -> sig~

It seems like using snapshot to turn every sample into a number so that 
moses can divide them around 0 is inefficient.  Is there an object that 
deals with signals that can do what moses does?  (Or just a better way to 
get a variable-frequency square-wave in general?)

much appreciated,
David Merrill
dmerrill at media.mit.edu





More information about the Pd-list mailing list