Namespaces

Variants
Actions

20Concepts Lesson 03 - Messages Part 1

From Cycling '74 Wiki
(Difference between revisions)
Jump to: navigation, search
(Viewing Messages: The Max Window)
Line 26: Line 26:
 
== Viewing Messages: The Max Window ==
 
== Viewing Messages: The Max Window ==
  
(Needed: text)
+
One of the problems in sending the button a message is that you can't actually see the message. If you want to see the content of any message that is sent between Max objects, you need to use a special object: the {{maxword|name=print}} object. The print object will send any message it receives to a special window called "The Max Window", which is your status window for running programs.
 +
 
 +
You can see the Max Window in one of two ways. If you open the sidebar of your patch, you will see that there is an option to view the Max Window. You can also open the Max Window as a separate window by selecting it from the Window Menu.
 +
 
 +
Create a {{maxword|name=print}} object by typing "N" (for a new object), then entering "print" into the object. When you click off the object, it will instantiate with a single inlet. Disconnect the two buttons, then patch them both into the print object. Lock your patch and click on each button. You will see the "bang" message appear in the Max Window each time you click on a button.
  
 
== Data Types ==
 
== Data Types ==

Revision as of 02:59, 3 April 2013



(Needed: Example Video)

In this lesson, we will start diving into patching with "standard" Max objects - the low level objects that were used to build the Vizzie modules, and the core tools used for Max programming of any significant complexity. We will also learn a little about the Max environment itself, as well as the kind of data that we use inside of Max. Finally, we will use some of these elements to directly control some of our Vizzie modules.

(Needed: Fixture Patches with download)

Bang

One of the first things that you have to understand about how Max works is the concept of messages. A message is data that is sent from one Max object to another over the patch cord that connects them. The most basic message that is used is also a peculiar one: the bang message. A message that contains the statement "bang" has a particular meaning: it tells the receiving object to "do whatever it is meant to do".

The easiest way to create a bang message is using a standard Max object called a button. The button is an on-screen emulation of a simple pushbutton, but when the button is pushed, it sends a bang message from its outlet. It has a secondary purpose as well: whenever it receives a message (like a bang message), it will temporarily light up, then output a bang message as a response.

Let's wire up a very simple "standard" Max patch. First, create a new Max patch, then double-click on the blank space in the patch. This will display an Object Explorer - a scrollable interface for selecting Max objects. The second object shown is the button object; double-click on it to create a button in your patch (you may have to move the Object Explorer to actually see it). Double-click on the button icon to create a second button, then close the Object Explorer. Now, if you lock the patch, you can click either of the buttons and they will light up.

Since the button objects generate messages, let's hook these two buttons together to create a message network. Connect the output of one of the buttons to the input of the other, lock the patch, then click on the first button. You will notice that the second button lights up as well. This is because the first button, when clicked, sends a bang message down the patch cord to the second button. When that second button receives the message, it lights up as well.

Viewing Messages: The Max Window

One of the problems in sending the button a message is that you can't actually see the message. If you want to see the content of any message that is sent between Max objects, you need to use a special object: the print object. The print object will send any message it receives to a special window called "The Max Window", which is your status window for running programs.

You can see the Max Window in one of two ways. If you open the sidebar of your patch, you will see that there is an option to view the Max Window. You can also open the Max Window as a separate window by selecting it from the Window Menu.

Create a print object by typing "N" (for a new object), then entering "print" into the object. When you click off the object, it will instantiate with a single inlet. Disconnect the two buttons, then patch them both into the print object. Lock your patch and click on each button. You will see the "bang" message appear in the Max Window each time you click on a button.

Data Types

(Needed: text)

Variables

(Needed: text)

Using Messages to Control Objects

(Needed: text)

Web Links

(Needed: text and links)

Exercises

(Needed: text and exercises)


by Darwin Grosse and Cory Metcalf