I just realized that you have been talking about AudioSample – not the Ugens Sampler class, which is more recent and generally recommended:
We now recommend using
Sampler
class from the ugens package because it is more full-featured thanAudioSample
.
Based on your described use case, it sounds like you want a sample to start looping on keydown and stop on keyup. This is a problem because AudioSample does not have a loop behavior. Is my understanding correct?
Sampler, however, does have a loop behavior. Have you tried seeing if this resolves your memory problems on the PI?