A/B audio switch
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 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.
To sync an LFO to the onset of a note, drive it with a phasor~ object. Send a phase value of "0" into the right inlet of phasor~ when the note starts, as seen in this example.
The selector~ and gate~ objects serve the same function for audio signals as the switch and gate objects do for Max messages. The selector~ object chooses one signal inlet to pass to its outlet. The gate~ object chooses one outlet out of which to pass its incoming signal.
In signal processing, a "window" is a function (shape) that is nonzero for some period of time, and zero before and after that period. When multiplied by another signal, it produces an output of 0 except during the nonzero portion of the window, when it exposes the other signal. The simplest example is a rectangular window, which is 0, then briefly is 1, then reverts to 0. The windowed signal will be audible only when it is being multiplied by 1––i.e., during the time when the rectangular windowing occurs.
As you get more involved in programming audio, it's likely that you'll want to have multiple sound possibilities available in your program, that you can switch on and off as needed. You might want to take a look at MSP Tutorial 5: Turning signals On and Off to learn about some basic ways of doing that. However, that chapter leaves out the following pretty crucial issue.