I need serious polybuffer advice… here's my patch

With help from many polybuffer-related posts, I have managed to make my system work, BUT it is still inefficient in some aspects and I’m probably doing it the loooong way. It works as follows: 1st you load the first polybuffer with folder A and the 2nd polybuffer with folder B. The idea is to concatenate random files from folder A with random files from folder B. However, files from folder A must never play duplicates. This is solved with [urn]. Folder B can have duplicates, although it should be less recurrent than folder A. I also need to add pauses based on probabilities, which are there with the [delay] and [table] objects. All this is working ok.

Currently, when you click the bang to play, you get the series: A-B- (delay)- A-B- (delay)-A-B- (delay)- A-B- (delay) -A-B-(delay). (sometimes there might not be delay and/or B files, when they receive a value of zero). I have a groove object for each sample.

My problem is, I need to previously be able to chose the length of the series. So, if I want a series of 20 {A-B- (delay)}s, how can I do that without having to copy and paste more groove objects? Is there a way to do this with just 2 grooves having the conditions above? And also with the possibility of replaying it without losing the series?

I would be really grateful if someone can help me! I have really been struggling with this!!

NB

Attachments:

You can certainly do this with one or two groove~ objects. You are best off generating your entire sequence first (samples and delay), dumping it into a coll or dict, and then sequencing it into your groove. Here’s the skeleton of it — you can figure it out from here:

– Pasted Max Patch, click to expand. –

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

Hi Mattyo, thanks a lot! I haven’t been able to make it work, though. I’m getting the error sprintf: can’t convert symbol to type of argument 1 and I can’t hear any audio (I’ve completed the groove objects and the buffers). Do you know what might be causing this?