Dynamically choosing multiple files to be played randomly
I really hope you can help!
I’m making a soundscape patch and I need some functionality so I can choose a not-fixed number of sounds to be played randomly. It could for example be Dog.wav, Dog2.wav and AngryDog.aif. Or it could be Bird34.wav, bird.aif, bird_2.aif, litteBird.wav, litteBird2.wav and BIRD.wav.
In the first example I need some way to choose these 3 sounds. And I need some way to know, that I have chosen exactly 3 sounds (so I can tell it to the random~). So that everytime I hit a button one of 3 sound will be played.
In the same patch I should be able to choose 6 new sounds as in the second example.
Is it possible to make anything like this?
I really need this function!!
I know the buffer~, random~, groove~, and so on. The only place I need help, is with the dynamically filechoosing. Thank you in advance!
have a look at [folder] and [umenu] (specially the autopopulate message). There was also a similar question a couple of days ago. If you go hunting through the threads I am sure you can find it in a couple of minutes…
if rhythm is not crucial, and it sounds like it’s not, then you can "hold" a very large number of files in a single sflist~ object and cue them randomly.
This is going to be much more convenient than storing them in buffers for a bunch of reasons, especially if the files you wish to play are large or if there are very many of them. sfplay objects stream the files off your HD, so there will be a limit of how many you can play at once based on your HD speed. I’m not sure what that limit is expected to be, ~10 ?
Put a list of all the files you want, as by parsing folders (or just dir *.wav or ls *.aif + copy paste or what have you), and feed it appropriately to sflist~ and you’re good to go.
picking which file then becomes simply a matter of picking an integer.
|flies wrote on Wed, 29 April 2009 16:55|
|if rhythm is not crucial, and it sounds like it’s not, then you can "hold" a very large number of files in a single sflist~ object and cue them randomly.|
This is going to be much more convenient than storing them in buffers for a bunch of reasons, especially if the files you wish to play are large or if there are very many of them.
Using sfplay~ and similar is definitely good for saving RAM, and it also will nearly eliminate a lag in changing to a new file (buffer~ takes some time to load files). The only drawback, and I’m not sure it’s a problem in your case, is changing playback speed rapidly, which is solid with groove~ but can be flaky with sfplay~. Also you can’t use the waveform~ display with sfplay~. But in this case it sounds like this isn’t an issue.
Use the cues in sflist~ or follow the advice for the umenu (autopopulate 1). You can also enter "WAV AIFF" in the "File Types" attribute of umenu, which will filter everything but those files when you populate it. The complete list of file formats is in max-fileformats.txt, in Cycling 74–>init. This is helpful for filtering only image/movie files too, as some formats are spelled differently than the extension (.mov–> MooV, for example). With subfolders on, you can pick a top-level folder with tons of media and have the umenu fill up—I did this with the ACID Anthology loop packs and it had something like 2,500 entries. Not exactly practical, but since you can give the umenu an integer to pick a file instead of clicking and picking, presets or jumping around huge lists is not a problem.
Forums > MaxMSP