I am using moses to do some conditional logic, problem is there is a LOT of data coming in, and it send out string every time the data comes in. is there a way to send only a single output only when the threshold is crossed?
-
-
[moses] would actually be perfect for that.
-
it sends out an output every time it matches.
so [moses 10] will send an output every time something is below 10 like if I drag a number atom from 1-3 it matches 3 times and send output. I want it to only send one output when the first one is matched. am I missing how to do this?
-
easier without moses i think.
[> 10]
|
[change]
|
[sel 0 1]or
[>= 10]
|
[change]
|
[sel 0 1] -
if you want the number coming out of moses instead of 0/1, you could use
spigot, [trigger b f] and 0 and 1 messages to switch the output off/on. -
I think mod's suggestion of [> ] is the best because you don't have to worry about trigger ordering.
Be careful of about not setting an argument for [change] (which defaults to 0), the example above it would mean 0 is never sent until the input data goes above the threshold and comes back down - this could have implications when loading the patch. Maybe set it to [change -100] or something outside the range of the input values.
-
I'm a bit new to most of this, but here is what I am looking for. programmatically I'm not sure how to do this, but here is the closest I have come. Tried all the suggestions and none are working way I want ( maybe because I don't fully understand the concepts) but here is my patch:
http://localhostr.com/files/gwhQ8fI/Screen+shot+2011-11-20+at+10.36.03+PM.jpg
I am using reactivition, and setting up a "threshold," or a grid that will trigger a sample when it is between 1-10, but I dont want to keep retiggering it. So when object is between 1-10 first number atom is set to 1 only once and when it leaves the threshold it sets back to 0. problem is that it doesn't always reset back to 0, thinking maybe setting a metro that resets it in a timer? not sure if thats best solution.
-
do you actually need the values? so, if it is between 1 and 10, do you need to know that the value is 3.768? or is it ok just to know that it is between 1 and 10?
if you don't need exact values, then you can save a lot of patching with:
[div 10]
|
[change]this just outputs an int every time the value changes between multiples of 10.
-
oh, and cos you need different noteouts, the div output will do that for you too.
[div 10]
|
[change]will output 0 for all values below 10, then 1 for all values 10 to 19.9999, 2 for values 20 to 29.9999 etc...
so just take the [change] output and feed to [noteout]'s right inlet. You might want to add 1 first so that 0->9.9999 doesn't get sent to channel 0.
-
@mod said:
do you actually need the values? so, if it is between 1 and 10, do you need to know that the value is 3.768? or is it ok just to know that it is between 1 and 10?
if you don't need exact values, then you can save a lot of patching with:
[div 10]
|
[change]this just outputs an int every time the value changes between multiples of 10.
I just need a single message when it crosses the threshold. so even if it hits 1.22, 3.55, 9.99 or anything between even a thousand times that it will only trigger an output once, until it goes over 10. and if it goes back between 1-10 again it would trigger it again. kind of like a gate in the audio world, it turns on when a threshold is crossed.
-
@mod said:
oh, and cos you need different noteouts, the div output will do that for you too.
[div 10]
|
[change]will output 0 for all values below 10, then 1 for all values 10 to 19.9999, 2 for values 20 to 29.9999 etc...
so just take the [change] output and feed to [noteout]'s right inlet. You might want to add 1 first so that 0->9.9999 doesn't get sent to channel 0.
this sounds like what I need, I will have to play with it.
-
I didn't read everything, but ...what's wrong with the [threshold~]-object?!?...
..and if you need a number instead of a plain bang, then you can store the incoming numbers in a [f ] and bang that if you need it.. -
threshold seems to only work when you cross over that exact number. I need it to fire anytime it is between 1-10 at least once, even if it starts on 3. that's the problem is that I don't know exactly what number it will really start on.
-
Just extend mod's suggestion:
[div 10]
|
[change -1]
|
[sel 1]You're probably missing the first bang because the default state of [change] is 0.
-
sorry I seem to really suck at this. I did what you said and still not desired result. Here is example of what I did.
http://localhostr.com/files/iSk0Skz/Screen+shot+2011-11-22+at+8.35.47+AM.jpg
It indeed sends bang when I hit exactly 10 but I need it to bang when I send 1 and 9 as well. so anything between 1-10 should bang once and only once until it exits threshold, then comes back. so lets say I press 2 [bang] 4 [no bang] 9 [no bang] 12 [no bang] 3 [bang] 4 [no bang]
I appreciate that help. I tried reading documentation, but it is still a bit esoteric to me.
-
wow, never mind. It seems moses does in fact do exactly what I want. When I tried it earlier it seemed like it was sending bang every something matched below 10 if i had [moses 10]. but it seems to only send a single bang out.
sorry I'm a dummy. Definitely appreciate all the patience!
-
you must be doing a double error then, cos moses definitely doesn't work like that. also, it doesn't output 'bangs', it outputs numbers.
here, what you should do is in the attached patch
-
Sorry, lukasz. That should actually be [sel 0].
-
@mod said:
you must be doing a double error then, cos moses definitely doesn't work like that. also, it doesn't output 'bangs', it outputs numbers.
here, what you should do is in the attached patch
mod this is exactly what I need! bit confused on the change -1 though. I added some number atoms in between to see what was actually going on. it doesn't seem to change output of div 10 at all. read the documetation and it says it outputs only when the input it changed, this seems useless though since the output is always changing, no? then +1 is just so you don't have 0 as output I'm assuming.
-
yes, the +1 is so you don't have a zero output (as midi channel zero is not needed)
to see why you need the [change] object, do this:
after the [div 10], send one more cable to a new object: [print before]
and then after the [change -1], send one more cable to a new object: [print after]
now feed some numbers in to the [div 10], and see why the change object is needed. Without it, you get retriggered notes, which is precisely what you said you want to avoid.
-
@lukasz said:
the output is always changing, no?
no, it's not.
if you input 1,3,5,7,15 into the [div 10], then it will output:
0,0,0,0,1
however, what you said you want is just 0,1
that's why you use the [change] object - to suppress the repeated outputs