What's the most efficient way to output a condition for a range of samples in Pd?
For example: IF x is within range y (two indices specifying a range within a table) THEN 1 ELSE 0.
Interested in alternatives to the expr~ object. Thanks in advance!
[expr~] question / taking action on a range of samples
What's the most efficient way to output a condition for a range of samples in Pd?
For example: IF x is within range y (two indices specifying a range within a table) THEN 1 ELSE 0.
Interested in alternatives to the expr~ object. Thanks in advance!
@ricky Well I know to get a range of values from a table, you can use William Brent's [tabletool], which also gives a list of their indices, Then you could rig up {expr] or even [sel] to check for matches.
Needs to be (audio) signal rate, unfortunately (i.e. expr~).
@ricky Ah didn't catch the tilde~. Perhaps you could try *[threshold~]? Although I don't know that will work if you're doing this in real time.
That could work. Let me try it. Thanks.
[expr~ $v1 >= $v2 && $v1 <= $v3]
where $v1 is the input, $v2 is the lower, and $v3 the upper?
Yep! That's how I'm doing it currently. Wondering if they're any other efficient alternatives. Thanks, Seb.
Wondering if they're any other efficient alternatives
Do you mean Seb's [expr] above isn't efficient? If so, why not?
No, I don't mean that it's inefficient. Just curious if there would be another way to do it as expr~ is CPU hungry.
as expr~ is CPU hungry.
Oh, I didn't know that! Only recently I ran into my first CPU usage problem in Pd (partially because my computer is powerful but also because of the type of music I compose with Pd) so I am fairly new when it comes to thinking efficiently Thanks for the info.
ok, with zexy there's this:
(where the respective inlets are $v1, $v2, and $v3 from the expr~ version)
Other than that I don't think there is a way unless there's a specific external for it
edit: found 1 more:
(where 10 and 50 are the lower and upper bounds and 51 is the input)
of course the max~ and min~ could be replaced by clip~ if the inlets could be specified by message
@seb-harmonik.ar OMG, what a colour scheme!
@gsagostinho thanks, it's here if you're interested https://github.com/sebshader/shadylib/blob/master/examples/colors-plugin.tcl
(the only bad part is that it's hard to see GOP boxes)
Nice, Seb. Thanks.
@seb-harmonik.ar Do you just paste each line individually onto that "Tcl:" line on the console?
@rjp9 I put the entire file in my library path and if the version of pd supports tcl plugins it will automatically load at startup
http://puredata.info/docs/guiplugins/GuiPluginsAPI/
http://puredata.info/docs/guiplugins/GUIPlugins/
though I don't think vanilla supports colors for inlets, message cords, etc. so you pretty much need Pd-extended 43.4
@seb-harmonik.ar Woah this is so cool!
Oops! Looks like something went wrong!