Sensor value hold

    Aug 08 2012 | 12:25 am
    Hi All,
    I am fairly new to Max (running 6 + gen) and this is my first post - naturally it's a question. I have been searching the forum for references to this topic but haven't come across the right posts although I suspect they are there. I'm not sure I have understood all I have read in any case. Interesting rabbit warren though - some very smart cookies here.
    Is there a simple way to 'remember' last sensor value or hold position? In particular I am using FSRs and ribbon controllers which automatically ramp down to minimum value when released. I would like to be able to hold the last value when I release my finger. Peak hold is no good because I would like to slide up and down. My initial thoughts for a solution are as follows: Use the timer to sense when values for the FSR, for example, are changing at a certain speed (ie equivalent or thereabouts to the fall time of the FSR) and use this threshold to trigger a sah~. This sort of works but not really. I haven't got into really fine tuning this solution so it could have potential I guess. I figured the fall time of the FSR would be a lot faster than a human finger would ever move. One flaw is that the microcontroller I am using outputs MIDI at a speed I suspect is a lot slower than real fall rate of the FSR. mmm ...
    I hope I have been clear ... I assume this has been discussed so I am not asking anyone to hold my hand but a nudge in the right direction would be greatly appreciated.
    Thanks, Andrew

    • Aug 08 2012 | 10:12 am
      Hi and welcome to the forum
      [change -], [change +] will help here, they output -1 or +1 depending on the direction of the number stream. I have attached a patch below demonstrating how to gate a number stream dependent on direction. This is designed with FSRs in mind, as for ribbon controllers I'm not sure what they output - are they basically linear potentiometers, returning to zero on release? If so, they will hold the last value in the same way using this patch, but perhaps not as you require (rise and hold OR fall and hold). I've also included a little delta-velocity subpatch, which will give you aftertouch data too - even though you didn't ask for it - always useful with FSRs I find : )
    • Aug 09 2012 | 12:31 pm
      Thanks for the quick reply Brendan. I've been perusing some of your older posts. Your patch looks very useful to me although not quite what I had in mind initially. I won't have a chance to try it until Sunday though and will get back to then. BTW the ribbons are pretty much what you describe - linear pots returning to 0 ... or 127. Thanks, Andrew
    • Aug 09 2012 | 6:03 pm
      Hi the above patch will freeze a number stream when it changes direction, thereby giving you the 'peak' value - it can be easily adapted to suit input from an FSR or linear pot.
      My recent forum activity may well be a little erratic : ) I'm rapidly approaching the end of a PhD here an the aul' head is pickled, but whenever I see "sensor", "Arduino" or "parsing" etc in a post topic I always leap in....often too quickly, but the above patch should sort you out.
      Peace Brendan