The peakamp~ object can be used to take the amplitude of one signal and have it control the amplitude of another. Peakamp~ takes a low-frequency sample of the peak amplitude of the signal, which is then smoothed by the line~ object. This gives an intuitively much more accurate representation of the audio signal one is envelope-following than does smoothing the audio signal itself, which tends to smooth out — and thus lose — all the more interesting characteristics of the signal. Here’s an example that lets you compare.
This example is essentially the same as "Basic RAM recording into buffer~", except that it's designed for recording and playing back a stereo signal instead of a single channel of audio. The buffer~ object has an additional argument to specify 2 channels of storage.
To record a sound into RAM, you must first allocate/designate a place in RAM into which to record. The buffer~ object creates a named buffer in memory large enough to store the specified duration of audio data. In this example, the buffer is named "theholdingplace" and holds up to 60,000 milliseconds (one minute) of audio. The incoming audio signal from the adc~ object goes into a record~ object that refers to that memory buffer.
This example combines seven pre-recorded saxophone sounds, slowly modulating several aspects of their playback to create an ever-changing mix.
This example repeatedly arpgeggiates the first 16 notes of the harmonic series based on the frequency 65.406395 Hz, which is the fundamental frequency of the open C string on a cello. The note rate can be adjusted anywhere from 1 note per second to 100 notes per second. The default initial rate is 8 notes per second.
Did you know that there are several different ways to turn MSP audio on and off in Max?