i have a problem with a potentiometer i hooked up to pd and connected to sound. i am getting values from 0-1023.
i want the sound to change when the potentiometer is turned, but only when the value change is greater than 10. how could i program this? is there something like an if-function, so i can say "if, value-change is more than 10, then do this & otherwise do something else" ?
i think it could be possible with the expr-function, but i only know how to use it in simpler cases, not in this case.
how would i write that "if-value-change-greater-than-ten"-thing with expr?
thanks so much for any help!!
"if" function in pd
You don't *need* [expr] to do it, but here's how you would:
[t f f]
[sel 1 0]
| [pd do-something-else]
thanks for your help!
i am now getting a 1 when the statement is right, like expected.. i attached a photo of that part of my patch. i have to now connect it to the right side of the patch, where the sound is programmed.
i want the analog value on the right side to be read and used only if the value change is greater than 10 - when the expr puts out a 1.
how could i do this? any ideas?
Use the output from [expr] to open and close a [spigot]. Something like this:
| [expr (abs($f1-$f2))>10]
that was exactly what i was looking for. thanks so much!
... bit way too late for them... but your answer was a couple years early for me... I'm working on a patch that will be a virtual mixing-board with option to output waves... optional loading of waves on each channel... supposedly making an eq was to present a problem, but with a simple understanding... I digress... ANYWAY! I'm going through and building it as we speak, and I decided that I needed peak meters... [moses 1] solved my problem! Thanks a lot! I've been using Pd for under a year, but because of this site...
For future reference for anyone looking for a solution like i was; the above mentioned suggestions almost but not completely adressed my problem. I wanted the same as tshuapa but on a continuous datastream with the difference including < x. With any value in between being skipped alltogether and remembering the last value as new reference. It's an abstraction where the parameter $1 is the difference u want to set.