Play random clips (in reverse) from a RAM buffer
This example demonstrates creating a RAM buffer to hold a 10-second stereo recording, recording live audio into it (with input volume adjustment), and then playing randomly chosen backward clips of that sound, with a trapezoidal window to taper the beginning and ending of each clip to avoid clicks.
The clipchooser subpatch randomly chooses a clip duration from 1 to 2000 milliseconds, uses that duration to create an amplitude envelope of the proper duration, then chooses a starting location in the buffer (making sure that the location is not so early in the buffer that it would prevent the backward clip from completing), and sends out the amplitude envelope and the starting time. (Note that this subpatch assumes that the rate of the groove~ object is -1.) It delays for that duration (using delay) before repeating the process to choose the next clip.