Finding the lesser of two numbers


    Nov 03 2008 | 3:38 pm
    Alright, maybe I'm just making this far too difficult on myself again. I'm taking two clicks on a kslider, creating a list, and determining the number of semitones between selected notes. I now need to determine which of the two notes is lowest, and send on this MIDI number. The question sounds so easy that I'm sure the answer is easy. So, either my logic is seriously flawed in the attached patch, or I'm just creating obstacles that I shouldn't have to deal with!

    • Nov 03 2008 | 3:54 pm
      On 3 nov. 08, at 16:39, Brennon Bortz wrote:
      > > Alright, maybe I'm just making this far too difficult on myself > again. I'm taking two clicks on a kslider, creating a list, and > determining the number of semitones between selected notes. I now > need to determine which of the two notes is lowest, and send on this > MIDI number. The question sounds so easy that I'm sure the answer > is easy. So, either my logic is seriously flawed in the attached > patch, or I'm just creating obstacles that I should have to deal with!
      Hi,
      Have a look to [minimum].
      ej
    • Nov 03 2008 | 3:56 pm
      Thanks, Emmanuel. I'm surprised [minimum] isn't cross-referenced in the reference or help files for [
      Nonetheless, mine was a problem of order of operations... A couple of triggers fixed it!
    • Nov 03 2008 | 4:05 pm
      On 3 nov. 08, at 16:56, Brennon Bortz wrote:
      > Thanks, Emmanuel. I'm surprised [minimum] isn't cross-referenced in > the reference or help files for [
      Note that if you search in the documentation, minimum is pretty easy to find;-)
      > Nonetheless, mine was a problem of order of operations... A couple > of triggers fixed it!
      Here's another solution using [zl sort].
      ej
    • Nov 03 2008 | 4:28 pm
      Quote: Emmanuel Jourdan wrote on Mon, 03 November 2008 16:05 ---------------------------------------------------- > On 3 nov. 08, at 16:56, Brennon Bortz wrote:
      > Note that if you search in the documentation, minimum is pretty easy > to find;-)
      Sometimes your brain just gets stuck in a rut, though...y'know? I was searching for "less", "lesser", "lower", "less than", etc.
    • Nov 03 2008 | 4:35 pm
      I'd have gone:
      [if $f1 < $f2 then $f1 else $f2]
      That's easier to read than [zl sort] for me. But [minimum] is most beautiful...
    • Nov 03 2008 | 5:31 pm
      But then you have to compute the absolute difference to find the interval.
      ej
      On 3 nov. 08, at 17:35, Bas van der Graaff wrote:
      > > I'd have gone: > > [if $f1 < $f2 then $f1 else $f2] > > That's easier to read than [zl sort] for me. But [minimum] is most > beautiful... > -- > SmadSteck - http://www.smadsteck.nl > Hard- and software for interactive audiovisual sampling
    • Nov 03 2008 | 5:41 pm
      Quote: Bas van der Graaff wrote on Mon, 03 November 2008 16:35 ---------------------------------------------------- > I'd have gone: > > [if $f1 < $f2 then $f1 else $f2]
      Yes, I know about [if]. But, anytime a help file begins: "For those stuck in traditional programming habits...", I just feel like less of a person if I must be one of "those" people. ;)
    • Nov 03 2008 | 6:19 pm
      2008/11/3 Brennon Bortz :
      > Yes, I know about [if]. But, anytime a help file begins: "For those stuck in traditional programming habits...", I just feel like less of a person if I must be one of "those" people. ;)
      There is a reason a tradition arises - no reason to ignore it completely, IMHO.
      I use [if] all the time - particularly after counter to exit a loop - simply because it nicely handles the associated logic in one object.
    • Nov 08 2008 | 2:15 pm
      Quote: arne wrote on Mon, 03 November 2008 18:19 ----------------------------------------------------
      > There is a reason a tradition arises - no reason to ignore it completely, IMHO. > > I use [if] all the time - particularly after counter to exit a loop - > simply because it nicely handles the associated logic in one object.
      Don't get me wrong...I use if statements all the time...just not in Max. It does feel so clunky and out of place within Max, and always seems as if there's a better, more efficient way to accomplish the task at hand--whatever that may be.