Play part of a sample using groove~
This example shows how to play part of a sample in Max. Simply put, to play a sound from point A to point B, nothing beats play~, you just tell it "start ". However, if you must use groove~, then you need to provide a stopping command at the right moment somehow. And as you may notice, the ‘loopend’ attribute of groove~ causes the sound to loop back to the ‘loopstart’ point if ‘looping’ is on, but lets the sound continue if ‘looping’ is off, so it’s not really of that much use to us. We can send groove~ a start time, then send it a "stop" message some amount of time later. Or we can set its rate signal to 0 to stop it. Or we can use the sync signal (the signal coming out of the right outlet of groove~) to know when the 'loopend' point has been reached, and use that to stop listening to groove~ (set its amplitude to 0). The last solution is the worst, since it delays the playback and end time by one signal vector, which may or may not be noticeable.
Also, these examples might be of interest: “Playing a sample from RAM”, “Sample playback driven by a signal”, “DJ-like sample scrubbing”, “Playing a sample with groove~”, and “Random access of a sound sample”.