hello!
i am trying to build an auto-switching tool into a phase modulation patch i'm working on. i want it to use the amplitude of the input sound as the modulation index when the manual index control is set to zero.
right now, i'm trying to work out a method using spigot, which lets streams of numbers through the left when the right input is nonzero. how can i turn the manual index control numbers into zero when they are zero or negative and let them be positive when they are?
is there an object designed for this, or does anybody see how it could be built?
boolean logic would make it easy; is that available in pd?
thanks in advance,
leo
-
Logic and numbers in pd
-
Yes, boolean logic is available, you can use [<= 0] which will output 1 if the left inlet is less or equal to the right inlet (default 0), and 0 otherwise. Check the help patch for that object for a list of relational operators.
Perhaps an elegant method to solve your problem of converting all negative numbers to 0 and leaving positive numbers untouched would be something like this:
input (any number)
|
[t f f]
| |
| [> 0]
| |- |
output (always >= 0, will be 0 iff input <= 0)
- |
-
wow claudius, thank you so much! i'll try these out as soon as i can.
-
after using your idea and thinking about it for a bit while staring out the window, i realized that is really is an elegant solution.
thank you. -
another way to do the same thing:
in
|
[moses 0] (connect right outlet to first inlet of [f])
|
[ 0 (
|
[f ]
|
out
(the Pd file listing would be something like this)
#X obj 10 20 moses 0
#X msg 10 40 0
#X obj 10 60 f
#X connect 0 0 1 0
#X connect 0 1 2 0
#X connect 1 0 2 0
--zac