Forums > MaxMSP

Making negatives positive

December 12, 2011 | 12:25 pm

Hi all!

Does anyone know of an easy way to make a negative number (or list of numbers) change to its equivalent positive value?

Thanks Guy



pm
December 12, 2011 | 12:29 pm

For a number [abs] or [abs 0.]. For a list of ints, [vexpr abs($i1)] or floats [vexpr abs($f1)].


December 12, 2011 | 12:37 pm

Thanks pal!!


December 12, 2011 | 1:55 pm

….in addition to those elegant solutions, [!- 0] or [!- 0.] will also work on a stream of numbers: 0. – (-4.) = 4.

Brendan


December 14, 2011 | 2:32 pm

[* -1] and [* -1.] will also work (assuming you know the input is negative). If you can have both positive and negative values, use [abs].


December 14, 2011 | 4:58 pm

just to make the thread complete:

[expr -($f1)]


December 15, 2011 | 3:19 pm

Yet another way: [scale 1. 10. -1. -10.]


December 18, 2011 | 5:43 pm

There is no limit to the convoluted ways of doing this. I’ll see your [scale] and raise you this:

– Pasted Max Patch, click to expand. –

December 19, 2011 | 3:27 pm

one could also convert the input into a video signal.


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