This patch is similar to the abgate~ abstraction for "Routing a signal to one of two destinations" with a fade from one to the other. However, instead of routing one input signal to one of two outlets, this abstraction permits you to choose one of two input signals to send out its lone outlet.
To turn an audio signal on or off instantly, Max provides the gate~ object. However, if you use gate~ to switch a signal on or off while MSP is on, you're likely to cause an unwanted click due to the sudden discontinuity in signal amplitude.
This patch shows how the selector~ object may be used to choose just one of two (or more) different audio signals. A number in the left inlet specifies which of selector~'s signal inlets should be passed to its outlet.
This example shows how you can make changes to only one plane of a matrix. In order to achieve this, we need to rely on jit.unpack, which by itself separates the planes on a matrix (actually creating a copy), and then add the modified plane (with some process to be included inside the patcher oneplane object) to the original matrix.
Managing the flow of data in a program is a common issue. Often you'll want to receive data from different sources, or send it to different destinations.