Crossfader Sampler. Help me reduce clicks!

I’m making a live sampler that records audio input into one 10 sec buffer, then records into a second 10 sec buffer, whilst playing the contents of the first buffer in reverse. The sampler crossfades between the two buffers every five seconds. This cycle continues ad nauseum.

I’ve put in a trapezoid~ object after each groove~ object to try and get rid of the clicks from the start and end of each buffer, but it’s not working so well. Sometimes I still get clicks, sometimes there’s a short but very audible drop in audio.

I’m a bit stuck for how to get rid of the clicks. I thought about having some kind of editable envelope with a function object, or something with an adsr object, but I don’t know how I’d do either of those.

– Pasted Max Patch, click to expand. –

Copy all of the following text. Then, in Max, select New From Clipboard.