testing range for two variables

    Jul 20 2011 | 7:22 pm
    Hello all,
    a friend of mine asked if max could do 'mouse over' style effects, as in if the mouse is over a specified portion of the screen, either bang to trigger a one off sound, or output a 1/0 to start/end a sound.
    I've made some basic mouse stuff to control pitch/amplitude (x, y), sort of theremin-ish, but I'm not sure how to solve this problem. I guess I'd want to make an abstraction that would accept two ranges (x,y), and if the position of the mouse is within both of those ranges at once, output 1.
    I am familiar with a lot of max/msp objects, but not jitter or java. I thought of combining some = objects, but that seems rather inelegant. I'm sure [if] would do it, ($1 and $2) being (x, y) mouse position, and ($3 and $4, $5 and $6) being testing range, but I'm not sure of the syntax.
    One big problem I've foreseen is that mousestate is absolute, not relative to the patcher window, so that target area will respond differently based on the patchers position on the screen, as well as the screen resolution. I figure this can be fixed by reporting the patcher size, screen resolution, and adjusting the ranges accordingly, or by making the patcher full screen via this patcher and scripting. This seems cumbersome, though.
    I'm sure there are a lot of ways to use something like this, especially if the abstraction could be put into a poly~ with different ranges triggering different samples/synths, but I'm stuck here.
    Any ideas?

    • Jul 20 2011 | 9:10 pm
      See the help files for [split] and [hover]... They will give you something to chew over...
    • Jul 20 2011 | 9:59 pm
      Something to chew over indeed! Thanks Steve!
    • Jul 21 2011 | 3:16 am
      I'll be using the hover method for some other things in my main patch...but here's the first method that popped out...
      I'll be making an abstraction/poly~ out of it once I hook it up to some real synths, but this is the basic framework. Thanks again for the help.
    • Jul 21 2011 | 4:51 am
      Here's the quick and dirty trackpad theremin...
      Featuring the ability to:
      -swap x and y values
      -accordingly scale all integers to floats between zero and one
      -invert the orientation of the minimum and maximum values
      -scale to any ratio (midi note range/amplitude/etc.)
      -round to nearest integer post-rescaling/or maintain floating point for 'fretless mode'
      -raise or lower minimum height
      -easily adapted for any other scaled x, y pad controller
      See what you can make of it, if it's any use :)
    • Jul 21 2011 | 7:59 am
      Pretty good start so far. I wonder if there's a way for Max to report touch-pad pressure, to give another axis of control?
      Another control source could be to use the delta-x delta-y outputs of [mousestate] to clock the time it's taken the mouse to move or trigger the start of a move - that could be used to trigger envelopes and things...
    • Jul 21 2011 | 9:17 am
      Touchpad of whatever sort would be possible if Max can get the data, maybe through [serial] or [hi]. Some MIDI pads will simply report as velocity, so that's easy with [notein], though most of these don't report X and Y location.
      You might also have use for [ubutton], which can do some fancy tricks. And check out the subpatchers in [mousestate] if you haven't, there are "mode" messages which were made for dealing with screen size vs. patcher size etc...
      Cool project, keep it up!
    • Jul 21 2011 | 4:40 pm
      I kept hacking away at it before bed...I'll be adapting it for my 'harp style' synth, to morph this rather chaotic input for diatonic output (and sequenced modulation). Also working on the envelope idea, custom wave synths, tremolos, autowahs, etc. Going to be hard to share some things, as I keep pretty much everything in one giant monster patch. I'll be sure to stick it up here if it'll be handy.