Later Tutorials Max

15
Trevor Grahl, Oct. 19 th , 2006 MAX REVIEW Some Operators == - Compare two numbers. Output 1 if equal, otherwise, 0. % - divide two numbers, output the remainder. The right inlet is the divisor (the smaller) and the left is the number to be divided. / - same as above, except does not output the remainder, puts out result instead. ! - reverses the order of an operator - Usually division/subtraction, etc. The right inlet contains the number that is initially stored and the left inlet works on that. != compares two numbers and outputs 1 if they are not equal. <= - is less than or equal to, comparison of two numbers. >= - greater than or equal to comparison of two numbers. && - output a 1 if both numbers are non zero. Tutorial 30 Iter object – receives a list of numbers in its inlet and breaks the list up into individual elements and send the numbers out in sequential order rather than all at the same time. (Its as if Iter puts commas between the elements). Unpack – when a list received, each element of the list is sent out a different outlet. Outlets determined by number of arguments. By default, unpack has 2 outlets, both with 1

description

Text upload!

Transcript of Later Tutorials Max

Tutorial 30

Trevor Grahl, Oct. 19th, 2006

MAX REVIEW

Some Operators

== - Compare two numbers. Output 1 if equal, otherwise, 0.

% - divide two numbers, output the remainder. The right inlet is the divisor (the smaller) and the left is the number to be divided.

/ - same as above, except does not output the remainder, puts out result instead.

! - reverses the order of an operator - Usually division/subtraction, etc. The right inlet contains the number that is initially stored and the left inlet works on that. != compares two numbers and outputs 1 if they are not equal.

= - greater than or equal to comparison of two numbers.

&& - output a 1 if both numbers are non zero.

Tutorial 30

Iter object receives a list of numbers in its inlet and breaks the list up into individual elements and send the numbers out in sequential order rather than all at the same time. (Its as if Iter puts commas between the elements).

Unpack when a list received, each element of the list is sent out a different outlet. Outlets determined by number of arguments. By default, unpack has 2 outlets, both with an initial value of 0. If there are extraneous elements, unpack just ignores them.

Pack packs a list and the initial values stored by each one.

Swap reverses the sequential order of elements it receives. But it sends the received number out its right outlet first then send the number that was received earlier in the right inlet out its left outlet.

Tutorial 31

(NB Remember timer?)

Clocker instead of sending out a bang, clocker sends out time. This info can cause values to change in some manner correlated with passing time.

Counter counts the number of bang messages it has received. Metro-counter combo is an effective way to increment or decrement a value repeatedly. Initial Argument 0 counts upward. 1 is downward and 2 is to go back and forth between up and down. The second argument sets a minimum value of the count, and the third the maximum value. When the count is reached, a 1 is sent out the right outlet. NB - Counts BANGS, does not count time!

Line outputs numbers in a linear ramp from a starting value to some ending value over a specific time period. The first argument sets the starting value and the second argument sets the grain (the time interval at which the numbers will be sent out). When a time period is input into the middle outlet and ending value in the left inlet, line outputs numbers in a linear progression from the starting value to the ending value over the specified time period. If no time period received at the same time, line jumps to and outputs the new value immediately.

Tempo like another metronome, but operating in a somewhat more traditionally musical terms than the millisecond specifications necessary with clocker, metro, etc. The first argument is the tempo. Other inlets specify what fraction of a whole note to output.

Tutorial 32

Funbuff Number values are stored with an index number (address), then when you want to recall a value you just specify the address where it is stored. The table functions similarly.

Tables number by itself in the left inlet of table specifies an address and the value stored at that address is sent out the left outlet. With get info the size of the table is the number of storage addresses and the range the displayed values. signed causes negative as well as positive values. Tables can understand messages in the left inlet. To store values in a table object without opening its graphic editing window, send the value in the right inlet and send the address where you want to store it into the left inlet. (You can also send the address and value in the left inlet together as a list).

Uzi when bang is received, it sends a specific number of bang messages out its left outlet as fast as possible. It also counts as it goes and sends these out the right outlet. Useful for sending out a series of messages at the same time such as a series of address and values for initializing a table. (Uzi starts from 1). An int in the right inlet of of Uzi sets the number of times to bang, and a bang starts it. An int in the left inlet sets the number of times to bang and starts it.

Tutorial 33

Histo keeps and internal histogram (graph of frequency distribution) of the numbers it has received. Receives a number from 0 127 in left inlet, adds that number to internal histogram, then sends the number of times it has received that number out the right outlet, and the number itself out the left outlet. Can be sent directly to table. Addresses in table correspond to the numbers received by histo and the values in the table tell the frequency of occurrence of each number. Works with lists, etc. (see page 155). Clear message in left inlet of histo or table sets all values to 0.

This feature of table makes it perfect for storing a probability distribution..

Togedge is used to detect a change in zero/non zero numbers. Sends a bang out one of its outlets only when the number it receives represents a change from 0 to non-zero or vice versa. (In other words, when the numbers change from 0 to non 0, a bang is sent out its left outlet, and when they change from non-zero to 0, the bang is sent out the right outlet.

Also, by sending a bang to a table that contains a histogram, you can cause numbers to be sent out of the table with the likelihood of getting a number based on how frequently it has occurred in the past.

Tutorial 34

Midiin outputs each byte of MIDI data it receives. Midiout object transmits any number it receives in its inlet. You can set these objects to transmit or receive through a specific port by typing in a letter argument, device name, or by sending a port message in the inlet. Sometimes can use computer as a Midithru box by hooking midiin a to midiout a

Midiparse interprets raw MIDI data from Midiin or seq and sends each type of data out a different outlet. (Large object, many outlets). Midi data is parsed into separate fragments.

Midiformat receives data in its various inlets and prepares different types of complete MIDI messages which are sent by Midiout. (Opposite of Midiparse). [notedata, key pressure, control change, program change, aftertouch, pitchbend, channel]

Sxformat allows one to type in arguments which it sends out one at a time in individual bytes. You can include changeable arguments in sxformat which will be replaced by incoming numbers before the message is sent out. Changeable arguments in this case: contain the letter I to indicate they are integers (as in $i1), are preceded by the word is, and are bounded on either side by a slash. (/). %x sign is used to limit changeable arguments in some way, where x equals the upper limit.

Capture stores a list of all the numbers it receives. You can view the list in a text window by double-clicking on the capture object and copy the contents of that text window into a table window. The capture object is useful for viewing any stream of numbers when you want to figure out what numbers are coming out of an outlet.

Sysexin receives system exclusive messages, but to send , you need to formate them yourself and use Midiout. This is were we use Sxformat.

Examples of Sysex Message: Status byte of any sysex message is always 240, second byte is the Manufacturer ID, (each major synth manufact. has one), and always ends with byte 247.

Note offs 1) note-off message with a release (key-up) velocity and the other is a note-on message with a key-down velocity.

Xnotein (sensitive to key up velocities).

Tutorial 35Seq records and plays back raw MIDI data in conjunction with midiin and midiout. It understands messages stop, start, record, etc. Output of seq can be transmitted directly to the synth, or Max (Midiparse) for further processing. Seq is basically a sequencer of raw MIDI bytes. The speed of playback can be controlled, read and write from files, and record from live MIDI input.

Flush (turns off held notes!)

Follow similar to seq, except in its ability to record MIDI data. Follow can record a sequence of single numbers that are not in the form of complete MIDI messages, (such as the pitches from MIDI note-ons). Follow stores recorded MIDI data and then uses that as a sequence for a musical score. When provided with argument, follow looks for it. When it is received, follow sends that pitch out its right outlet and the index out its left. Using the index numbers from the left outlet of follow as addresses of a table or some other array object like funbuff, the indexes trigger some other values.

Tutorial 36

Mtr Maxs most versatile sequencer. Record and play up to 32 different tracks of messages: numbers, lists or symbols. Tracks can be recorded and played back either separately or all together. You can play back information from sliders and dials this way. # of tracks specified by an argument. The leftmost inlet is a control inlet for receiving command messages and the others are for messages you want to record. Stop, Play, etc are applied to all tracks, unless they include an argument, specifying a unique track to which the message applies. A mute message it continues to play, but suppresses the actual output. You can step through the messages using next instead of playing them back at their original speed.

Tutorial 37

Coll the most versatile data structure in max (short for colletion). Stores a collection of many different messages, of any type and length and can give each message either a number address or a symbol address. If coll receives a list in its inlet, it uses the first number in the list as an address, and stores the remaining items in the list at that address. (Remember, list is any space-separated set of items). If the message begins with store coll uses the first item after the word store as its address and stores the rest of the message at that address.

Thresh Like iter in reverse. Numbers which are received within a certain threshold of time are packed together in order. The threshold is the maximum number of ms between any given number and the previous one. When no new number is received, the numbers are sent out as a list.

Menu used to create pop-up menu in a Patcher window. Evaluate text item menu sends the text of the item out the right outlet. (Provides an easy way of doing message boxes).

Preset If the left outlet of preset is connected to the inlet of other user interface objects, it stores and recalls the settings of only those objects. If the right outlet of preset is connected to the inlet of other objects, preset stores and recalls the settings of all user interface objects in the window except those objects. If nothing is connected, preset stores all user interface objects on the page. To clear a preset, you must hook up clear or to store, store or recall etc.

Expr arguments to expr make up a mathematical expression (formula) in a format similar to C programming language.

If (In Pascal, this is expressed as IF condition THEN statement ELSE statement) ie, if a certain condition is met, do one thing. Otherwise, do something else. If uses an if/then/else format. If the comparison in the arguments is true, (does not = 0) the message after the word then is sent out, otherwise, the message after the optional word else is sent out.

Tutorial 39

Mousefilter Helps you see the exact value that will be sent out a slider or dial before it actually is sent out. Receives the numbers in the inlet, but passes them on only when the mouse button is up.

Mousesate When mousestate receives a bang in its inlet, it reports the current horizontal and vertical location of the mouse out its left-middle and middle outlets. If mousestate receives a 0 message, it interprets this as the new starting point. It also reports the status of the mouse button 0 and 1 (off and on correspondingly).

Tutorial 40

Loadbang sends a bang once when the Patcher that contains it is opened (loaded into memory). This allows one to trigger certain actions immediately when a patcher is loaded. Loadbang can be used to open gate and switch objects (which are closed when a patch is opened), start timing objects such as metro, or supply initial number values to an object such as number box.

Closebang counterpart to loadbang which is used to trigger actions such as turning off metro or resetting the contents of a table.

Pcontrol When pcontrol receives an open or close message in its inlet, it opens or closes the window of any subpatch objects connected to its outlet.

Led similar to toggle, except that led outputs only 0 or 1, indicating the zero/non-zero status of the number is receives. When led receives a bang, it flashes and outputs 1.

Active Automatic control object. Enables objects to run if the window is active. If the window is active, it sends out a 1. If not, it sends out a 0.

Extraneous Tutorials

Abs - absolute value of input. Float and int version.

Append - Add one or more items to the end of a list or message. [append 20 30 40]. Append adds these to a message. Set changes the items that are appended.

Bangbang - Outputs bangs from right-to-left. Argument gives the number of outlets, (default two). It takes in any message in the inlet and sends 'bang' out its outlets, right to left. Also can be abbreviated "b".

Borax - Reports information about note-ons and note-offs. Useful for recording note information for sequencers and arpeggiators. Inlets pitch and velocity, and bang in right-most inlet. Resets, sending out all currently held down notes with velocities of 0.

Buddy - Synchronize input from different sources. Buddy takes an int argument for the number of inlets and outlets. The default (and minimum) is 2, and there is no set maximum. Buddy accepts ints, floats or symbols. Buddy is useful for ensuring that two values (sent from send objects for example) come out in a specified order (right to left!). Buddy only sends its input when all inputs have been received. All inputs are cleared after.

Funnel - Map an integer into a list identified by inlet number. Funnel makes lists that identify the source of a number. It can be used to store numbers into a table or coll based on their source. It can be used in conjunction with env and spray.

If - Conditionally sends messages. Used in conjunction with 'then' and 'else'. For instance, if $1 < $2 then set $1 else set $2.

IncDec - a simple increment/decrement object for number boxes. Only works with ints!

Midiin - Outputs incoming MIDI bytes. Midiin produces MIDI messages as a series of individual bytes.

Midiout - Send intergers as raw MIDI data. For example, 144, 60, 60 - start a note. 144, 60, 0 - stop. Switch ports - send message "port b" or just "b".

Pack - makes numbers or symbols into a list. Number in left inlet sets a value and outputs the list. A bang in this inlet will also output a list. Arguments set the types and initial values of the list items. (Remember, unpack sends list elements out separate outlets - with 0s as arguments).

Slider - Somewhat outdated graphical slider.

Uslider - graphical slider.

Speedlim - Limit the speed of messages passing through. Optional argument initializes the speed. Int in left repeats to outlet at a possibly reduced rate, int in right inlet sets speed in ms.

Pcontrol - remote control of patcher windows. Receives messages in left inlet and processes accordingly.

Route - direct messages and numbers to different outlets. Route takes a message and tries to match its first argument to route's own arguments. The rightmost outlet passes any message that matched no other choice, so you may gang routes to get more choices.

Scale - maps input range of values to output range. Argument 1 is input low, 2 is high, 3 is output low and 4 is output high. 5 is exponential base value (default, 1 = linear).

Split - looks for a range of numbers. Split takes an 'int' and puts it out the left outlet if the value is inclusively between the two argument values, otherwise it puts it out the right outlet.

Print - Easy - but remember how the message is printed! (eg)

Print: put Ethel back in the refrigeratior.

Print: (message).

However, if an argument is indicated, then print is replaced by the argument. Instead of print: bang, we have

X: bang.

Random - Generates a random number. Bang in left inlet and range can be set in the right, or as an argument. Random generates a number between 0 and one less than its range.

Timer - reports elapsed time between events. Timer takes no arguments. Both inlets take a bang. Timer restes time to zero and starts keeping time when a 'bang' is sent to the left inlet. Time in milliseconds.

Value - Share stored values among several objects. Value takes a symbol (foo for example) as an argument. All value objects with this name are linked. If you send any one a message (number, list, etc.) it is set for all of them. You can get the contents of a particular value object by sending it a bang.

MSP Objects

Biquad~ - Digital filter specified by coefficients. Biquad~ implements a two-pole, two-zero filter using an equation. One can specify the coefficients (a0, a1, a2, b1, b2) as signals or floats.

Buffer~ - Essentially a memory bank. Buffer~ works in conjunction with many different objects, such as play~/groove~ (to play from the buffer) record~ (to record into the buffer), info~ (to get info about the buffer), cycle~ (to specify a 512-point waveform) and wave~ (to specify a waveform. Arguments can be buffer name, optional filename to read or optional intial length in milliseconds and optional number of channels.

Cycle~ - Table-lookup oscillator or function generator. - Table-lookup oscillator or function generator. Cycle~ uses a stored table of 512 samples to generate functions. By default it uses a sine wave, but you can give it a function stored in a buffer~ object. The argument can set the frequency, but it can be driven by a phase only (if one supplies a phasor~ (arg) object in the right inlet). Must have same argument as buffer, to play from.

Line~ - Generate signal ramp or envelope, similar to line. Common way to generate a ramp - set initial value followed by a list with a new value and target time. (In format 0, 1 2000). Ie - go from 0 to 1 in 2000 ms.

Dspstate~ - reports information about current DSP settings. Dspstate~ can be used for calculations that require the sampling rate of current DSP processing block size. You can use the leftmost outlet to trigger some event when the audio is turned on or off. Dspstate~ outputs the state information automatically whenever the audio is turned on or off, or when a bang is sent to the left inlet. Connecting a signal to the inlet reports the information about that signal. Dspstate~ will not output anything if the audio is not turned on in its window.

Gain~ - Logarithmic fader for signals. Slider that scales signals. Signal must pass through gain~ in order to be processed.

Filtergraph~ - Filter graph for displaying filter response and generating biquad coefficients.

Groove~ - Varitable-rate looping (hence, groove!) sample playback from a buffer~. One can start set sample position or play normal speed forward (-1 is backward) or loop. Left inlet takes play/stop commands and middle sets min loop point. Right sets end loop point. The argument of buffer locks in with the argument of groove~, just like cycle.

Number~ - signal monitor/generator. When the blue/green wave is present, number~ can display the incoming signal, or the outgoing signal (when the arrow is present).

Sflist~ - Stores a list of preloaded cues for sounds files that can be accessed by multiple sfplay~ objects. Each sflist~ object has a unique name that sfplay~ objects use to refer to its cues

Play~ - Sample playback based on a position within a buffer~. Play~ is a playback interface for buffer~ that plays back samples based on an offset within the sample. Play~ can be typically used with line, but can be used with any signal that generates a changing position value.

Sig~ - Output a constant value as signal. This object converts and int or float into a signal. It also accepts a signal in which it ignores.

Selector~ - Switch output among several input signals. Version of Max switch object for use with signals. It takes an argument for number of inputs (one is default) and lets you turn incoming signals on and off by sending an int to its left inlet.

Extraneous Information

Messages without commas are interpreted as a list. For example MIDI information contains a list of three items: pitch velocity and duration. With commas, however, the information is interpreted as three separate messages.

Changeable arguments ($) can be used to store a message sent to it. When the message box receives a triggering message in its inlet, each changeable argument is replaced by the corresponding item from the triggering message. The co-argument to the dollar sign is the #. These work in abstractions or sub patchers that can take arguments. The # is replaced by the argument provided. Note that a backslash before will negate the effectiveness of these objects, so that one is free to use such symbols as the dollar sign or # and not have Max interpret them as changeable arguments.

Semicolon: (;). When a semicolon appears in a message box, the first word after the semicolon is interpreted as the name of a receive object. The rest of the message (or up to the next semicolon) is sent to all receive objects with that name, instead of coming out of the message box's own outlet.

10