Generating Messages to the MC Wrapper

Generating Values for All Wrapper Instances

The MC Wrapper lets you treat all the instances within it as a "space" that can be set to algorithmically generated values. There are a number of approaches you can use to generate a space of values including:

  • the js object in conjunction with the applyvalues message
  • the mc.gen object using the mc_channel operator in conjunction with

While slightly less flexible than writing your own Javascript code or Gen patches, the MC Wrapper contains a set of high-level messages that can be used to generate value spaces.

Generating Random Values for All Wrapper Instances

To generate a random space of values for all wrapper instances, use the deviate message. The first argument to the message is the "width" of the deviation. The second argument is the center value. Here is an example of changing the frequency of all oscillators in an mc.cycle~ object. As the slider value is increased, the range of values ("width") increases. When the slider is set to 0, values generated will be 440 because the width is 0.

Optionally, you can specify an attribute or message that will be used instead of a float or int. Here is deviate applied to the @cutoff attribute of the lores~ object. It may help to think of the syntax of wrapper generation messages as follows: the first argument is the operating parameter (how, for example, deviate will do its job), and everything that follows is the message that it will use to change the value of an instance.

Generating a Range of Values for All Wrapper Instances

To set instances within the wrapper to a range of values, use the spread message. This message follows the same syntactical pattern as the deviate message. The first argument is the beginning of the range to generate, and the second argument is the end of the range. If the end is above the beginning, the first wrapper will receive the lowest value. If it's negative, the first instance will receive the highest value. The spread message has three variants that specify how the range is calculated. spreadinclusive includes both the first and second values in the range. spreadexclusive exclusives both the first and second values from the range. And spreadincludesecond includes the second value but not the first. By convention spread is the same as spreadincludfirst; it includes the first value but not the second value. The following examples show the differences in these variations:

Generating Exponential Series

To generate an exponentially increasing or decreating series of values applied to all instances in the wrapper, use the exponential or scaledexponential messages. The first argument is the value of the exponent in the series and the second argument is the base that is raised to the exponent. Negative exponents cause values to increase over the series while positive exponents cause values to approach zero. The scaledexponential variant divides values in the series by the number of instances in the wrapper, resulting in an overall range that is independent of the number of instances.

Generating Harmonic Series

To generate a harmonic series of values applied to all instances in the wrapper, use the harmonic and subharmonic messages. Each message assigns the first instance in the wrapper to the first harmonic (or subharmonic), which is given by the second argument (the fundamental frequency) and subsequent harmonics or subharmonics to successive wrapper instances.

The first argument is a multiplier on the harmonic calculations, typically this is set to 1 for a harmonic series. As an example, here are the first harmonics and subharmonics for 500: