You can control Max, MSP, and Jitter using the
message box object. Normally,
the
message box contains an object, and you click on it or replace a variable
typed into the
message box to send a message down a patch cord to another
Max object. However, if the message in a message box begins with a semicolon (;)
followed by the word max, any message which follows will be sent directly
to the Max application itself, just as though there were a
receive object named "max".
-
Add a message box to your Patcher, and type in a semicolon and the
word max (; max), followed by
the message you want to send to Max. Your message box can
contain variables (e.g. : max pupdate $1 $2).
When you click on the
message box or send it a
bang or a value,
the message will be sent to the Max application.
Here is listing of the messages you can send to the Max application using this technique:
The word buildcollective, followed by a reference name symbol and an output filename,
builds a collective using the patcher associated with the symbol. The collective is named
with the output filename.
The word
checkpreempt, followed by a symbol, sends the current Overdrive mode to the
receive object named by the symbol.
Causes Max not to show a Save Changes dialog when you close a window or quit, even if there are
windows that have been modified. This is useful in conjunction with the quit message below.
The word closefile, followed by a symbol, closes the patcher file previously opened with the
openfile message to Max associated with the symbol.
Causes Max to write the metadata information currently stored in the database
to a file. An optional argument can be used to specify a filename.
If no filename is specified, the metadata is backed up to a file in your preferences folder.
Causes Max to load metadata information from a previously stored file into
the Max database. An optional argument can be used to specify a filename - when
no argument is specified, Max will look for a backup file
from a previous call to db.exportmeta in your preferences folder.
Causes Max to recreate the database Max uses when operating (e.g. the
File Browser).
The word debug, followed by a zero or one, toggles the sending of Max's internal debugging
output to the Max window. Debug information may be of limited use for anyone who isn't debugging Max itself.
The word enablepathcache, followed by a zero or one, turns on (or off) Max's search path cache.
This should only be done if you noticed unusual behavior when opening files.
(Macintosh only) The word enablerefresh, followed by a zero or one, toggles an alternative
to the standard way in which the screen contents are updated, resulting in better visual performance.
This feature is enabled by default. The rate at which refresh is done can be set by using the
setrefreshrate message.
List all of the external objects currently loaded in the Max window.
The word fileformat, followed by two symbols that specify a file extension and a
four-character file type, tells Max to associate a filename extension with a particular
filetype. The message max fileformat .tx TEXT associates the extension .tx with TEXT
(text) files. This allows a user to send a message read george and locate a file with
the name george.tx. It also ensures that files with
the extension .tx will appear in a standard open file dialog where text files can be chosen.
The word fixwidthratio, followed by a floating-point number, sets the ratio of the box
to the width of the text when the user chooses Fix Width from the Object menu. The default
value is 1.0. A value of 1.1 would make boxes wider than they needed to be, and a value of 0.9
would make boxes narrower than they need to be.
The word
getdefaultpatcherheight followed by a symbol used as the name of a
receive object, causes Max to report the current default patcher height in pixels
to the named
receive object (See also the
setdefaultpatcherheight
message to Max.)
The word
getdefaultpatcherwidth, followed by a symbol used as the name of a
receive object, causes Max to report the current default patcher width in pixels
to the named
receive object (See also the
setdefaultpatcherwidth message to Max.)
The word
getenablepathcache, followed by a symbol used as the name of a
receive
object, will report whether the path cache is enabled to the named
receive object.
(See also the
enablepathcache message to Max.)
(Macintosh only.) The word
getenablerefresh, followed by a symbol used as the name
of a
receive object, will report whether enhanced refresh is enabled to the
named
receive object. (See also the
enablerefresh message to Max.)
The word
geteventinterval, followed by a symbol used as the name of a
receive
object, will report the event interval to the named
receive object. (See also the
seteventinterval message to Max.)
The word
getfixwidthratio, followed by a symbol used as the name of a
receive
object, reports the current fix with ratio value to the named
receive object. (See
also the
fixwidthratio message to Max.)
The word
getpollthrottle, followed by a symbol used as the name of a
receive object, reports the current poll throttle value to the named
receive object. (See also the
setpollthrottle message to Max.)
The word
getqueuethrottle, followed by a symbol used as the name of
a
receive object, causes Max to report the current queue throttle
value to the named
receive object. (See also the
setqueuethrottle
message to Max.)
(Macintosh only) The word
getrefreshrate, followed by a symbol used as
the name of a
receive object, causes Max to report the current refresh
rate in Hertz to the named
receive object. (See also the
setrefreshrate
message to Max.)
The word
getruntime, followed by a symbol used as the name of a
receive object,sends a 1 to the named
receive object if the
current version of Max is a runtime version, and a 0 if not.
The word
getsleep, followed by a symbol used as the name of a
receive object, causes Max to report the sleep time to the named
receive object. (See also the
setsleep message to Max.)
The word
getslop, followed by a symbol used as the name of a
receive object, reports the scheduler slop value to the named
receive object. (See also the
setslop message to Max.)
The word
getqueuethrottle, followed by a symbol used as the name of
a
receive object, reports the maximum number of patcher UI update events
processed at a time to the named
receive object. (See also the
setsysqelemthrottle message to Max.)
The word
getsystem, followed by a symbol used as the name of a
receive object, will report the name of the system (macintosh
or windows) to the named
receive object.
The word
getversion, followed by a symbol used as the name of a
receive object, will report the Max 5 version number
(e.g. 5.1.3 is reported as 1300) to the named
receive object.
Hides the cursor if it is visible.
Hides the menu bar. Although the pull-down menus are not available when the
menu bar is hidden, menu shortcut (accelerator) keys continue to work.
The word htmlref, followed by an object name as a symbol, looks for
a file called <object-name>.html in the search path. If found,
a web browser is opened to view the page.
The word interval, followed by a number from 1 to 20, sets the timing
interval of Max's internal scheduler in milliseconds. The default value is 1.
This message only affects the scheduler when Overdrive is on and scheduler
in audio interrupt (available with MSP) is off. (When using scheduler in
audio interrupt mode the signal vector size determines the scheduler interval.)
Larger scheduler intervals can improve CPU efficiency on slower computer
models at the expense of timing accuracy.
The word launchbrowser, followed by a URL as a symbol, opens a web
browser to view the URL. For example:
; max launchbrowser http://www.cycling74.com
The word maxcharheightforsubpixelantialiasing, followed by a number,
sets a threshold font size (in points) for native subpixel aliasing.
Since the look of subpixel antialiasing may be undesirable when working with
large fonts as compared to regular antialiasing, this attribute lets you
specify a threshold font size; if a font is larger than the specified
size, it will be rendered using regular rather than subpixel antialiasing.
Note that Max honors your computer's system preferences - Max won't use
subpixel aliasing if you've disabled it for your system.
Setting this attribute value to zero value is 0 will always use regular
antialiasing, and setting a very high value will always use subpixel
antialiasing (unless it is disabled in system preferences).
When using the runtime version of Max, maxinwmenu, followed by the number 1,
will place an item called Status in the Windows menu, allowing users to see the
Max window (labeled Status in the runtime version). When maxinwmenu is followed
by 0 the menu item is not present. The default is for the Status item to be present in
the Windows menu.
The word midi, followed by a variable-length message, allows messages to be sent
to configure the system MIDI object. The following is a list of the available options:
Prints the names of all current MIDI devices in the Max window. (See also MIDI
Messages to Max, above.)
The word nativetextrendering, followed by a zero or one,
toggles between using JUCE font rendering (0) and the platform-native
font rendering for your computer (1) when displaying text in Max.
(Macintosh) The word notypeinfo, followed by zero or one, sets whether Max saves files
with traditional Mac OS four-character type information. By default, Max does save
this information in files.
The word
objectfile, followed by two symbols that specify an object name and a
file name, creates a mapping between the external object and its filename. For example,
the
*~ object is in a file called
times~ so at startup Max executes the
command
max objectfile *~ times~.
The word openfile, followed by two symbols that specify an reference name and
a file name or path name, attempts to open the patcher with the specified name. If
successful, the patcher is associated with the reference symbol, which can be passed
as argument to the buildcollective, buildplugin, and closefile messages to Max.
The openfile message is intended for batch collective building.
List the current search paths in the Max window. There is a button in the File Preferences
window that does this.
innum specifies an input port, outnum specifies an output port, portname
is the name of the port as a single symbol (i.e. It is necessary to use double quotes).
An abbrev value is 0 for no abbrev (- in menu), 1 for 'a' and 26 for 'z'.
Enables (1) or disables (0) the port specified by portname. All ports are enabled
by default.
Similar to portabbrev, but offset is the channel offset added to identify input
or output ports when a MIDI object can send to or receive from multiple ports by channel
number. Must be a multiple of 16 (e.g. max midi portoffset innum PortA 16 sets the
channel offset for PortA device to 16).
The word preempt, followed by a one (on) or zero (off), toggles Overdrive mode.
The word pupdate, followed by two integer values that specify horizontal and
vertical position, moves the mouse cursor to that global location.
Quits the Max application; equivalent to choosing Quit from the File menu.
If there are unsaved changes to open files, and you haven't sent Max the clean
message, Max will ask whether to save changes.
Causes all Max windows to be updated.
(Macintosh only) The word setrefreshrate, followed by a number, sets the rate,
in frames per second, at which the visual display is updated. On Macintosh systems, the rate
at which the screen is refreshed is unrelated to the rate at which you change its contents.
Better visual performance can be achieved - at the cost of a slight performance decrease
in Jitter, and little or no performance decrease for audio processing - by specifying a
higher frame rate. When enabled using the enablerefresh 1 message, the default rate is
28.57 FPS. Refresh enable is off by default.
The word runtime, followed by a zero or one and a message, executes the message if
the current version of Max is a runtime version (1) or non-runtime (0).
The word
sendinterval, followed by a symbol, sends the current scheduler interval to
the
receive object named by the symbol.
The word
sendapppath, followed by a symbol, sends a symbol with the path of the Max
application to the
receive object named by the symbol.
The word setdefaultpatcherheight, followed by an integer value greater than 100,
sets the default patcher height in pixels.
The word setdefaultpatcherwidth, followed by an integer value greater than 100,
sets the default patcher width in pixels.
The word seteventinterval, followed by an integer value, sets the time between invocations
of the event-level timer (The default value is 2 milliseconds). The event-level timer handles
low priority tasks like drawing user interface updates and playing movies.
The word setmirrortoconsole, followed by a 1 or 0, turns on or off (default is 0, off) mirroring of
Max window posts to the system console. The system console is available on the Mac using Console.app, or on
Windows using the DbgView program (free download from Microsoft).
The word setsleep, followed by a number, sets the time between calls to get the next
system event, in 60ths of a second. The default value is 2.
The word setpollthrottle, followed by an integer, sets the maximum number of events
the scheduler executes each time it is called (The default value is 20). Setting this value
lower may decrease accuracy of timing at the expense of efficiency.
The word setqueuethrottle, followed by an integer value, sets the maximum number of events
handled at low-priority each time the low-priority queue handler is called (The default value
is 2). Changing this value may affect the responsiveness of the user interface.
The word setslop, followed by a floating-point value, sets the scheduler slop
value - the amount of time a scheduled event can be earlier than the current time
before the time of the event is adjusted to match the current time. The default value is
25 milliseconds.
The word setsysqelemthrottle, followed by a number, sets the maximum number
of patcher UI update events to process at a time. Lower values can lead to more
processing power available to other low-priority Max processes, and higher values
make the user interface more responsive (especially when using many bpatchers).
Shows the cursor if it is hidden.
Shows the menu bar after it has been hidden with hidemenubar.
Prints the number of symbols in the symbol table in the Max window.
The word system, followed by the name of an Operating System (windows or macintosh)
and a message, will execute the message if Max is running on the named OS.
The word useslowbutcompletesearching, followed by a one (on) or zero (off), toggles
complete file searching. When enabled, it causes files not found in Max's cache of the search
path to be searched in the file system. This is necessary only in extremely rare cases
where the file cache does not update properly. One such case is copying a file into the
search path using a version of the Mac OS prior to 10.5.5 over a network. This option
may cause patcher files to be loaded more slowly. The setting defaults to off with each
launch of the application, and is not stored in the user's preferences.
useslowbutcompletesearching 0 turns the setting off.
Messages for creating new MIDI ports:
Creates a new port for the specified driver. On Windows, the only driver that supports creating new ports is
midi_dm, which creates a new port to talk to the
DLS synthesizer. On the Mac, specifying the
coremidi driver name creates a virtual output port you can use to communicate with other MIDI applications, while specifying the
augraph driver name creates another port exclusively assigned to the
DLS synthesizer.
Deletes a port created with the createoutport message. drivername and portname should be the same as the arguments originally passed to createoutport.
Loads a type 1 or 2 DLS Bank, where filename is the name of an existing DLS
bank file, and portname is the name of the port that will use this bank.
If portname is omitted, all DLS ports will use the bank. On Mac OS X, the
folder /Library/Audio/Sounds/Banks is added to the search path when looking
for a DLS bank file.
Loads the DLS default GM Bank.
Turns reverb on or off. By default reverb is off in both augraph and midi_dm.
(midi_dm only) Sets the MIDI Output Latency where time is a value in
milliseconds and portname is the port that is set to this value.
The
inportinfo and
outportinfo messages send information about MIDI
ports to named
receive objects. The information is contained in an
infolist message with the following arguments:
the port's name (symbol)
the port's driver name (symbol)
the port's unique ID (int)
the port's abbreviation (int)
the port's channel offset (int)
whether the port is enabled or disabled (one if enabled, zero if disabled)
whether the port was created dynamically (one if yes, zero if no)
(Mac only) Adds a virtual MIDI input port, where portname is the
name you assign to the port, and drivername should be set to coremidi. Other MIDI applications can send messages to Max using this port.
Deletes a port created with the createinport message. drivername and portname should be the same as the arguments originally passed to createinport.
Ports created with the createoutport and createinport messages are not saved as a part of your MIDI setup preferences.