Phasor clock

ward de jager's icon

I have noticed that when using the phasor as a clocksource , it needs a negative offset befor going into the compare module and then the edge ~`
The phasor~ goes from 0 to 1 , but for some reason going into >~0 doesn't recognize the zero , which is why I need the offset .
See screnshot and patch

{
    "patcher" :     {
        "fileversion" : 1,
        "appversion" :         {
            "major" : 8,
            "minor" : 1,
            "revision" : 5,
            "architecture" : "x64",
            "modernui" : 1
        }
,
        "classnamespace" : "box",
        "rect" : [ 34.0, 77.0, 1852.0, 929.0 ],
        "bglocked" : 0,
        "openinpresentation" : 0,
        "default_fontsize" : 12.0,
        "default_fontface" : 0,
        "default_fontname" : "Arial",
        "gridonopen" : 1,
        "gridsize" : [ 15.0, 15.0 ],
        "gridsnaponopen" : 1,
        "objectsnaponopen" : 1,
        "statusbarvisible" : 2,
        "toolbarvisible" : 1,
        "lefttoolbarpinned" : 0,
        "toptoolbarpinned" : 0,
        "righttoolbarpinned" : 0,
        "bottomtoolbarpinned" : 0,
        "toolbars_unpinned_last_save" : 0,
        "tallnewobj" : 0,
        "boxanimatetime" : 200,
        "enablehscroll" : 1,
        "enablevscroll" : 1,
        "devicewidth" : 0.0,
        "description" : "",
        "digest" : "",
        "tags" : "",
        "style" : "",
        "subpatcher_template" : "",
        "assistshowspatchername" : 0,
        "boxes" : [             {
                "box" :                 {
                    "bufsize" : 42,
                    "calccount" : 13,
                    "id" : "obj-19",
                    "maxclass" : "scope~",
                    "numinlets" : 2,
                    "numoutlets" : 0,
                    "patching_rect" : [ 229.0, 670.0, 459.0, 133.0 ]
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-18",
                    "maxclass" : "number",
                    "numinlets" : 1,
                    "numoutlets" : 2,
                    "outlettype" : [ "", "bang" ],
                    "parameter_enable" : 0,
                    "patching_rect" : [ 1134.0, 579.0, 50.0, 22.0 ]
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-17",
                    "maxclass" : "number",
                    "numinlets" : 1,
                    "numoutlets" : 2,
                    "outlettype" : [ "", "bang" ],
                    "parameter_enable" : 0,
                    "patching_rect" : [ 1134.0, 549.0, 50.0, 22.0 ]
                }

            }
,             {
                "box" :                 {
                    "bufsize" : 42,
                    "calccount" : 13,
                    "id" : "obj-14",
                    "maxclass" : "scope~",
                    "numinlets" : 2,
                    "numoutlets" : 0,
                    "patching_rect" : [ 694.0, 670.0, 459.0, 133.0 ]
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-13",
                    "maxclass" : "newobj",
                    "numinlets" : 2,
                    "numoutlets" : 1,
                    "outlettype" : [ "signal" ],
                    "patching_rect" : [ 694.0, 324.0, 40.0, 22.0 ],
                    "text" : "-~ 0.5"
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-9",
                    "maxclass" : "newobj",
                    "numinlets" : 2,
                    "numoutlets" : 1,
                    "outlettype" : [ "signal" ],
                    "patching_rect" : [ 694.0, 369.0, 36.0, 22.0 ],
                    "text" : ">~ 0."
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-10",
                    "maxclass" : "newobj",
                    "numinlets" : 1,
                    "numoutlets" : 2,
                    "outlettype" : [ "bang", "bang" ],
                    "patching_rect" : [ 694.0, 438.0, 42.0, 22.0 ],
                    "text" : "edge~"
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-12",
                    "maxclass" : "newobj",
                    "numinlets" : 2,
                    "numoutlets" : 1,
                    "outlettype" : [ "signal" ],
                    "patching_rect" : [ 691.0, 279.0, 52.0, 22.0 ],
                    "text" : "phasor~"
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-8",
                    "maxclass" : "button",
                    "numinlets" : 1,
                    "numoutlets" : 1,
                    "outlettype" : [ "bang" ],
                    "parameter_enable" : 0,
                    "patching_rect" : [ 694.0, 498.0, 68.0, 68.0 ]
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-7",
                    "maxclass" : "button",
                    "numinlets" : 1,
                    "numoutlets" : 1,
                    "outlettype" : [ "bang" ],
                    "parameter_enable" : 0,
                    "patching_rect" : [ 496.0, 498.0, 68.0, 68.0 ]
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-5",
                    "maxclass" : "newobj",
                    "numinlets" : 2,
                    "numoutlets" : 1,
                    "outlettype" : [ "signal" ],
                    "patching_rect" : [ 496.0, 364.0, 36.0, 22.0 ],
                    "text" : ">~ 0."
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-4",
                    "maxclass" : "newobj",
                    "numinlets" : 1,
                    "numoutlets" : 2,
                    "outlettype" : [ "bang", "bang" ],
                    "patching_rect" : [ 496.0, 417.0, 42.0, 22.0 ],
                    "text" : "edge~"
                }

            }
,             {
                "box" :                 {
                    "format" : 6,
                    "id" : "obj-3",
                    "maxclass" : "flonum",
                    "numinlets" : 1,
                    "numoutlets" : 2,
                    "outlettype" : [ "", "bang" ],
                    "parameter_enable" : 0,
                    "patching_rect" : [ 603.0, 169.0, 50.0, 22.0 ]
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-1",
                    "maxclass" : "newobj",
                    "numinlets" : 2,
                    "numoutlets" : 1,
                    "outlettype" : [ "signal" ],
                    "patching_rect" : [ 499.0, 279.0, 52.0, 22.0 ],
                    "text" : "phasor~"
                }

            }
],
        "lines" : [             {
                "patchline" :                 {
                    "destination" : [ "obj-19", 0 ],
                    "order" : 1,
                    "source" : [ "obj-1", 0 ]
                }

            }
,             {
                "patchline" :                 {
                    "destination" : [ "obj-5", 0 ],
                    "order" : 0,
                    "source" : [ "obj-1", 0 ]
                }

            }
,             {
                "patchline" :                 {
                    "destination" : [ "obj-8", 0 ],
                    "source" : [ "obj-10", 0 ]
                }

            }
,             {
                "patchline" :                 {
                    "dest

ward de jager's icon

{
    "patcher" :     {
        "fileversion" : 1,
        "appversion" :         {
            "major" : 8,
            "minor" : 1,
            "revision" : 5,
            "architecture" : "x64",
            "modernui" : 1
        }
,
        "classnamespace" : "box",
        "rect" : [ 34.0, 77.0, 1852.0, 929.0 ],
        "bglocked" : 0,
        "openinpresentation" : 0,
        "default_fontsize" : 12.0,
        "default_fontface" : 0,
        "default_fontname" : "Arial",
        "gridonopen" : 1,
        "gridsize" : [ 15.0, 15.0 ],
        "gridsnaponopen" : 1,
        "objectsnaponopen" : 1,
        "statusbarvisible" : 2,
        "toolbarvisible" : 1,
        "lefttoolbarpinned" : 0,
        "toptoolbarpinned" : 0,
        "righttoolbarpinned" : 0,
        "bottomtoolbarpinned" : 0,
        "toolbars_unpinned_last_save" : 0,
        "tallnewobj" : 0,
        "boxanimatetime" : 200,
        "enablehscroll" : 1,
        "enablevscroll" : 1,
        "devicewidth" : 0.0,
        "description" : "",
        "digest" : "",
        "tags" : "",
        "style" : "",
        "subpatcher_template" : "",
        "assistshowspatchername" : 0,
        "boxes" : [             {
                "box" :                 {
                    "bufsize" : 42,
                    "calccount" : 13,
                    "id" : "obj-19",
                    "maxclass" : "scope~",
                    "numinlets" : 2,
                    "numoutlets" : 0,
                    "patching_rect" : [ 229.0, 670.0, 459.0, 133.0 ]
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-18",
                    "maxclass" : "number",
                    "numinlets" : 1,
                    "numoutlets" : 2,
                    "outlettype" : [ "", "bang" ],
                    "parameter_enable" : 0,
                    "patching_rect" : [ 1134.0, 579.0, 50.0, 22.0 ]
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-17",
                    "maxclass" : "number",
                    "numinlets" : 1,
                    "numoutlets" : 2,
                    "outlettype" : [ "", "bang" ],
                    "parameter_enable" : 0,
                    "patching_rect" : [ 1134.0, 549.0, 50.0, 22.0 ]
                }

            }
,             {
                "box" :                 {
                    "bufsize" : 42,
                    "calccount" : 13,
                    "id" : "obj-14",
                    "maxclass" : "scope~",
                    "numinlets" : 2,
                    "numoutlets" : 0,
                    "patching_rect" : [ 694.0, 670.0, 459.0, 133.0 ]
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-13",
                    "maxclass" : "newobj",
                    "numinlets" : 2,
                    "numoutlets" : 1,
                    "outlettype" : [ "signal" ],
                    "patching_rect" : [ 694.0, 324.0, 40.0, 22.0 ],
                    "text" : "-~ 0.5"
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-9",
                    "maxclass" : "newobj",
                    "numinlets" : 2,
                    "numoutlets" : 1,
                    "outlettype" : [ "signal" ],
                    "patching_rect" : [ 694.0, 369.0, 36.0, 22.0 ],
                    "text" : ">~ 0."
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-10",
                    "maxclass" : "newobj",
                    "numinlets" : 1,
                    "numoutlets" : 2,
                    "outlettype" : [ "bang", "bang" ],
                    "patching_rect" : [ 694.0, 438.0, 42.0, 22.0 ],
                    "text" : "edge~"
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-12",
                    "maxclass" : "newobj",
                    "numinlets" : 2,
                    "numoutlets" : 1,
                    "outlettype" : [ "signal" ],
                    "patching_rect" : [ 691.0, 279.0, 52.0, 22.0 ],
                    "text" : "phasor~"
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-8",
                    "maxclass" : "button",
                    "numinlets" : 1,
                    "numoutlets" : 1,
                    "outlettype" : [ "bang" ],
                    "parameter_enable" : 0,
                    "patching_rect" : [ 694.0, 498.0, 68.0, 68.0 ]
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-7",
                    "maxclass" : "button",
                    "numinlets" : 1,
                    "numoutlets" : 1,
                    "outlettype" : [ "bang" ],
                    "parameter_enable" : 0,
                    "patching_rect" : [ 496.0, 498.0, 68.0, 68.0 ]
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-5",
                    "maxclass" : "newobj",
                    "numinlets" : 2,
                    "numoutlets" : 1,
                    "outlettype" : [ "signal" ],
                    "patching_rect" : [ 496.0, 364.0, 36.0, 22.0 ],
                    "text" : ">~ 0."
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-4",
                    "maxclass" : "newobj",
                    "numinlets" : 1,
                    "numoutlets" : 2,
                    "outlettype" : [ "bang", "bang" ],
                    "patching_rect" : [ 496.0, 417.0, 42.0, 22.0 ],
                    "text" : "edge~"
                }

            }
,             {
                "box" :                 {
                    "format" : 6,
                    "id" : "obj-3",
                    "maxclass" : "flonum",
                    "numinlets" : 1,
                    "numoutlets" : 2,
                    "outlettype" : [ "", "bang" ],
                    "parameter_enable" : 0,
                    "patching_rect" : [ 603.0, 169.0, 50.0, 22.0 ]
                }

            }
,             {
                "box" :                 {
                    "id" : "obj-1",
                    "maxclass" : "newobj",
                    "numinlets" : 2,
                    "numoutlets" : 1,
                    "outlettype" : [ "signal" ],
                    "patching_rect" : [ 499.0, 279.0, 52.0, 22.0 ],
                    "text" : "phasor~"
                }

            }
],
        "lines" : [             {
                "patchline" :                 {
                    "destination" : [ "obj-19", 0 ],
                    "order" : 1,
                    "source" : [ "obj-1", 0 ]
                }

            }
,             {
                "patchline" :                 {
                    "destination" : [ "obj-5", 0 ],
                    "order" : 0,
                    "source" : [ "obj-1", 0 ]
                }

            }
,             {
                "patchline" :                 {
                    "destination" : [ "obj-8", 0 ],
                    "source" : [ "obj-10", 0 ]
                }

            }
,             {
                "patchline" :                 {
                    "dest

phasor clock.maxpat
Max Patch
Chris Rolfe's icon

@ward

Please post compressed patchers. They're easier to open.

https://cycling74.com/forums/how-to-post-patches-to-the-forum/

Roman Thilenius's icon


why this works for click~ but not for phasor~ is one of the biggest mysteries in MSP world.

however, you can reach what you want by using an offset:

[phasor~ 1.]
[+~ 0.1]
[>~ 0.1]
[edge~]


now both(!) outputs of edge report a transition :)

Roman Thilenius's icon


the interesting thing is that using [==~ 0.] or [==~ 1.] also wont work, where [==~ 0.5] does. think about that.

but it is even more strange:

if you connect a click~ to edge~ you can convert a trigger to a bang just as expected.

and if you convert phase to trigger using

[delta~]
[!-~ 0.]

you get a proper click - which works for driving a sah~ in order to control another phasor~, just as with the click~ object.

but if you combine the two and do

[phasor~]
[delta~]
[!-~ 0.]
[edge~]


it still doesnt work.

:)



Chris Rolfe's icon

@roman

Is it so strange? Phasor may not or (likely) won't hit zero or one. Between floating point precision and 1/frequency, it moves from .995 to 0.0012 or something. You thus cannot catch the edge with ==~ 0 or ==~ 1.

Delta~ works.

Or maybe <~ epsilon, epsilon equals something like 1/512, depending what precision tick you need.

Roman Thilenius's icon


that´s right, you could use minor shift for the >, which is small enough not to cause a delay for some 1 ms (scheduler rate, edge isnt more accurate) - and then you dont need the + offset.

or you could use line~ instead of phasor~ :D

Roman Thilenius's icon


oh btw.

"Between floating point precision and 1/frequency, it moves from .995 to 0.0012 or something"

it actually starts at 0. and that is enough to get a signal which allows to detect "nonzero to zero" transitions.

that is why [+~ 0.1] [>~ 0.1] works.

the issue @ward ist seeing is something else: edge~ (and zerox~ for that matter) might output at scheduler rate, but of course poll values from audio only once per vector.


ward de jager's icon

Thank for the answers guys , really helpfull and sorry for the code text pollution .