# Max

## Autostart

The object loadbang sends a bang when a patcher is opened. This object is very useful if you want to automate the start of some objects or messages in your patch. In this example, the movie starts automatically by sending loadbang to read the movie file and the toggle when the patch is loaded.

## ASCII key

The key object tracks and outputs the ASCII values of the keys you press on the computer keyboard. You can then use those ASCII values to trigger other objects as shown in the example above. In the example, the 'c' key is used to trigger the note middle C (MIDI key number 60), and the 'r' key is used to turn on a stream of randomly-chosen notes C across the entire MIDI range (every multiple of 12 from 0 to 120) at a rate of ten notes per second.

## Plot a point in lcd

The lcd object is very handy for drawing simple 2D graphics. This patch shows how you can plot a point in an x,y coordinate graph using lcd. The goal is to be able to plot any x,y coordinate pair for which the numbers lie between -1 and 1.

## Use function to control line segments

This patch only work correctly in Max version 8 or later. In Max 8 the behavior of the line object was changed significantly. The most important change is that line can now accept list messages of four or more items, describing multiple line segments, as for the line~ object.

## Set minimum and maximum of two dials

This example shows how you can have two dials be “aware” of each other’s value, to constrain their minimum and maximum output. If you want to have two dials (or any user interface objects) that show a minimum value and a maximum value, but don’t want the minimum to exceed the maximum, you can use the value of the Min dial to constrain the minimum of the Max dial, and use the value of the Max dial to contrain the maximum of the Min dial.

## Make a yes-or-no decision with a given likelihood

The probablility P of something occurring is defined as the number of looked-for outcomes divided by the number of possible outcomes. For example, the probability that heads will show up on an unbiased coin flip is 1 (there is one instance of heads on the coin) divided by 2 (there are two possible outcomes, heads or tails), which means P = 0.5. With this definition, any probability can be described as a number in the range from 0 (impossible) to 1 (absolute certainty).

## Accelerando

This example demonstrates accelerando by playing 7-note scale (diatonic) over five octaves while increasing the velocity from soft to loud (20 to 125), and also the rate from 2 to 22 notes per second.

## Continuous control shapes

Above are examples of four types of non-linear contours of values from 0 to 127 that one could use as continuous controller information for a MIDI device.

## Ubutton ignore click

This example demonstrates a particular logical task: make one text clickable, and as soon as it is clicked upon, make it unclickable and set some other text to be clickable. In other words, have two texts, only one of which is clickable, and which swap their states whenever the clickable one is clicked.

## Set minimum domain value of the function object

This example shows you how you can set the minimum value of the domain in the function object while keeping the domain maximum the same.