mc.pattern~ Reference

Signal Pattern Sequencer and Recorder

mc.pattern~

Description

The mc.pattern~ object holds patterns -- sequences of signal values. Like seq~, playback is driven by a phasor, but unlike seq~, the output consists of signals on one or more audio channels. In addition to event recording, mc.pattern~ has an interface for generating events from Max messages or via algorithms.

Arguments

channels [int]

If present, a typed-in argument sets the number of channels of patterns the object contains. This can also be set via the chans attribute.

Attributes

autorecord [int] (default: 0)

Set autorecord to 1, and mc.pattern~ begins recording incoming numbers received in its inlet to successive channels starting with channel 1. Once each channel has reached the end (because the incoming phasor signal resets to 0), recording switches to the next channel. When recording has occurred once on all channels, autorecord switches itself off. To turn off autorecord before the automatic shutoff occurs, send the message autorecord 0. Autorecord is the only way int and float values can be recorded. Channel-specific recording (via the record message) requires a list consisting of a channel and value. Note that the times given to recorded values are relative to the current phasor input value, not the time you started recording.

chans [int]

Sets the number of channels storing patterns as well as number of signals in the multi-channel signal. If the chans attribute is set while the audio is on, the change does not take effect until the audio is restarted.

defaultmute [int] (default: 0)

Sets a default mute setting for all channels as a typed-in argument. After the object has been created, changing defaultmute has no effect. The default value of defaultmute is muting off.

defaultquantize [float] (default: 0.)

Sets a default record quantization setting for all channels as a typed-in argument. After the object has been created, changing defaultquantize has no effect. The default value of defaultquantize is 0.

defaultramp [int] (default: 0)

Sets a default ramp setting for all channels as a typed-in argument. After the object has been created, changing defaultramp has no effect. The default value of default is ramping off.

defaultwrap [int] (default: 0)

Sets a default wrap setting for all channels as a typed-in argument. After the object has been created, changing defaultwrap has no effect. The default value of defaultwrap is wrapping off.

embed [int] (default: 0)

When embed is enabled, the current state of the object is saved with the patcher.

immediate [int] (default: 1)

When immediate is enabled, any values recorded or added to the pattern are played if their time is after the current position of the input signal. When immediate is disabled, newly recorded or added values do not play until the input signal resets.

in [float] (default: 1.)

The in attribute defines the range of the input signal that causes output from mc.pattern~. Normally in is 1, which permits mc.pattern~ to be driven by a phasor~ object. If you set in to 10, then you would need to supply a ramp that ranges from 0 to 10 in order to play the entire pattern. The value of in does not affect the stored phases for pattern values. You can redefine the range of stored phases using the ref attribute.

individual [int] (default: 0)

When the individual attribute is enabled, each channel is driven by a phasor on a corresponding input channel of a multi-channel signal. If there are fewer input channels than output channels, the extra outputs are muted. When individual is disabled, a single phasor drives all channels. Note that individual mode affects recording, so the recorded position of a value sent at the same time to two different channels could be different if those channels' input phasors are not synchronized.

ref [float] (default: 1.)

The ref attribute sets the maximum value of the phase of an event in a pattern. Normally ref is 1, which means phase values for events will range from 0 to 1. If ref were set to 10, phase values for events could range from 0 to 10. When changing ref any values stored in mc.pattern~ will be rescaled to have the same relative position as they did before.

Common Box Attributes

annotation [symbol]

Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.

background [int] (default: 0)

Adds or removes the object from the patcher's background layer. background 1 adds the object to the background layer, background 0 removes it. Objects in the background layer are shown behind all objects in the default foreground layer.

color [4 floats]

Sets the color for the object box outline.

fontface [int]

Sets the type style used by the object. The options are:

plain
bold
italic
bold italic Possible values:

0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'

fontname [symbol]

Sets the object's font.

fontsize [float]

Sets the object's font size (in points). Possible values:

'8'
'9'
'10'
'11'
'12'
'13'
'14'
'16'
'18'
'20'
'24'
'30'
'36'
'48'
'64'
'72'

hidden [int] (default: 0)

Toggles whether an object is hidden when the patcher is locked.

hint [symbol]

Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.

ignoreclick [int] (default: 0)

Toggles whether an object ignores mouse clicks in a locked patcher.

jspainterfile [symbol]

JS Painter File

patching_rect [4 floats] (default: 0. 0. 100. 0.)

Sets the position and size of the object in the patcher window.

position [2 floats]

g/s(set)

Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.

presentation [int] (default: 0)

Sets whether an object belongs to the patcher's presentation.

presentation_rect [4 floats] (default: 0. 0. 0. 0.)

Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.

rect [4 floats]

g/s(set)

Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).

size [2 floats]

g/s(set)

Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.

textcolor [4 floats]

Sets the color for the object's text in RGBA format.

textjustification [int]

Sets the justification for the object's text. Possible values:

0 = 'left'
1 = 'center'
2 = 'right'

varname [symbol]

Sets the patcher's scripting name, which can be used to address the object by name in pattr, scripting messages to thispatcher, and the js object.

Messages

int

Converted to float

float

When audio is on, recording is active via the autorecord message, incoming numbers are recorded to the current channel being auto-recorded. All recorded values is added to any existing data on a channel. If you want to record values to a specific channel, use the list message.

list

When audio is on, a list message of two items will cause the second item in the list to be recorded to the channel specified by the first item in the list if recording has been enabled for the channel. For example, the message 1 0.4 would record the value 0.4 to channel 1 if recording is enabled for channel 1.

add

The add message adds one value to a channel. It accepts three required arguments. The first is the channel where the value should be added. If the channel is 0, the value will be added to all channels. The second argument is the time (between 0 and 1) where the value should be added to the pattern. The third argument is the value. The add message workds whether or audio on or off. Likewise, recording does not have to be on for channels(s) where you are adding the value.

addrange

The addrange message adds a range of values to a channel. It accepts a minium of four required arguments. The first is the channel where the values should be added. If the channel is 0, the values will be added to all channels. The second argument is the number of values to be added. If there are four arguments, the third argument specifies the low value of the range to be added and the fourth argument specified the high value of the range to be added. In this case, the values are added within the space of the entire pattern (between 0 and 1). If there are six arguments, the third and fourth specify the time range and the fifth and sixth argument specify the value range. The time range must be specified from low to high and the two values cannot be equal. Example: addrange 1 5 10 20 will add the following values to channel 1: 0 10, 0.2 12.5, 0.4 15, 0.6 17.5 0.8 20. Note that the addrange message does not use the entire space of time you specify. If you want to fill the entire time space, use addrangeinclusive.

addrangeinclusive

The addrangeinclusive message adds a range of values to a channel. It functions identically to the addrange message with the exception that it fills the space of time with the range of values. This is only advisable when the time range is explicitly specified; in other words, if you try to fill the time range of 0 to 1, you will end up with one fewer event than you specify because the last event at 1 will overwrite the first event at 0, since 0 and 1 represent the same time. Example: addrange 1 5 0.2 0.4 10 20 will add the following values to channel 1: 0.2 10, 0.25 12.5, 0.3 15, 0.35 17.5, 0.4 20.

clear

The word clear with no arguments, removes all values from all channels. When followed by a channel number, clear removes all values from a single channel.

delete

The word delete followed by a channel number and time, removes any value associated with the time on the specified channel number. Example: if a value of 50 was previously added to channel 1 via add 1 0.5 50, sending delete 1 0.5 will remove it.

deleterange

The word deleterange followed by a channel number and two numbers specifying a time range, removes all values that fall within that time range.

dictionary

Use the dictionary message to set one or more channels with new data. You can see the required format of the dictionary by sending the getcontent message, which sends a dictionary containing the current state of mc.pattern~ out the right outlet. Unlike reading in a new an using the read message, the dictionary message will only clear the existing pattern from channels in the dictionary with new content. This permits you to create a dictionary that only modifies one channel, leaving the others untouched.

dump

The dump message prints all times and values for all channels in the Max console.

filldeviate

The filldeviate message adds values to all channels. It takes three or four arguments. When filldeviate has three arguments, the first argument is the time location for the values, the second argument is the center value for the generated values, and the third argument is the amount of deviation from the center value. When filldeviate has four arguments, the first argument is the center time location, the second argument is the amount of deviation from the center time, the third argument is the center value, and the fourth argument is the value deviation. Example: filldeviate 0.5 2 1 for a four-channel mc.pattern~ could generate the following: Channel 1 -- 0.5 1.7, Channel 2 -- 0.5 2.1, Channel 3 -- 0.5 2.9, and Channel 4 -- 0.5 1.8.

fillrange

The fillrange message adds a range of increasing or decreasing values to all channels. It accepts two, three or four arguments. When fillrange has two arguments, the first argument is the time location for the values, the second argument is the value. The value is added to all channels at the specified time.
When fillrange has three arguments, the first argument is a time and the second and third arguments specify a range. Starting at the value specified by the second argument, fillrange adds a value to all channels incrementing or decrementing until the last channel has a value equal to the third argument. If fillrange has four arguments, the first two arguments are a range of times and the second two arguments are a range of values. Example: fillrange 0.25 0.75 1 4 for a four-channel mc.pattern~ will genreate the following: Channel 1 -- 0.5 1, Channel 2 -- 0.375 2, Channel 3 -- 0.5 3, Channel 4 -- 0.625 4.

getcontent

The getcontent message sends a dictionary containing the current pattern data out the right outlet.

mute

If the mute message has one argument, all channels are muted if the value is non-zero and unmuted if the value is zero. If the mute message has two arguments, the first argument specifies a channel number to mute and the second argument is the muting state. Note that mute is the only way the mc.pattern object provides to disable output of one or more channels; there is no play / pause control. To pause playback, set the frequency of the input phasor~ to zero.

quantize

The quantize message sets a value for record quantization for one or more channels. If quantize has one argument, it sets the record quantization for all channels. If quantize has two arguments, the first argument specifies the channel number and the second sets the quantization value. Quantization values should be less than or equal to 1; when the quantization value is non-zero, recorded values are shifted in time so that their time is a multiple of the quantization value. Record quantization has no effect on values added to a channel via the add or fill messages.

ramp

The ramp message accepts one or two arguments. If ramp has one argument, it sets the use of linear output ramps for all channels. If ramp has two arguments, the first argument specifies the channel number and the second enables or disables playback ramps. When ramps are disabled, the output signal remains constant after a value is output. Then the output signal jumps to the new value. When ramps are enabled, mc.pattern~ outputs a linear ramp from the previous value to the current value. Ramping at the beginning and end of a pattern is affected by the wrap state of a channel (see the wrap below).

read

The read message accepts an optional filename argument. If no filename is present, a standard open dialog is shown. mc.pattern~ accepts files in JSON format produced by the write message.

record

The record message accepts one or two arguments. When there is one argument, it starts (non-zero) or stops (recording). When there are two arguments, the first argument sets the channel number and the second starts (if non-zero) or stops (if zero) recording on that channel. Note that the times given to recorded values are relative to the current phasor input value, not the time you started recording.

setvalue

The setvalue message provides an alternative syntax for directing messages at specific channels, or all channels. The format of the message is setvalue followed by a channel number followed by a message to send to that channel. The messages that can follow setvalue are add, clear, delete, deleterange, float, int, list, quantize, ramp, record, and wrap. When using these messages, omit the channel number since it goes after the word setvalue. For example, if you want to delete an event on channel 2 at time 0.5, you can use setvalue 2 delete 0.5.

signal

The mc.pattern~ object's pattern playback can be driven by one or more phasor ramps in its audio input. If the individual attribute is enabled, mc.pattern~ expects a multi-channel signal in which each channel has a phasor that plays the corresponding channel in the object's multi=-channel output. If individual is disabled, a single phasor ramp signal plays all patterns together.

wrap

The wrap message accepts one or two arguments. If wrap has one argument, it sets the use of output wrapping. If wrap has two arguments, the first argument specifies the channel number and the second enables or disables output wrapping. When wrapping is disabled, the output value is set to zero at the beginning of the pattern (when the input phasor resets). When wrapping is enabled, the initial output value is the last value before the end of the pattern.

write

The write message accepts an optional filename argument specifying where to write a file. If no filename is present, a standard save file dialog is shown. mc.pattern~ writes files in JSON format corresponding to the dictionary output by the getcontent message.

See Also

Name Description
seq~ Signal-driven event sequencer
phasor~ Generate sawtooth signals
zigzag~ Linked list function editor