(maxmsp) Programming and Max Basics

Basic things you should know about programming and Max/MSP.

Programming Basics

Objects act on data. They do something. The object may already contain the data it needs to act, or it may receive the data from some other object.

Messages are the data being passed between objects.

In Max/MSP/Jitter anything that you place into the patcher window is an object in programming terms. Max may have its own term for the thing, but it is an object. Messages travel between objects through the patch-cord connections (and in other ways that we will talk about later).

Max Basics – Setup

It helps to configure Max to work in certain ways that may or may not be the standard preferences set in the MusicTech studios. I like the following settings:

  • Preferences | Assistance: Help in locked patchers turned on
  • Options: on (checked) for All Windows Active, Auto Fix Width, Segmented Patch Cords, Assistance, Float Display Correction, and Help in Locked Patchers
  • Options | MIDI Setup: don’t worry about the abbreviations for now


The Max Window is the program’s standard out – where the program displays error messages, and the output of print statements.

The patcher window is where you create your program. You can edit the program with the window unlocked. You typically run the program locked, but the program can accept input and run even if unlocked. There are two views to the patcher window – patcher and presentation. We’ll be sticking to patcher view for the time being.

Help is embedded into the program. Option-click (alt-click) on any object and a working patcher window will open that demonstrates the object’s functions. It will usually have links to other related objects as well. Within the help patcher you will find a link at the top right to open the reference page for the object. Documentation is handled by a browser within the program. Tutorials are located in the reference pages. You can also open help from the Help menu.

Object Types

Text objects are the standard max objects that are contained in rectangle-like boxes. Each object has a text name. Many have additional arguments and/or attributes that can also be typed into the rectangle.

Interface objects include dials, sliders, graphic keyboards, buttons, toggles, and switches. They can be manipulated by the mouse or keyboard to store and send messages.

Message objects allow for (mostly) static data to be placed into the program and transmitted under certain conditions, such as clicking on the message box, and sending a bang or any message to the box.

Comment objects are used for commenting your patch – i.e., explaining to yourself and others what the patch is doing at particular points.

Number boxes are interface objects that come in two types: integer and floating point. Floating point boxes are not as useful for basic MIDI programming.

You will greatly speed up your programing in Max if you learn the keyboard shortcuts for creating certain types of objects. (Keyboard shortcuts are money.)

  • n creates a new object
  • m creates a new message object
  • b creates a button (bang)
  • t creates a toggle
  • i creates an integer number box
  • f creates a floating-point number box
  • c creates a comment

Objects can be resized by dragging on their right edge. Clicking on their left edge brings up an info box about the object that you can use to set attributes.

Connecting and Selecting Objects and Patch Cords

Objects have inlets and outlets. Hovering the mouse over an inlet or outlet will bring up assistance that tells you the inlet/outlet function. You cannot connect outlets to inlets if the data type of the message is not one that the inlet will accept.

You can select objects in all the usual ways: mouse click, click and drag, shift-click to add to or remove from the selection, etc. To select patch cords you have to option-click, or option-drag the mouse over them.

Data Types (Messages) in Max/MSP/Jitter

The main types of data in Max are integers, floats (floating point numbers), bangs, symbols, and lists. Integers and floats are fairly obvious. Bangs are output by buttons. The easiest way to think about them is that bang means “do it.” Symbols are usually text (letters or strings or letters), although numbers can be treated as symbols in some cases. A bang can be thought of as a special symbol.

The bigger issue is how certain data types are handled when messages pass between objects. Integers pass to objects expecting floats unchanged (the decimal portion is added). Floats however are truncated (not rounded) when passed to objects expecting integers. The reference page of each object specifies what types of messages can be received and sent from each inlet/outlet, and how the object responds to them.

Right-to-Left Order of Operation

Order of operation is important in any programming, especially graphical programming languages. Max operates on a principle of right-to-left operation. If one message is sent out three patch cords, it will go out the patch cord that travels to the right-most object first. The message will continue through a chain of connections until it reaches an end. Then the message will go out the next patch cord to the next object to the left, and follow its chain. If one message travels two patch cords that end in objects that are vertically aligned, then the message first goes out to the bottom object, then the top.

Most objects are programmed to respond to this order or operation by accepting (storing) messages in their right inlets, and then storing and triggering the operation of the object when a message comes in the left-most inlets.

To summarize order of operation:

  • Right to Left
  • Bottom to Top


Leave a Reply