Forums > MaxMSP

is the number becoming higher/lower over time?


Apr 12 2013 | 2:46 pm

I have a message object which fills itself with a list of numbers (the amount of numbers in this list varies)
Now I want to know it the numbers in the list are slowly become higher as the sequence goes on. Or if the numbers become lower.

76 76 75 75 75 74 74 74 73 79 84 83 82 83 83 83 84 83 83 82

However, it could be that during the list the numbers stagnate a little, like above example.


-- Pasted Max Patch, click to expand. --

Apr 12 2013 | 2:55 pm

Hi.

This gets the mean value of a list if that helps?

If you want something different let me know.

Cheers.


-- Pasted Max Patch, click to expand. --

Apr 12 2013 | 3:07 pm

I want to see whether the number becomes bigger or smaller over time. Just having the mean is not enough. It is about whether the number changes. I would need something like this: but then more accurate.


-- Pasted Max Patch, click to expand. --

Apr 12 2013 | 4:06 pm

here’s one (crude) way to do it: output the list numbers one by one, and have two counters – one that counts if a number was larger than the previous one, and one that counts if the number was smaller than the previous one.

if there have been more decreases than increases, this list’s numbers tend to decrease.

is that kind of what you mean?


-- Pasted Max Patch, click to expand. --

Apr 14 2013 | 9:47 am

Is this what you are looking for?

{
	"boxes" : [ 		{
			"box" : 			{
				"maxclass" : "button",
				"outlettype" : [ "bang" ],
				"numoutlets" : 1,
				"patching_rect" : [ 376.0, 525.0, 20.0, 20.0 ],
				"id" : "obj-24",
				"presentation_rect" : [ 377.0, 526.0, 0.0, 0.0 ],
				"numinlets" : 1
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "button",
				"outlettype" : [ "bang" ],
				"numoutlets" : 1,
				"patching_rect" : [ 435.0, 525.0, 20.0, 20.0 ],
				"id" : "obj-23",
				"numinlets" : 1
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "message",
				"text" : "Smaller",
				"fontname" : "Arial",
				"outlettype" : [ "" ],
				"numoutlets" : 1,
				"patching_rect" : [ 434.0, 487.0, 51.0, 18.0 ],
				"id" : "obj-21",
				"fontsize" : 12.0,
				"presentation_rect" : [ 434.0, 488.0, 0.0, 0.0 ],
				"numinlets" : 2
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "message",
				"text" : "Bigger",
				"fontname" : "Arial",
				"outlettype" : [ "" ],
				"numoutlets" : 1,
				"patching_rect" : [ 376.0, 487.0, 45.0, 18.0 ],
				"id" : "obj-20",
				"fontsize" : 12.0,
				"numinlets" : 2
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "newobj",
				"text" : "sel 1",
				"fontname" : "Arial",
				"outlettype" : [ "bang", "" ],
				"numoutlets" : 2,
				"patching_rect" : [ 416.0, 448.0, 36.0, 20.0 ],
				"id" : "obj-17",
				"fontsize" : 12.0,
				"numinlets" : 2
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "newobj",
				"text" : "> 0",
				"fontname" : "Arial",
				"outlettype" : [ "int" ],
				"numoutlets" : 1,
				"patching_rect" : [ 416.0, 417.0, 32.5, 20.0 ],
				"id" : "obj-14",
				"fontsize" : 12.0,
				"numinlets" : 2
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "number",
				"fontname" : "Arial",
				"outlettype" : [ "int", "bang" ],
				"numoutlets" : 2,
				"patching_rect" : [ 416.0, 385.0, 50.0, 20.0 ],
				"id" : "obj-8",
				"parameter_enable" : 0,
				"fontsize" : 12.0,
				"numinlets" : 1
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "number",
				"fontname" : "Arial",
				"outlettype" : [ "int", "bang" ],
				"numoutlets" : 2,
				"patching_rect" : [ 420.0, 266.0, 50.0, 20.0 ],
				"id" : "obj-6",
				"parameter_enable" : 0,
				"fontsize" : 12.0,
				"presentation_rect" : [ 417.0, 268.0, 0.0, 0.0 ],
				"numinlets" : 1
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "newobj",
				"text" : "-",
				"fontname" : "Arial",
				"outlettype" : [ "int" ],
				"numoutlets" : 1,
				"patching_rect" : [ 416.0, 349.0, 32.5, 20.0 ],
				"id" : "obj-5",
				"fontsize" : 12.0,
				"numinlets" : 2
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "newobj",
				"text" : "t f f",
				"fontname" : "Arial",
				"outlettype" : [ "float", "float" ],
				"numoutlets" : 2,
				"patching_rect" : [ 419.0, 307.0, 32.5, 20.0 ],
				"id" : "obj-4",
				"fontsize" : 12.0,
				"numinlets" : 1
			}

		}
 ],
	"lines" : [ 		{
			"patchline" : 			{
				"source" : [ "obj-20", 0 ],
				"destination" : [ "obj-24", 0 ],
				"hidden" : 0,
				"disabled" : 0
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-21", 0 ],
				"destination" : [ "obj-23", 0 ],
				"hidden" : 0,
				"disabled" : 0
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-17", 1 ],
				"destination" : [ "obj-21", 0 ],
				"hidden" : 0,
				"disabled" : 0
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-17", 0 ],
				"destination" : [ "obj-20", 0 ],
				"hidden" : 0,
				"disabled" : 0
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-14", 0 ],
				"destination" : [ "obj-17", 0 ],
				"hidden" : 0,
				"disabled" : 0
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-8", 0 ],
				"destination" : [ "obj-14", 0 ],
				"hidden" : 0,
				"disabled" : 0
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-5", 0 ],
				"destination" : [ "obj-8", 0 ],
				"hidden" : 0,
				"disabled" : 0
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-6", 0 ],
				"destination" : [ "obj-4", 0 ],
				"hidden" : 0,
				"disabled" : 0
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-4", 1 ],
				"destination" : [ "obj-5", 0 ],
				"hidden" : 0,
				"disabled" : 0
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-4", 0 ],
				"destination" : [ "obj-5", 1 ],
				"hidden" : 0,
				"disabled" : 0
			}

		}
 ],
	"appversion" : 	{
		"major" : 6,
		"minor" : 1,
		"revision" : 0,
		"architecture" : "x86"
	}

}
Apr 14 2013 | 11:13 am

grizzzly540: What you posted can be written more simply with the [change] objects:


-- Pasted Max Patch, click to expand. --

(also use Edit -> Copy Compressed, it’s much neater in the forums!)

Apr 14 2013 | 11:23 am

@grizzly: your solution would say "smaller" if the next number was the same.

@lekirst: you haven’t really told us how this stream is being generated, so we can’t really know for sure, but the following little bit will slice off the left-most member of the list and show you one of the three outcomes.


-- Pasted Max Patch, click to expand. --

Apr 14 2013 | 4:25 pm

laonikoss, you are absolutely right.

Wetterberg, you are also right.

Apr 14 2013 | 4:46 pm

-- Pasted Max Patch, click to expand. --

Just practicing pasting code.

Apr 16 2013 | 1:26 pm

Thanks guys for all the input!

I wasn’t familiar with the change + object, really solved the issue!

Viewing 10 posts - 1 through 10 (of 10 total)

Forums > MaxMSP