Play items from [umenu]?
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]?
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. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 347.3ocuTF0aBBCDG+4xmhl9LyzxTD2a6ywhYo.mRWfVBst4lwu6qb.aNilY BA4gC5+65c+yOZ5g.BK0rGrL5SzWnDxg.BAkZEH8qIrJ49rRoEKiogOLouwB 6R4f8NT1QSo1A0MFsyp9BZyHhlw6k06pT5RvgMR7qnYmaPMpWsSx8YMz4MVp TukERYL559RT43f8l4g3jSmrVVg6h8biRVNjoV5xJT5su1.Yttllv8VitBiO lzFi7eSW2tgiAAsgvwQk5FnFz4TK3FOaDWiMWjIhEifIwymw8OwhP5xno.LM PozodG7Nn3tSl3QPl4XboXJfxFUIBD+wEYSVAke2IypQPFgXA9hyuHav4wJU 5yutAaXq9eAl0rqIavsCGno7ercNXcJs+PjQeRQs2DbRQEp7b.yOvrJUdsQo c8l3J+9tYOEeCd5LiO0dBQf3+7zp6um3Som7KNF7MvgaQNJ -----------end_max5_patcher-----------
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.
< 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.
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?)
perhaps prefix + autopopulate method of umenu will help here:
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1026.3ocyYs0aaBCE94jeEH1qYsXi411SqKSZUZs8goooosoJmfaJSfAELaY qZ629v1PJ4BIFRBgHEPX6v478ctZmmFNPeR7BRpt1qz9p1fAOMbv.wP7AFT7 7.8H7hog3TwxzmjwXwT8QxohyXgDF62ID46PeBlNSW66ESmfYSeLfN694joL 4JrcMtvXjlogE+Fzn75xeSfuPNwS9wKMcKkCMKJflKIgN.ddPo7kixG7uCGx uLRQvDQRSwyHkRgQVHzR8ogD77Zw3NwmiDXl1RX5vuBbqfuGhorzf+HdY.X9 zaBa6sBa31gckWKEGIds5uYd.NTuEDBk7qbMXC9Had8V7.JSejJFdOIiXJ4G 3EVqY3UfXPMfXfGWhIKZBY9gSBEn2VbyZSueEHAyFDTbbIgCN1uHb2UkXevI N1uFW84XpebzNMz6Dh.oWNPZfAsv.C8Neg+GIubGooE0dubn6YyKuNGibARz RhSxBwLR8EGFsmBDkjiz820oMji8YibpqhYIunY2txlVPYNA4MYBhFV1DZsy 3lj4jTBkgYAwzJBF4hDB1wleyn3xRwdJi1piK+l96G+pKSiyn92SVfiRBIoW dy0i0t5tOewuv+7a5k+jv.JYZ95XUAZyHdSWiJDOvDTTctQLu4YKi0InCNnS AUX05N3.fdGgrEWp1QO.YuK.CgeC.50B947Ug6PagAAVq2k56fw47z.SddtD B0WK+9CAKZmM1rLaP6qQY0Dz2E0ui4rR9qLdl1Cwg96r.9dcCJxQHKk6AaA+ fNakvyhHzr80i2pswDvHQEmRfNdkOOxKHwW7H9kqt6S291unc06tcrFXkYt4 ciu9S2rwfe3tweQ65O990m34hcKGKl+4wbIx+VJ3c5DKCUARiDXKdwEgH6I8 HNiEursu07V2yV0ZfM1rzeM2TTP0q3McxhKJyWviOZYASOYNQ6J8t0zNZ6aY KReHID+6+UKgjFLilKPkxUTbhWxcFh7ZA8.NNm6QwLo3eVBiWbKGBKAqHtGv qpa3Yy6DtHSvqyA3QrWjpQTZf14zgbqVhxynMaX.czaCQHcQa4qcnpBDvGeU 5JOky7ok3sby+ZOCBeRJKfJ1yRkEwOBnJK5w.eehX9RPFE3mDmmIeYhjsZ7T Um3G6VuSmbUQmPcpNAUVm.cGOYeB3IG.he5slxRpNHwNnW6IYGj1ddhUxe5X 3EB1GRr6VuPSUX2loR1HA4hLD6D2w1Yym.E+4BPzxmNTf.T.HqkapWDNIzot KbBpR3zZJ9I2ILWZv8oR18OUxpSsbNpX3535Enie1iCTk.fdmJYpPZenYm5K oROZVcJIY06LandGGojiTuii75cYI63jjJnQfCPixe3uC+OfK33.g -----------end_max5_patcher-----------
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?
How could i send the selected audio file to the buffer? I try to send the sfplay tilda to a record tilda but it does not seems to work!
thanks Samuel Freedman, from 6 years in the future.
I spent most of today looking for that answer, how to auto populate umenu with a folder of samples.
Forums > MaxMSP