number~

Turn files on and off

This example shows how you can turn on and off audio files with a single toggle –– as in swapping between one and the other. Since 1 is on and 0 is off, you can use a == 0 object to produce the opposite (to turn one thing off when you turn the other on and vice versa). This can be seen in action in the example on the left.

Sample and hold

The idea of “sample and hold” is to capture the amplitude of a signal at a particular instant in time, and hold it constant for a while. In MSP, the sah~ object allows you to do just that.

Audio amplitude control

As explained in MSP Tutorial 2, in order to avoid creating clicks in audio when you change the amplitude, you need to interpolate smoothly from one gain value to another. Example A in this patch shows how to use the line~ object to do that. The gain value from the number box is combined with a transition time in the pack object (10 ms in this case) and the two numbers are sent as a list to line~.