# [PD] osc~'s phase / second inlet

Frank Barknecht fbar at footils.org
Tue Feb 6 23:21:40 CET 2007

```Hallo,
Steffen hat gesagt: // Steffen wrote:

> I can't figure how the second inlet of osc~ work. As a test i tried
> to sum and subtract two osc~'s with the same frequency. If i send 0
> to the second inlet of the two osc~ objects, the difference is 0 -
> which is what i though would happen. But how do i make the sum 0 -
> ie. make them completely out of phase?

Multiply on [osc~] by -1? ;)

Just joking, that is not what you mean by your question, I suppose.

> I've tried different things. For example I've tried to delay the
> reset of the one osc~ while "immediately" resetting the other - by
> resetting i mean sending 0 to the second inlet - assuming one can
> only reset the phase. Another thing i've tried is to set them at the
> same time by sending 0 to one of them and different numbers to the
> other - assuming it would behave kind of like sin(f*x+0)+sin(f*x+a)
> where a is the other number.

The correct way would be to set one [osc~]'s phase to 0 and the other
to 0.5 at the same time. The audio objects in (core) Pd like [osc~],
[cos~] or [phasor~] assume a complete cycle to be of length 1, so
setting the phase of one object to 0, and the other to 1/2 == 0.5 will
set them to opposite phases.

See attached patch.

I guess they assume a cycle to be of length 1 and not of length 2*PI
or so to appeal the non-mathletes and to make things like
phase-modulation a bit easier, though you can only really modulate the
phase of a [cos~] with an audio signal.

One additional thing to be aware of is, that the right inlet of [osc~]
only is activated at block boundaries. That is, if you send any value
to the right inlet, it will set the phase to that value only at the
end of a block of normally 64 samples, unless you've reblocked your
patch with [block~ ...] This is valid for manually triggered
phase-changes and for "clock-delayed" triggering through a [metro] or
a [delay].

Ciao
--
Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
#N canvas 222 126 708 644 10;
#X obj 185 191 osc~ 440;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \\$0-osc 256 float 2;
#X coords 0 1 256 -1 200 140 1;
#X restore 333 104 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \\$0-phs 256 float 2;
#X coords 0 1 256 -1 200 140 1;
#X restore 333 269 graph;
#X obj 185 235 tabwrite~ \\$0-osc;
#X obj 194 348 tabwrite~ \\$0-phs;
#X msg 49 111 bang;
#X obj 195 315 osc~ 440;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \\$0-diff 256 float 2;
#X coords 0 1 256 -1 200 140 1;
#X restore 333 430 graph;
#X obj 129 481 tabwrite~ \\$0-diff;
#X obj 129 426 +~;
#X obj 246 286 f 0.5;
#X obj 236 158 f 0;
#X floatatom 252 137 5 0 0 0 - - -;
#X floatatom 276 268 5 0 0 0 - - -;
#X connect 0 0 3 0;
#X connect 0 0 9 0;
#X connect 5 0 3 0;
#X connect 5 0 4 0;
#X connect 5 0 8 0;
#X connect 5 0 11 0;
#X connect 5 0 10 0;
#X connect 6 0 4 0;
#X connect 6 0 9 1;
#X connect 9 0 8 0;
#X connect 10 0 6 1;
#X connect 11 0 0 1;
#X connect 12 0 11 1;
#X connect 13 0 10 1;
```