complex conditional statements in max with JAVA?
I really need a good system to do complex conditional statements in max.
I need to have several inlets and outlets as variables.
I thought the best would be JAVA (?)
How do I have to write for example this in JAVA:
if $i1 == 0 && $i1 < $i2 && $i1 < $i3 then 1 else out2 $i2
you can just use the if object, all you need to do is bracket your statement
----------begin_max5_patcher---------- 522.3oc4V11SaCCDG+0IeJrrlPfTVkeHwAlFuXeNlPHmFC0nTmHGWV2P7cew WvPJPIonsBBdiStK246+8y1Q9l3HbQ8ZUKF8MzOQQQ2DGEAt7NhtyNBuTtdd krEBCWrx4pM3j9O0XUsJiS5z0lysp4t9oRvRmQRP7Th+QX.cVHKoa9Bs4xMx PLHC18i2mitDJecwUekQCk2rZo1TobfznO3rdk6wd6c49cipuf3Bo4RL5L+W uMN1Oj75PvSaF1IYStYn721loq.EJ6HqmYhS5aHwTWOyxGtCHiAHftEDPBk+ hZiyHWBcE9GVsr5EgSiz1ErSYOWYjEUPZjmEbrAEnU+GHRJeFYa7Tab3j+6X kkxAHwOdpXMjwTvp3SJUy34.VDjcbyJKmMNU4eRoZJUriTMkb7rrIRU5Gdpt 0yxShOrOhGlU+pq0Bp2oVCbAqu.c3WzTzomhHnCN.4e+6ciri7VGFL4GgbKT FDEopZUnN4w7AMNu4D32C7LxKB77cD37+IP0SzMoIHNbk173qoAcn2+lHtsd kcdX5BcRGkB8Xop0oMvo6gA0c.D8.HVnKKUlg6UJ0s9sO.fHO6h8NoGxH5we qn8odFiO9qn7dhOh8lb3SPMfjY6E4Pmpbn6mEKwT0yqY0p+ruro4Zks8t4Dj R2ORup15MEIfo1zaByH1ptVGhOO1Oa2F+Wf8glCR -----------end_max5_patcher-----------
thanks but I really need to use another language like java.
to nick rothwell / cassiel: what about C ?
the expression in question should be done im max.
but if you need something [if] can not do, then it seems logical to ask for a java solution.
(of course you can do quite some complexity with several if, expr, and gate obejcts
and that might be still less CPU hungry and better to program, read and maintain.)
p.s.: to correct myself, he asked about "several outlets", so it can of course not be done with only [if].
I was actually looking for a smart and easy system to write in a row several conditional statements in one object without creating several if/expr/gate and other objects and connect all them together…
Something like a conditional tree.
I just kind of needed to write a few conditional statements like this "if $i1 == 0 && $i1 < $i2 && $i1 < $i3 then 1 else out2 $i2" in JAVA.
I really don’t know quite anything about JAVA but, I thought somebody could write me this condition in Java so I could maybe do some more complex conditions just in one js object…
Maybe it doesn’t make really sense…
see my post scriptum above.
actually i dont think it will be that easy in java to be able to write such expression in one line.
in java you will also need to define variables and then nest several if abstractions with brackets and returns to make something complex. :)
i also often wish to have three outlets or the possibilty to have operators and math stuff behind the "then" in [if] but i have never found a solution, at least none which gives a nice way of generalizing that for an abstraction.
You could do this stuff as Java one-liners, but it would look a little untidy. (I didn’t suggest C because of the hassle of setting up the tool chain, and all the boilerplate code, the lack of portability, and the lack of any ability to reload changes into the Max session.)
But really: Python. Really. https://github.com/cassiel/net.loadbang.jython
My actual purpose is to write a software for midi elaboration and I am just using Max as a surface to write and order all my ideas I have in mind.
I will need to rewrite the project in a common language used for music software.
So what I basically will need is a language which makes all my conditional operations fast and without using to much CPU.
I know most of the music softwares are written in C but my software is just about midi so I do not really know what would be good.
So, what I thought is to start writing some ideas already in the language I will use to write the software and embed them in Max.
That’s why I thought about Java or C.
I will try Python but I don’t know if I will use this for the software.
I don’t want to bother you guys anymore with this…