matrix~

Audio cue chooser

This examples shows a way to choose automatically from a list of preestablished sound cues, with a crossfade between cues rather than a sudden switch.

To do this we have two stereo sfplay~ objects, both of which refer to the same list of sound cues in an sflist~ object, named "cuelist". Instead of sending open and preload messages to each sfplay~ object, you can send those same messages to a single sflist~, and then the sfplay~ objects refer to that object by its name.

Enable/disable subpatches

The most direct and usually the best way to "turn off" a signal in MSP is to multiply it by 0. However, even if a signal is multiplied by 0, MSP still works to compute that signal. So, if you need to conserve CPU usage, it's best to disable the computation of that signal once it has been silenced, then re-enable it when you want to turn it up again.

Using matrix~ for audio routing and mixing

The matrix~ object is an audio mixer/router that can be configured with any number of inlets and outlets. The arguments specify the number of audio inlets, the number of audio outlets (there's always one additional outlet on the right), and the initial gain for the connections of inlets to outlets. Each inlet is potentially connectable to each outlet with a unique gain setting. The gain of the connections is changed by sending messages in the left inlet.