Forums > MaxMSP

Mathy Problem

Nov 18 2008 | 2:53 pm

I cannot seem to get these elements to add, they just switch between the two numbers. Does my code look wonky?

— Pasted Max Patch, click to expand. —
Nov 18 2008 | 3:49 pm

From a cursory glance, it looks like the values coming into
the patchers vibration, temperature, and amplitude get passed
through an "if" statement. The output of this goes to a toggle.
The output of a toggle can only be 0 or 1. Not sure if this
is the desired result as I have no test data.

Nov 18 2008 | 4:09 pm

Also make sure you are not sending floats to integer versions of objects. 0.5 gets rounded when sent to an integer object.

Nov 18 2008 | 5:01 pm

Thanks. Anything that could be a float is being multiplied to make it an integer.

The closest object I’ve found thats close to what I want to do is counter. My goal is that if the data received fits in any of the if/then statements, then a bang would fire that would add/subtract the amounts specified from the connected slider.

I’m thinking I might be able to achieved this with a counter/uzi combo. My only concern is subtracting values.

Nov 18 2008 | 6:20 pm

On Nov 18, 2008, at 9:01 AM, Nick Snyder wrote:
> Thanks. Anything that could be a float is being multiplied to make
> it an integer.

I would convert all the floating point math to integer math, for
clarity’s sake.

> The closest object I’ve found thats close to what I want to do is
> counter. My goal is that if the data received fits in any of the if/
> then statements, then a bang would fire that would add/subtract the
> amounts specified from the connected slider.

Do you realize that _all_ the if statements are going to fire when
data comes in? This makes the output of the vibration, temperature and
amplitude patches fairly useless. Instead of parallel if statements
you might want to try cascaded split objects.

As far as adding and subtracting amounts, I would use accum. It’s
perfect for this.

-C

Chris Muir
cbm@well.com

Nov 19 2008 | 5:49 am

Nick Snyder schrieb:
> I cannot seem to get these elements to add, they just switch between
> the two numbers. Does my code look wonky?

Yes, very…

It does not make much sense, I don’t know what you are after.

Why do you have 16 outlets and connect 12 of them to only 3 destinations?

Why don’t you use only 3 outlets instead?

Why don’t you just skip outlets 5 to 16, as they will be overwriten
immediatly by the most left?

all your if then else could be done much easier with for example:

[if \$i1 == 0 then \$i1 else 0] replace with [t -1 1 0 1] and connect
directly to the outs

the others I’d do with split and a [t 0]

The last patcher gives a hint that you want to analyse audio. the adc~
part probably should be outside and connected to the other ins…

It seems you don’t know much about the nature of audio, connect a print
to the number box and watch the numbers…

Indeed, very wonky…

Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
— _|_)—-|—–()————–
———-()——–www.ccmix.com

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

Forums > MaxMSP