key combinations


    May 04 2006 | 6:05 pm
    hi guys,
    i'm trying to get a bang only if a particular key combination is pressed simultaneously on the computer keyboard...
    i'm using the 2 "key" objects and a select after each one...
    how can i generate a bang only if the 2 select bangs happens toghether?
    thanx
    lalo

    • May 04 2006 | 8:14 pm
      I'm a noob, so this might be a ridiculous solution, but I find the following to be very helpful, as you can use a [route] with the ascii code as arguments, so you simply swap out the args to get another key combo. (my lord I had to look at the [match] help file a million times to get it! "why does it only have one inlet", hehe.
      Anyway, if anyone has a more optimized and flexible way of doing this I would love to hear about it.
      Andreas
      ->two depressions:
    • May 04 2006 | 8:42 pm
      here's one possibility:
      Roby
    • May 08 2006 | 7:22 pm
      umm... maybe you know this, but there are only certain keys which you can press simultaneously on a keyboard; it works like a monophonic synth. "a, s, d,f" can, for example, only be pressed separately. "cntrl, a, alt", however, are on different matrix inputs.
      good luck
    • May 08 2006 | 9:08 pm
      Dat ain't necessarily so.
      Most keyboards support simultaneous (or overlapping) keystrokes to a
      limited extent. The earliest Macs supported up to three simultaneous
      non-modifier keys, and newer keyboards generally handle five or more.
      All of this is over and above the modifiers (shift, option/alt,
      command [on Mac], caps lock, control).
      Lalo is using the Forum, so I can't tell whether he's on XP or Mac OS
      (mail header reveal the OS you're using even if you forget to include
      this !vital! piece of information). I'm not 100% sure that Windows
      hardware supports multiple non-mod keystrokes, but it would be pretty
      braindead if it didn't.
      -- P.
      ----
      Li'l David was small, but oh my,
      (Li'l David was small, but oh my)
      He slew great Goliath
      Who lay down and dieth.
      Li'l David was small, but oh my!
    • May 09 2006 | 11:18 am
      On 8 May 2006, at 22:08, Peter Castine wrote:
      >> "a, s, d,f" can, for example, only be pressed separately. "cntrl,
      >> a, alt", however, are on different matrix inputs.
      >
      > Dat ain't necessarily so.
      Indeed - on my PowerBook, I can type a-s-d-f in sequence, keeping the
      keys held down, and they all register. I just tried it on a generic
      (*) USB-or-mini-DIN keyboard attached to a Mac mini and it's the
      same. Of course, these aren't modifiers; all that matters is the key-on.
      (*) generic-ish: it's one of those sealed, soft, foldable rubber
      keyboards that rolls up for carrying between gigs, and is
      surprisingly pleasant, if odd, to type on.
      -- N.
      nick rothwell -- composition, systems, performance -- http://
      www.cassiel.com
    • May 09 2006 | 7:16 pm
      On the same subject, I have a game controller (NES --> USB via the
      Retropad* mod) with 8 binary buttons. I'd like to use the keys
      individually *and* in combination, e.g., pressing and releasing "A"
      does one thing and "A" + "up" does something different *without*
      triggering the "A" action. I've been experimenting with different
      combinations of route, select, match, thresh, trigger, and arithmetic
      objects (and looking through the Max tutorials to see if I'd forgotten
      something) but I can't wrap my head around this problem. Is it time
      for a big [if] object? Does this look like a job for Javascript?
      FYI, each button on the controller sends a controller number, e.g., 4
      for "A", followed by a 1 when pressed and a 0 when released.
      thanks,
      dan
      --
      ***
      http://danwinckler.com
      http://share.dj
    • May 09 2006 | 7:45 pm
      Quote: dan wrote on Tue, 09 May 2006 21:16
      ----------------------------------------------------
      > On the same subject, I have a game controller (NES --> USB via the
      > Retropad* mod) with 8 binary buttons. I'd like to use the keys
      > individually *and* in combination, e.g., pressing and releasing "A"
      > does one thing and "A" + "up" does something different *without*
      > triggering the "A" action.
      Well the main thing would be that the patch isn't a mind-reader, so you initially lose the ability to use immidiate button-A-depression. You could use quickthresh to detect how many buttons are being pressed and if just 1 (using [zl len]->[split] or something), then fire that straight away, otherwise trigger a command for the combo. that would be non-real-time: there'd be a lag corresponding to the threshold time.
      For instant use you'd have to rely on your button release to trigger. I'll see if I can cook up a patch for you, since this is quite in line with what I'm working with right now
      Andreas
      - a[at]thecovertoperators.com
    • May 09 2006 | 8:53 pm
      These types of problems are well-suited to bitwise solutions. I'm
      integrating, but you could do it with a list of 0's and 1's and vexpr.
      Peter McCulloch
    • May 10 2006 | 2:18 am
      Wow, thanks, guys!
      Andreas: For my purposes right now, going off the button release is
      fine. The time difference between instantaneous (pressing A) and the
      speed of my thumbs (pressing and releasing A) is negligible. I
      suppose that would become a factor to consider if I wanted to make
      pressing-and-holding A do something.
      Peter: wow. Your patch is so hardcore -- I'm not sure I understand
      it. :D Right now, I don't get what sending [loadmess 73] to the
      exact matches part does. Also how would I test for just one button
      getting pressed and released? Maybe I'll understand it in the morning
      when I'm fresh. I've pasted below what I thought might test for A
      alone but it, of course, doesn't. :)
      thanks,
      dan
      --
      ***
      http://danwinckler.com
      http://share.dj
    • May 10 2006 | 6:43 am
      Dan Winckler wrote:
      > I've pasted below what I thought might test for A
      > alone but it, of course, doesn't. :)
      the toggle will pass the 73, you don't need the Bitmask if you know the
      result. Each combination of buttons has a unique result when run through
      the Bitmask. Just test for that result. Single buttons are... test it!
      Stefan
      --
      [][] [][][] [][] [][][]
      [][][][][][][][][][][][][][][]
      Stefan Tiedje
      Klanggestalter
      Electronic Composition
      &
      Improvisation
      /~~~~~
      \ /|() ()|
      ))))) )| | |( \
      /// _/)/ )))))
      ___/ ///
      -------------------------x----
      --_____-----------|-----------
      --(_|_ ----|-----|-----()----
      -- _|_)----|-----()-----------
      ----------()------------x-----
      14, Av. Pr. Franklin Roosevelt,
      94320 Thiais, France
      Phone at CCMIX +33-1-57 42 91 09
    • May 10 2006 | 6:56 pm
      Yes, this is all making perfect sense after a night's sleep. :) And
      after a half-hour of experimentation with various logic objects,
      giving up and writing an email to ask, and typing the words "testing
      for when the results go from 1 to 0...", I remember [togedge] and
      figured out how to bang the toggle only after the button's release. :D
      i pasted it below.
      thanks again,
      dan
      --
      ***
      http://danwinckler.com
      http://share.dj
    • May 11 2006 | 11:47 am
      wow..thank you all guys for the suggestions :)
    • May 13 2006 | 11:11 pm
      Another thing I'd like to learn is how to do temporal testing, that
      is, testing for a certain combination of keys within a window of time,
      e.g., up up down down left right left right b a b a select start
      within 3 seconds. ;) Should I play with quickthresh for this? Advice
      welcome.
      thanks,
      dan
      --
      ***
      http://danwinckler.com
      http://share.dj
    • May 13 2006 | 11:30 pm
      timer could be of use here as well.
      v a d e //
      www.vade.info
      abstrakt.vade.info
    • May 13 2006 | 11:39 pm
      Quote: dan wrote on Sun, 14 May 2006 01:11
      ----------------------------------------------------
      > Another thing I'd like to learn is how to do temporal testing, that
      > is, testing for a certain combination of keys within a window of time,
      > e.g., up up down down left right left right b a b a select start
      > within 3 seconds. ;) Should I play with quickthresh for this? Advice
      > welcome.
      I find quickthresh extremely useful for this kind of thing, most definitely.
    • May 14 2006 | 4:04 pm
      maybe a gate and a match?