Sensor value hold
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.
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 : )
----------begin_max5_patcher---------- 1720.3oc6a0siiZCE95rR8cvhaa1QXv7WaUurO.sR8loiFQ.mDuKAnfY1c5p 9tW+CDfL3.IDBLpqFMgDCFeNe96bN1mC7se3Cqz1j7UbtF3m.OBVs5arVVIZ i2xppFVocv+qAQ94hKTKH4vAbLUac4Io3uREm3wf89w6vOAH4fWSJx.ayH33 PvuV+2wNsMIllS9GLuiP3C5Usm5SC1Sh28bFNfJkKjE6z.CC4Ans3f9C5fmp 5TbwARbDlJjOXygH1+fXHz9SbVneruVitjTPq5ywgmDJt5jMe5i1HMQi+6O7 A9Q1g0iGh9EP0eoETfO3wHRLCv1iyv.x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BMheAJPj7jhrfpYfJBK3D0KDm SIwGynvi0NNN8J2SBCOYq6xbsDllvleKkxKgke4J.ZvJf66cEfsxT.b4o.tC UA3aeaINC3MXE.tLU.mKhB8tVAbWl1.VCVAbVjy.cYZpvFXYRg5xzraE.sLM hQCdFnqX1uuT.qkIEZvwAPKy0BgfynBTch5Bnok6+BN7Y13wVd8y9TZFgsQX 4ZWaWkuNK.kx5VsKJYieTYICOtoMsKrxU8Vdrg28ix9QD3pKYbAam.Eionv1 5MR4R6pBSn3CkyhZgIeIluKz07OJR0FUsi46p6H8n6BJa1UsgM58g2P7+jTA 9WvQIAD5qWCVaJyx.T2SQdstgEfuYl+sOOd88xo+8xo++1xoet7KJhgN9bKZ H3aH6AjaQyInhIn9Ss38Nwso9AeFP3QaFO75p54T89TYci6eg0OGx5uIeLPp 74C2zT9bzoOwYCWEl5MjL.eeIrjTLiuMdnsbcVVFyDc0cYQWa8bCOBTEVgpV SJgUkKVm9IrqmEd6GuANCJeliMG.1NELV6YwYvfJGlL.zzVNLSTuVrKsZgI4 MHACaxpElo0hoVXCtPLKzT3N7BIsLKBvfSd0hT7cdagI5V7sWjUvvdnn+xL8 +CtFj1KVxyfD+kYMrGdATs9ddmWj4cV4q4l9UkfTnLAold20WyM3D8ZtcxaL p5WbsxCkuk.FN8mR3A7t6Ma5jbIel12bU5hlljCW6U5Uphm5mpRQei+Iq19W Usth1OeMc3XRgSoNw+KS3f8Jbs8bduDN3P.tSg26jrg7FjvMOxlwfYbKzIUS 6KU1PlHwqEkLoXlNxG961+RlDBSn3APU7q6HbyeMnmAC7SMcUvELlEtvoSyc Kbvwib7FXG9O.cbpUDC -----------end_max5_patcher-----------
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.
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.
Forums > MaxMSP