These patches use timed counting—in both cases using a metro object and a counter—to step through a series of MIDI notes.
In the MIDI specification, and in most DAW software, and in Max, the smallest unit of metric timing is expressed in "ticks", which is to say, partial units of a beat. Commonly the number of ticks used is 480 or 960 parts per quarter note. That number makes sense because it's divisible by 2, 3, 4, or 5 (and multiples of those).
This example plays a 12-note chromatic scale over three octaves with timed triggers.
In this example, one octave of chromatic scale is played from the middle C.
This patch uses metro, counter, and table to read through MIDI values to create an ascending and descending major scale.
This patch uses metro and counter to automate a scale with crescendo by referencing a table object containing patterns of pitch and velocity MIDI values.
This patch shows how to create a linear crescendo using MIDI velocity.
This patch uses a counter to send out MIDI pitch and velocity values using makenote and noteout. Once the counter reaches 12 a 0 message is sent to the toggle attached to the metro stopping it.
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.
To generate a series of numbers in Max that outline a sinusoidal shape, you can use the sin() function in the expr object. As the argument in the sin() function goes from 0 to 2π (6.283185), the output will be the sine of that value, going from 0 up to 1, down to -1, and back up to 0. So, by feeding a series of numbers into expr, you can generate numbers that follow that sinusoidal pattern.