# [PD] wave morphing

Roman Haefeli reduzierer at yahoo.de
Mon Jan 15 11:49:28 CET 2007

```On Mon, 2007-01-15 at 05:51 +0000, Claude Heiland-Allen wrote:
> Roman Haefeli wrote:
> > On Sun, 2007-01-14 at 15:01 +0000, Claude Heiland-Allen wrote:
> >> When writing it I found a bug in wrap~ in pd-0.40-2 from Miller's site:
> >>
> >> sig~ 1
> >> wrap~
> >> print~
> >> -> 0
> >
> > as i would expect.
> >
> >> sig~ 0
> >> wrap~
> >> print~
> >> -> 1
> >
> > as i would expect, as well. where is the bug? am i missing something?
>
> wrap~-help says:
>
> ----8<----
> wrap~ gives the difference between the input and the
> largest integer not exceeding it (for positive numbers this
> is the fractional part).
> ----8<----
>
> largest integer not exceeding 0 is 0, or?
>
> largest integer not exceeding X is X when X is an integer, or?

exactly, and since [wrap~] gives you the difference between the largest
integer not exceeding X and X, it will always give you 0, when X is an
integer. the output of [wrap~] is always => 0 and < 1.

>
> it makes life simpler when
>
> (x - (wrap~ x)) == x
>
> when x is an integer, as there is no [int~] in Pd.

i can't quite follow, what you mean hear. you CAN use [wrap~] to build
your own [int~] (see attached patch).

roman
-------------- next part --------------
#N canvas 754 157 222 270 10;
#X obj 58 138 wrap~;
#X obj 42 51 sig~;
#X obj 41 164 -~;
#X obj 41 197 avg~;
#X floatatom 41 219 5 0 0 0 - - -;
#X floatatom 42 25 5 0 0 0 - - -;
#X connect 0 0 2 1;
#X connect 1 0 0 0;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 5 0 1 0;
```