Playing random files help

helenoir's icon

I've looked through previous threads to no avail.

I'm trying to create a patch which should play all my audio files randomly, I have about 18 files in total and some are about 6 seconds and some are 2 mins.

Max Patch
Copy patch and select New From Clipboard in Max.

I have written so far:

and I'm wondering where I've gone wrong as the buffer without the random will play my samples, but I cannot get the files to play through random. I've played around with sfplay~ but it didn't really work unless I did it wrong. I am using the 4.6 version.If anyone has any answers I would be very grateful! Thanks

Adam Jansch's icon

The problem could be that the message boxes connected up after the prepends don't pass their values through to the buffers to load the files, you would have to click them to load.

So run the prepend (without 'set') straight through into the buffer, and consider using the 'replace' message into buffer instead of the 'read' message (this will resize the buffer to the size of the new file).

Also, if you use message's right inlet you need no 'set' message, which is very convenient!

helenoir's icon

Thanks for your response, however, I took away the set from the prepend and max came up with the error that it didn't understand replace. Also it stopped the files from changing randomly.

Adam Jansch's icon

Can you post the new patch?

helenoir's icon

Only the first buffer has the set removed

Max Patch
Copy patch and select New From Clipboard in Max.

Adam Jansch's icon

You need to remove the message box between the prepend and the buffer~... setting a message box doesn't cause output as well. If you connect the prepend box directly to the buffer it should work.

amy's icon

test

343.amyarduino4_pin10.maxpat
Max Patch