Max

Ganging sliders

This example shows how you can create a gangable multislider-like object. Although it is a common idea used in, for example, digital mixing consoles, there's no single object in Max yet to achieve this task of "ganging" multiple faders.

Change number box with key

This example shows how you can increase or decrease the number in a number box each time the up or down arrow keys are pressed. The incdec object is made to be connected to the integer number box in the manner shown here. The messages inc and dec to incdec will increment and decrement the attached number box.

Detect two bangs within a given interval

This example demonstrates a way to detect if two events, coming from two different sources, occur within a given interval of time from each other. We use the cpuclock object to detect the time at the moment each event occurs. The output of either cpuclock object in this example will trigger a subtraction calculation between the timings of the most recent event from each source.

Activate and deactivate parameters for pattrstorage

This example shows how you can ignore certain preset parameters in pattrstorage. The active message followed by the parameter name and a 0, allows you to deactivate that parameter and, consequently, all the preset interpolation associated with it. In this example, whenever you select particular preset 2, it deactivates the parameter, and then reactivates it for other presets.

Create MIDI File

This is an example that generates a sixteenth-note rhythm, formats the information as MIDI note messages with midiformat, and stores them in a seq object, which can be saved as a MIDI file with the write message. 

Tap Tempo

This example shows a super simple tap tempo implementation. The patch alters the transport tempo based on the rate at which you tap the “t” key. This method simply takes the average of the most recent three time intervals between the most recent four taps. So once you tap four times, it will set the transport tempo to your tempo, and if you keep tapping it responds to your changes but takes a couple beats to move gradually to your new tempo.

List audio cue points

To set a list of cue points in an audio file and have them played in order, use either sfplay~ (with a set of cues established by preload messages to sfplay~ or to sflist~) or buffer~ (with start messages to play~, the parameters of which are stored in a coll).

Algorithmic counting

This patch demonstrates an application of modular arithmetic to wrap a series of numbers around within a defined range. The algorithm produces a series of expanding steps: 0, 1, 3, 6, 10, 15, 21, etc. The difference between each number and its predecessor in the series increases with each step—1-0=1, then 3-1=2, 6-3=3, 10-6=4, and so on. We do this by incrementing a counter and adding its output to the previous output of the + object.