Restart a Ramp in signal rate
I have been trying to create some Kind of ramp from 0. 1. that can be reset at signal rate. I find it a little bit sad that the Phasor object doesn’t have this feature internally, but i found a very interesting solution here:
Anyways, i think after one day of thinking and trying around i coulnd’t come up with it myself which is a pity and speaks of my intelligence but also of a lack of usability of the ramp generators in max.
My last try befor searching on the forums was with an adsr(adsr~ 1000. 0. 0. 0.) object. I thought it is great because it outputs a linear ramp as i need it and can be started at signal rate. Then i tried to make it loop using a delta~ object to detect the end of the ramp. That brought me a lot more confusion(/bugs?)! Is there some kind of bug, could anybody try explain me what happens there?
----------begin_max5_patcher---------- 1251.3oc0ZsrbaaCEcszWAJ2zjVaNDu3iNsSl1ccc6tlNYnDgjXBE.GRnX6l I5au3A0CWKICIQhnNiMo.HH74dv8dtW.4uLdTvDwir1.vOA9KvnQeY7nQltz cLpq8nfk4ONsJu0Lr.N6AwjOFbm8QR1iRS20k0L.LJJZySlI3x1x+goeJDEF 00Me0xRdESZlLztNEqja5E10actb5hR97OzvlJsPDm.UyD.Bo5awX8UTTXD3 u6dG6zHeplYegffsOprv.TE3umjtOJ44KMiN3WaJyqBzO3qiGqub20wIErYr lJwCmCk.uPJISOe.Z7kxHIdgQpD4EKYss.nO3jXh9ZB5R4j39kSlJVtjwkuf T9iGJUV.PvA4qJJEWOyDcBlIyF.QRLNMzWPM6a+Tua+7BfX1LfbACjWz1X5n kw.OrHWBVjWWy3sggalgpRNapXEWtuVxfPaTBdOcGHMReCSNBuQ54XoUKmvZ VuYRaKmaP6VS6xUZQG2hSwYFAEJ0UcEEt3JC7NPvLUXt7vgTnSPMcOYonvzK pGcw9yEks.0CqyaZJaUdZll7YqZUVMPJDg67pFDGnjLCclfsNP1VGMvC1uNP sSE0rs9ON3WbBCIM0nbPsRGPbz1aGxRvY8oPwuqUFTqbFXAJDrV92KAa+PgP oW7jTCXfRtHup5NvjFV9mL5IuOXFiULIe5mdefdFVXFC+IPsnjKAugMOzLtF VAPKr71PfUXROckRitTm6hZTsrJEk.T1n91FDrfUUqm1JVdqT+gkOoFobUcH 3cGTzJ9P9bJBFQQTX+33EmXWgrR8I1kMzQjtv8bgQRw74Urf9LodWpKTzqqH UxOrJDdahckdfxFkrlOv34SpLuXTOV.X9z0.H.c80DG857hMhjlbJkEL41UY IoKiiiJK3+2jJsKDrmSkhG3ToeSnpt5rvcLVeQUvuMUcTID0u42VM+cucfqo 2VMQ2ldNYoEnradA9N63ZD3QIdRf+GOuMxdom2AxpIhQgzKlRndYC9+v5AkO 5JiFYKB0E9nSe3fTBwKTx2c+5A1KYSlSnwYAScV07PrBrmOIH8w8jOm8BZIJ bP4j3HXXBUuWczNWEX5YeHPP7saESDnYcmfhbohor9b0CNrqdzXRHpGV87y4 79y+xZv8QgTeDjSRN2pHODuD6EdwtIYQyZ.57T.wmezdWBAS4ioQWE43mLkJ .rdPOD7XbhM8nkZvWEmP7zWXRkLeXYkMgQc2HWEqf7BqnOIbUHTTTTHXyOmC GQOHGQd8notiNBRNmsgs6SleOXNU2nMyqZNur+yWPoAx59eNW1JV0LcCf5Vd .6vbAqUVxykkB9diI9YiYQYQAiueZ2hxV89FJN9FGbEMDGPiR5A.8BZfNflL uwMoNfFh2PitluaH3Pc.MP+QNNfFj2PSrKbSxMULNxedNnDWvC0e3g5nF3sS fE1iQVtrZgQ2X3A6M7fcIXG6wnKWynitYjBwuVJ8kkEluOztJtRHo58PPiv5 aoYwaas6OjWM.B5BM.y4HjtWqAv.bJfw30bpZ7lJpDM1WvbddQcWfvjzr6z8 s8kOhwZOAvLj8TAeVKThY5RQnssF.hf3zRoGSK6xBCI0e3wk5cwW5VSr6aJu t9yrl1t4z.E0tM+n00x7+cfx8gaaZlwfF1mK2Ld5X8r80w+KQN5JA -----------end_max5_patcher-----------
solution is a one sample delay..
----------begin_max5_patcher---------- 1395.3oc0ZsziaaCD9r8uBVcoIsdEDIEkrJZQP6sdt8VSQ.sEssRjEEjn2GM H92d3K60aV+f1VhwEXWSKJpAy7oY9lYH8mGNHXB+QVa.3W.+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odhf+mOuFYuz86.Y3DwnPxECIDuzf+OstWwCaYzHSQntfG GYSAQwdAR9g6V2ydIaxbB0NKXxUsUovNdmfTa2CcN6UvRTXuhIIQvvThpWcz ytJvwm8l.Aw2tULEC0u2iQQtTwTVW91C1uu8HIwgnN3sme1m2e82VCtKJj3i f73zysJx8gKId57PTMIyaVCPmGCH97i1sIDzkON95NrH+joTp.q60MAOAmZR OZfF7UgIwd5.SJEz9EU1DFYGhuJTA4ETQsS3xPnnnnPvl+NGLhrWLJ9zQS1s NBFeNsg872z+u2bptAa5GUueYeyOX.sJql+kXYKeUyzMJj8TeAOqy4rVQQk9 D62YMph.AvsKZQQdNqZ27t4EspFGxObmCtpNPWzG7KVyqUmo7Rdi8Tf28mX. DlNNajZtsO7xhb8daZQuz3wJ9.ho9vLjolwWbEJ0TBQDhnoNR28cd2ADpie8 z.QxIPhNTeb4Ey2nz8p9j3h9j5M8wI0AcB04.diQ5B7FuyU8fCmKF.N6BM.r ZXbVx1q5ACPyRcJKPV2hrPKe3PfcBPi8lCpaLq3aL8A4M8g3h5.8l5fHN5M6 I0wo5D7m9D6ZYK2Nr+P+kLB5B5bSEY4u.KH1kL0dScFeSoMt33jcSEjS7VqI HGzlKsdbSabz556YMsVQpUDYyuezzKi9mAgr.qJykZIFzvtuXy5ICUR6KC+p J4gJO -----------end_max5_patcher-----------
Using send~ / receive~ won’t be doing quite what you want here unless you have a vector size of 1. You could gen~ for single sample feedback instead.
Anyway, I’m not sure what your objective is. Was there a problem with the solution you found in the other thread? If this is just an intellectual exercise, you could try a solution using [+=~] and [%~]
Thanks for the answer, i eventually came up with the [+=~] solution too. I was building a signal rate sequencer/Sampler everything working already. Nevertheless, as the famous "i hate sample accurate patching"-thread says.. one really has to scratch one’s head for some time to find simple things as a sample accurately timed ramp, or something i wanted to achieve with an adsr there(i needed a value of one triggered by a [click~] that stays there for a specified time and then returns to zero), which is obviously not the best solution.
Thanks for pointing out that the send/receive~ pair introduces more than one sample delay.
i posted the whole thing for two reasons:
1. Confusion about the behavior without the delay.
2. Surprise that my objectives are quite simple things but not that easy when trying to stay sample accurate since some objects(eg. phasor), don’t accept signals as i would like it :)
It’s partly a case of getting used to the MSP way of doing I think; it certainly took me a while also. Did you check out [zigzag~] also? It’s pretty versatile.
I used to find myself jumping into mxj~ quite a lot for this sort of thing, but have found that there’s a surprising amount of goodness to be had out of the stock objects (with an option on gen~ if I really do need single sample feedback).
Glad everything’s working now
With [+=~] you’ll get a large number very fast. And there’s a limit to the amount of numbers Max can represent. So I don’t know if that’s the way to go. I would use the solution I gave in the other forum topic. The one with the [phasor~]. I don’t understand how that wouldn’t be usable. But maybe I’ll have to know more about the context you want to use this in.
That’s a good point Dave, but I’m not sure how problematic it would be in practice. When the max value is reached it should just wrap, no?
I’m not sure if it wraps or keeps hanging at its maximum value. But both cases are not really desirable. I think you’ll have to reset [+=~] at some point.