Alternative to buddy?

toby lee's icon

Hi all,

Is there an object like buddy that outputs a bang when a bang has been received in every input, but only does so when received at the same time? I know a bang doesn't actually have a duration so they can't be received at the same time, so I've created a system where each input bang turns a toggle on and off again quickly using the delay object. I'm just wondering if there's a simpler or better way to do this?

buddy alternative.maxpat
Max Patch

kcoul's icon

" a bang doesn't actually have a duration so they can't be received at the same time "

That doesn't really make sense! A bang's time of arrival could be measured so the time delta of two received bangs could certainly be measured, and this is what you'll need to do. By "at the same time", you'll have to decide what is close enough. Is it the threshold of hearing two distinct sounds? (Roughly 50ms) Is it tighter than that, or looser?

You'll also have to decide your approach to timing the deltas between bangs. The simplest approach is probably just to measure deltas between all consecutive bangs regardless of where they came from. For that, [timer] should work:

But maybe you have some additional rules, like maybe the two bangs have to come from different places, in which case you might have to work on combining it with something like [onebang], which cares about which inlet the bangs are sent to:

https://docs.cycling74.com/max5/refpages/max-ref/onebang.html

Hope this helps.

Source Audio's icon

try this method

Max Patch
Copy patch and select New From Clipboard in Max.

toby lee's icon

Came across this solution from the patch posted above - cheers for your help guys

{
    "boxes" : [         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "t 0",
                "outlettype" : [ "int" ],
                "patching_rect" : [ 532.375, 428.0, 24.0, 22.0 ],
                "numinlets" : 1,
                "id" : "obj-1",
                "numoutlets" : 1,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "delay 100",
                "outlettype" : [ "bang" ],
                "patching_rect" : [ 532.375, 387.0, 63.0, 22.0 ],
                "numinlets" : 2,
                "id" : "obj-13",
                "numoutlets" : 1,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "+",
                "outlettype" : [ "int" ],
                "patching_rect" : [ 458.875, 511.0, 29.5, 22.0 ],
                "numinlets" : 2,
                "id" : "obj-50",
                "numoutlets" : 1,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "+",
                "outlettype" : [ "int" ],
                "patching_rect" : [ 426.875, 463.0, 29.5, 22.0 ],
                "numinlets" : 2,
                "id" : "obj-49",
                "numoutlets" : 1,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "if $i1 > 2 then out1 else out2",
                "outlettype" : [ "", "" ],
                "patching_rect" : [ 458.875, 589.0, 162.0, 22.0 ],
                "numinlets" : 1,
                "id" : "obj-41",
                "numoutlets" : 2,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "button",
                "outlettype" : [ "bang" ],
                "patching_rect" : [ 490.875, 387.0, 24.0, 24.0 ],
                "numinlets" : 1,
                "id" : "obj-28",
                "numoutlets" : 1,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "button",
                "outlettype" : [ "bang" ],
                "patching_rect" : [ 458.875, 387.0, 24.0, 24.0 ],
                "numinlets" : 1,
                "id" : "obj-27",
                "numoutlets" : 1,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "button",
                "outlettype" : [ "bang" ],
                "patching_rect" : [ 426.875, 387.0, 24.0, 24.0 ],
                "numinlets" : 1,
                "id" : "obj-23",
                "numoutlets" : 1,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "thresh 5",
                "fontsize" : 12.0,
                "outlettype" : [ "" ],
                "patching_rect" : [ 458.875, 551.0, 54.0, 22.0 ],
                "fontname" : "Arial",
                "numinlets" : 2,
                "id" : "obj-11",
                "numoutlets" : 1,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "t 1",
                "fontsize" : 12.0,
                "outlettype" : [ "int" ],
                "patching_rect" : [ 490.875, 428.0, 24.0, 22.0 ],
                "fontname" : "Arial",
                "numinlets" : 1,
                "id" : "obj-2",
                "numoutlets" : 1,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "t 1",
                "fontsize" : 12.0,
                "outlettype" : [ "int" ],
                "patching_rect" : [ 458.875, 428.0, 24.0, 22.0 ],
                "fontname" : "Arial",
                "numinlets" : 1,
                "id" : "obj-5",
                "numoutlets" : 1,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "t 1",
                "fontsize" : 12.0,
                "outlettype" : [ "int" ],
                "patching_rect" : [ 426.875, 428.0, 24.0, 22.0 ],
                "fontname" : "Arial",
                "numinlets" : 1,
                "id" : "obj-12",
                "numoutlets" : 1,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "s button 2 volume",
                "patching_rect" : [ 524.0, 709.0, 105.0, 22.0 ],
                "numinlets" : 1,
                "id" : "obj-122",
                "numoutlets" : 0,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "comment",
                "text" : "button 2",
                "patching_rect" : [ 379.125, 644.0, 59.0, 20.0 ],
                "numinlets" : 1,
                "id" : "obj-149",
                "numoutlets" : 0,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "button",
                "outlettype" : [ "bang" ],
                "patching_rect" : [ 458.875, 642.0, 24.0, 24.0 ],
                "numinlets" : 1,
                "id" : "obj-79",
                "numoutlets" : 1,
                "style" : ""
            }

        }
,         {
            "box" :             {
                "maxclass" : "outlet",
                "patching_rect" : [ 458.875, 722.0, 30.0, 30.0 ],
                "numinlets" : 1,
                "id" : "obj-179",
                "numoutlets" : 0,
                "style" : "",
                "comment" : "",
                "index" : 1
            }

        }
],
    "lines" : [         {
            "patchline" :             {
                "source" : [ "obj-79", 0 ],
                "destination" : [ "obj-179", 0 ],
                "midpoints" : [ 468.375, 669.0, 468.375, 669.0 ],
                "order" : 1
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-79", 0 ],
                "destination" : [ "obj-122", 0 ],
                "midpoints" : [ 468.375, 678.0, 498.0, 678.0, 498.0, 678.0, 533.5, 678.0 ],
                "order" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-50", 0 ],
                "destination" : [ "obj-11", 0 ]
            }

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

        }
,         {
            "patchline" :             {
                "source" : [ "obj-49", 0 ],
                "destination" : [ "obj-50", 0 ]
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-41", 0 ],
                "destination" : [ "obj-79", 0 ]
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-28", 0 ],
                "destination" : [ "obj-2", 0 ]
            }

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

        }
,         {
            "patchline" :             {
                "source" : [ "obj-23", 0 ],
                "destination" : [ "obj-12", 0 ]
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-2", 0 ],
                "destination" : [ "obj-50", 1 ]
            }

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

        }
,         {
            "patchline" :             {
                "source" : [ "obj-12", 0 ],
                "destination" : [ "obj-49", 0 ]
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-11", 0 ],
                "destination" : [ "obj-41", 0 ]
            }

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

        }
],
    "appversion" :     {
        "major" : 7,
        "minor" : 3,
        "revision" : 4,
        "architecture" : "x86",
        "modernui" : 1
    }

}