Relationship Between Max and Jitter Data Types

adamgolding's icon

The tutorials are unclear as to how Jitter data types and Max data types relate. For instance, it says that scalebias converts to floats internally, but doesn't specify if they mean float32 or float64--which is it, and how would I find this in the documentation? It also says that chars are represented as ints or as floats--how do I determine which in a given case, and how can they be treated as ints if Jitter does not have an int data type, but instead just has char, long, float32, and float64? Also, are the two representations of char actually separate data types, or are they two display formats for one data type?

Is there a handy table somewhere comparing the data types in max/msp/jitter and the other 'friend' languages, i.e. Java, Javascript, and C?

Christopher Dobrian's icon

There is some info about Jitter data types in the chapter "What is a Matrix?" under the heading 'The Data in a Matrix'. There's nothing particularly mysterious about that data types in Jitter, MSP, Max, or JavaScript. They're all pretty much what they say they are.

When we say "int" in Max, we really mean long integer, 32-bits, a.k.a. "long" in Jitter. There's no real case of a short (16-bit) int in Max.

Float data and MSP signal data are 32-bit floats when passed in Max, regardless of whether they're treated internally as doubles in any given object.

Char data has only 256 possible values, usually shown as ints 0 to 255, but can sometimes usefully be thought of as float values 0. to 1. with resolution of about 0.004. (See example below.)

Max Patch
Copy patch and select New From Clipboard in Max.

One often specifies the attribute values of Jitter objects as floats, even if the data being processed is of type char. Does it really matter whether to you whether jit.scalebias uses double or float internally? (It probably just uses char.)