Forums > MaxMSP

Play items from [umenu]?

January 5, 2010 | 12:53 pm

Hi,

I am relatively new to MaxMSP. Im trying to make a patch that plays random files from a folder.
So I am using a [opendialog fold] to [folder] to [umenu], but how do I play the files from the [umenu]?

Regards 123ndy


January 5, 2010 | 2:22 pm

My first thought is to store all the filenames into a [coll ], then you could send a random index number to coll to output the path of the chosen file into [sfplay~ ] (or just send a random number to umenu to spit out the filename for sfplay~). One problem is that [sfplay~ ] probably won’t be able to load and play the file immediately, so you may have to plan for some "lag". But you could work around this, it shouldn’t be a big issue. You’ll also have to set the search path of the patch to include the selected folder, otherwise [sfplay~] won’t be able to load the files. Something like this might help with that:

– Pasted Max Patch, click to expand. –

Another option is to load all the files into buffers (for playback via groove~), it would avoid the potential loading time lag problem, but would take up loads more RAM.


January 5, 2010 | 2:39 pm

< blockquote>One problem is that [sfplay~ ] probably won’t be able to load and play the file immediately< /blockquote>

That’s why there is a preload method.

Beside the RAM waste, using a buffer won’t work well with long sounds (there are plenty of post on this topic), you’ll then need to use hr. objects.


January 6, 2010 | 7:03 pm

Thanks for answers, but…

(or just send a random number to umenu to spit out the filename for sfplay~).

How do I do this? How do I play a file directly from umenu trough sfplay? (do umenu need to consist of the whole path of the file, or just the file name.aiff/wav etc?)


January 7, 2010 | 1:16 am

perhaps prefix + autopopulate method of umenu will help here:

– Pasted Max Patch, click to expand. –

January 7, 2010 | 9:35 pm

Thanks! It was exactly what I was looking for :)
But why do you use route and autopopulate?

I got one more question, how do I make another sound start 10 seconds before the other sound ends?


Viewing 6 posts - 1 through 6 (of 6 total)