[PD] setting variables within an if condition in [expr] or [fexpr~]

Peter Worth peterworth at gmail.com
Mon Apr 3 19:24:09 CEST 2006


On 4/3/06, Georg Holzmann <grhPD at gmx.at> wrote:
> Hallo!
>
> hm ... could you describe the algorithm you want to implement a little
> bit more?
> If you want to do sample by sample processing fexpr~ is usually a little
> bit slow ... (at least in my experiments)

Hi,
it seems very simple what i'm trying to do (if i was programming it in
C it would be fairly trivial), so its suprising how difficult its
turning out to be...
basically, i want to make an abstraction which has a signal input, and
a signal output (which is initially silence regardless of input
signal). when it recieves a bang (in a different inlet maybe) it
should wait for the next zero-crossing in the input signal, then let
the signal through for a specified number of zero-crossings (lets say
20) then it turns off again on the 20th zero-crossing.

so far i've got a signal which is 1 when there is a zero crossing and
0 otherwise (attached), i just need to use this to switch on the
output when the first 1 arrives at a point after there is a bang or a
1 to signal that we want output to turn on.

hope that makes sense...

> > so i'm guessing i need to use a variable or [value]. but can i set
> > this within an fexpr~ object, and will it update fast enough (if it
> > takes a block to update then its no good).
> as messages are calculate once per block I think that's not possible ...

i see.. so to do things sample by sample, everything has to be
signals? no control values. thats what makes this tricky i guess.

thanks very much for your help!

pete.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zerocrossinggate.pd
Type: application/octet-stream
Size: 7388 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20060403/03f2cb35/attachment.obj>


More information about the Pd-list mailing list