# dial

## 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.

## Dynamically hide or show an object one at a time

This example demonstrates how to dynamically hide or show objects (patch must be locked) by sending a "hidden" message. The message is followed by either a 1 or a 0 indicating hidden or shown.

## Half speed and double speed

For specifying the rate of an audio file or the rate of a video file, the number 1 is used for normal rate, and we may want to be able to increase or decrease the rate by a certain ratio. For example we may want to double or halve the rate, setting it to either 2 times normal or 1/2 of normal.

The way that a sound’s amplitude evolves over time is called its amplitude envelope.

## Linear mapping of ranges

To translate numbers that occupy a particular range into an equivalent set of numbers in a different range, one common and useful technique is "linear mapping". The term "mapping" refers to making conceptual connections between elements of one domain and elements of another, and "linear" mapping refers to using a mapping function that is a straight line––that is, such that numbers in one domain are mapped to an exactly equivalent position in the new domain. This is a very common and useful operation in media programming.

## Linear mapping and linear interpolation

This patch shows examples of linear mapping and linear interpolation, using the lmap abstraction described in the “Linear mapping equation” example. One could substitute the built-in Max object scale in place of lmap with the same results.

## Play random clips (in reverse) from a RAM buffer

This example demonstrates creating a RAM buffer to hold a 10-second stereo recording, recording live audio into it (with input volume adjustment), and then playing randomly chosen backward clips of that sound, with a trapezoidal window to taper the beginning and ending of each clip to avoid clicks.

## Polyphony requires multiple objects

Any given MSP patch cord represents a single channel of audio. If you want to generate or process multiple sounds or channels, you need to treat each sound or channel separately. For example, each sfplay~ object can have multiple loaded sound cues so that it's ready to play any one of several files, but it can only play one sound file at any given instant. And if it's a stereo file you need to treat each channel separately for mixing, processing, etc. This patch demonstrates that.