[PD] phasor to square

Derek Holzer derek at umatic.nl
Sun Jan 20 14:18:37 CET 2008

```Hi Raul,

you will want to investigate the binary operations and mathematical
operations for signals. In this case, you want to know when the
[phasor~] reaches 1:

[==~]

and this will output a signal of 1 (= HIGH), otherwise a zero (= LOW).
You can use [snapshot~] to covert this to a float. [avg~] is supposed to
do this as well, but it doesn't do anything on my OSX  PD Extended-0.39
installation.

Thomas Mayer's squarewave converter that he posted using [>~ 0.5] and
[-~ 0.5] is a similar idea, giving you also HIGH and LOW values, but you
might still need to convert to float for the next part.

Once the result of you binary operation is a float, you can use a
counter-like structure to count the HI levels, and some other math
operations to count (alternately 1,2 and 1). I don't have time to patch
the whole thing myself, but hopefully you will see what I mean.

best,
d.

raul diaz wrote:
> Hi list!
>
> I need to convert a phasor into a square wave in this way:
>
> phasor:
>
>       /       /      /       /       /      /
>     /  |    /  |    /  |    /  |    /  |    /  |
>   /    |  /    |  /    |  /    |  /    |  /    |
> /      |/      |/      |/      |/      |/      |
>
> square (2:1):
> ________        _________        _
> |              |       |              |       |
> |              |       |              |       |
> |              |____|              |____|
>
>
> so, a relation HIGH:LOW holds a high or a low value (1 or 0) a indicate
> number of cycles.
> I need this conversion in order to make a masking, so square doesn't
> have to be an audio signal necessarily (could be a number upload each
> phasor cycle).
>
> What could be the best implementation for that scheme?
>
> Saludos!
>
> --
> Raul Diaz Poblete
> *************************
> raul.lete at gmail.com <mailto:raul.lete at gmail.com>
> Barcelona [Spain]
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list

--
derek holzer ::: http://www.umatic.nl ::: http://blog.myspace.com/macumbista
---Oblique Strategy # 165:
"Use an old idea"

```