randomising file selection

James Wyness's icon

I'm a fairly new max 7 user and I want to eventually create a large 8-channel algorithmic patch. I'm looking for some advice for the first step which involves randomizing audio file selection. I have four folders: A, B, C, D. Each folder contains four stereo audio files of around four minutes: a_1, a_2, etc. The files in folder A will go to channels 1/2, folder B goes to 3/4, etc. for external mixing (ie the eight channels).

I want to be able to randomly select from each folder a file for a playback period of between 1 and 4 minutes. I also want to have a short period of silence, randomized to between 0.2 and 1 second, between the selection of each new file from a folder. So after a given file has played out its (randomized) duration there's a variable pause before the next is selected.

Next I want to randomize loop start point and loop duration for each chosen file. The loop durations should vary between 0.5 and 10 seconds. The number of iterations of each loop should vary between one and four iterations for each loop.

To summarise: a file gets selected at random from a folder, played for between 1 and 4 minutes with loops varying between 0.5 and 10 seconds, from one to four iterations of each loop. Then a pause before a new file gets selected.

Eventually with all this randomization which will I imagine will involve fairly simple objects I want to investigate bigger generative systems to control all the random processes but I need to get started.

Obviously when I can do all this for one folder I can copy the procedure for the other three. There's a lot more to follow but I wanted to ask about this first step and would be grateful for any help from experienced users. I've had a go myself but as a new user the amount of possible options overwhelm me.

Andro's icon

Use the umenu object. Populate it with your file names. Send that to your chosen object to play samples.
Use a random object say random 3. Plug into the umenu object. Picks a random file.
Use the line object to fade the audio out. Plug into *~. Use random again to decide line time.
To get floating point random numbers you can use a huge random number and then use the scale object to turn it into a float.
Not sure what the best audio object is for this.

James Wyness's icon

thanks - will give those a try and see how I get on.