Forums > MaxMSP

Expr language

January 20, 2014 | 6:01 am

Hi folks,

I’ve been reading these forums, but never actually posted, so this is one of if not my first! I’m a musician first, not a programmer or a mathematician, so my ignorance is abundant in these areas but I am trying to wade through.

I am very new to Max/MSP, and am wondering about the expr object. Where can I learn how to write in a language that it understands? Atm, I’m wanting to use log and inverse exponentials etc. Can anyone suggest a link or point me in the right direction for learning? I understand the expr language is ‘similar to C programming’. Does that mean its identical, or just has similarities? Thanks in advance!

B.


January 20, 2014 | 7:32 am

i´ve aksed this myself years ago and never found an answer.

"identical"? no, just similar. and it seems to be impossible to find an overview of all possible ode for expressions anyway.

it is always the most simple synthax you can imagine. for example you may use as much spaces as you want, because they are ignored internally.

the only thing which you have to get familiar with at first is the way you have to write variables (inputs) and arguments to [expr], [if], and some others.

so the variables are $1-$9.

and if there is more than 1 argument to a function, the have to be divided with an "escaped" comma like that: expr max(5\,12) will calculate the max of 5 and 12, which is 12.

log also needs two, the first one is the variable and the second one the "argument": expr log($i1\,$i2) will reproduce the [log] objects behaviour. this is true for all funtions which allow/request two numbers given to them.

you might wonder what functions it can perform: from what i know, they are all listed in the [expr] helpfile – except the comparison operators < <= == != >= > which will also work, and which are quite handy in many situations, because they allow you to integrate a "gate" or an "if" into a longer expression.

-110


January 20, 2014 | 7:52 am

i think expr 5%12 isnt documented either.


January 20, 2014 | 8:49 am

You can learn about C operators and functions by Googling "C programming expression" and "C programming math functions". Then just compare that info to what’s provided in the help file and reference page for the expr object, imitate some of the examples given, and you should understand it quite soon.


February 1, 2014 | 6:08 am

Cheers for the responses Roman and Chris. Gave me what I needed to know. I thought I could avoid learning the C programming functions but I guess its gotta be done eventually.


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