Using Poly~ as a player for 60 buffered files
I have read some poly~ instructions, but still having a hard time figuring things out.
I have to conjure up the impression of 60 mono audio files of the same length of 6 minutes running simultaneously.
Obviously there is a CPU issue if I really run them all together, so I am trying to buffer them all at the same time (no RAM issue there), but run them only selectively. The maximum number of actually simultaneously running audio files will be 30.
To save some CPU, I am trying to use poly~ subpatch as my player, and all the other functionalities will go to its mother patch.
1) I guess I can get by only with 30 instances of player as that is the maximum number of simultaneously running audio files. But how can I make the different instances read different buffers?
2) How can I turn the poly~player on and off while the music is playing? So the point is I should be able to turn on one buffer playing from the PRESENT point not from the beginning point of audio files.
So, attached are largely incomplete patches: two Player patches (I am not sure whether to use sfplay~ or Groove~: which one would you recommend?) and their corresponding mother patches.
Could anybody please help? Any advice and suggestion will be much appreciated. If you could go step-by-step, even more so.
Thank you very much!
sfplay~ reads from disk, so you can’t use it for playing buffers.
you should also check the polybuffer~ object whit which you can simply load and manage a folder of audio files.
lastly, you can control single instances of poly using the "target " message.
----------begin_max5_patcher---------- 684.3oc0V1rabBCDG+L6SgkUOtYEluBo25s9NTUEYXmrwQfMx161MMJ8Yu1i gMjT1MzlOTyAFjGL1+meLyfuaQDsRsGLTxmIeiDEc2hnHzk2QT+3HZKeecC2 fSiVqZaAoktL7LKr2h9uRnMVhoCpEWcKYmRTCD41VInI1qAIw.x0jVvX3afg WtQHgZ0VItBI8N6315qExMWpgZaPYImuJdIIkE6uwxwaoNK468uiXMpAU0Mm wRFV8qTRqj2B3i9JzrCrhZ9vScZSHa.KFUrGbp1ZG7FOZgLhehKDKY0A25MU 3zVE6cb+hEdyxWHGERGEgFWraHBowxk0G30Dngc9EHTRyFwFV4QXS7Ga1DiY QFhUQ3MMyfJrhYPkx2KnzoAm9sbqPIGK1xv2tLLKOt2bPouMnjbF6AXJUxYj icQ4Lf44eLxvdRinCXwx0a.K4SrSgiDLqJMGukGnRwz3Hed3HD11a6fvVPoG VrGQpjIIE6Hj5UjKFUKX8b3DbIKdDVJJNEVR+fgEI7Cmr+CpzoZt8WDXOusq 4TEPEXNRV32XkkmrE8ad8yqW3eFYFkIIooXZQxpb2.1QxGxlLr+hVvaNZxfv etgWZ9P5+FP11VA5YD7gtCgVlGK3SJd9fuiqc9sf9RPxqZfwefmDLKIzJtqb cZ.McFSxqGfr7pmmNWLBNrjxU4SRmr2F5fW+MzI8HzYnpfW0eNZZ32oDJdFE Bk4MIdSp2j4M4dSga+GwVTL3YhexAxQB58+XfaTa00CQUeWUxCYXqAiUHwCa LZNrGMmqEqWCxw3Zsv3IHx+o+vOW0j+ekZ7EYOqbxe+jS1LjSZ16ldRmiddB CmudBY17ttcf1zulnTbMMtQo8CKVhCExvPrDjpgchg4G7v0tdIVWijs5Pef8 kEzE9849E+VcN.WW -----------end_max5_patcher-----------
Just another thought.. how large are the files?
If you use polybuffer~ you need to have enough ram to store them all. If they do all fit, playback shouldn’t be a problem though – I’ve got a patch using 100 instances of play~ in poly~ which only runs at about 5% of my I7 desktop.
the idea to put the play~ objects into a poly~ seems absolutely right, unless the scenario will include a limit to say 8 voices. in this case i would prefer to use 8 play~obejcts in the root level and use messages to change their buffer target.
When I want to send data to specific instances of a poly~, I prefer to name a receive object within the poly~ with a different name in each instance according to the instance number. Therefore I do not have to deal with the target message and I can still send data to all instancess trough the regular inputs.
----------begin_max5_patcher---------- 376.3ocwU9saBBCEF+Z3onoI6NloTPmt61ywxxRAp5w.sDZ0oy3d1G8.3eV1 Lr4hdCM86T93q+5AXquGMQuVZnjGIOS771564gRNAu14dzBw5zbgAWFUIeSm rfFzTxJWaQ4JYpDVI6zmpUVC7tzUKjOf0JqVVnWZykVzqvV0FI6lRYSPnTxK skJE1z4fZ1q09aapxmDV6GIhE6Fhm3txYCX6uGHCSTcJuO937nDE3Cf9TEHx oGhDn1mHm1Nee2kfKCHlxJPYmRLRKwpKzVPqtCtd7g+PjaHjO7b.J51AH6bv Tpy27wuhI7ehI0vlFzLzG5DgcOCGeN3vucvIWKxRDpY+O8KnS8gJLm0jQryQ kvKfJnezbP80u4fYxoeJpL5kUoc6h19UxgTkIMVPIbuZczZhOYMygrLIVtCZ YfQjjKwcD6aOx5aZ38HMQWszD1izv+ioo4fSTVtRVYZsDCRc27Bcka5n.bJn ZlhNV+agUP25G66bam+mBjEfy. -----------end_max5_patcher-----------
However you don’t need this I think . If you assign a different number to each buffer you may use the midinote message with the buffer number to play/stop followed by a 1 if you want to start playing and 0 if you want to stop it. The current position might be continuously transmitted as a signal to all voices. Using the midinote message helps to activate only the necessary voices. The velocity also allows to activate either a fade-in or a fade-out.
Hope this helps.
This is the main patcher :
----------begin_max5_patcher---------- 687.3oc2XtrbZCCEFds8SgFullpK9ZW09bzoCi.DNJ0V1ijHEZljm8ZIabIM fifVLPYgD5fr7+4iyuDlm78BlUsloB.eB7Ufm2S9dd1Pl.dci8BJoqmWPU1o EHX+nZ1CASZ+HMas1FttpXyK.S6z5B5FlDDCAeVSk4LM.tc5KqDZE+mLykfv 2A6BKVUVsRWvz1aAtKZaH8lZVq9BT7bAsHXR+6.eqap0T8764h7oR1bc6rQP y5CBI1NTRhoCCuC1eQ7EVk2jMe.msqBEzR6sL3KRt490KRtnWilXO66aZl3H 4lWUVxD52htUZ.W.JoMM1DgIOJdsM5RY9L6394sWrDa.QRlkJHxPTAEejTAc BTojoTzb1anBD.ADn4UW2wUDgNTQjKEMHXKdvHaW59wSxHTyb.2VAWvd4eso ZFUj6DcHVuDIdPGU5EzQMa0xkM6.QNIaTsjoZVTplWI1I4SHv1jOxzA6Z5Sc mLe8qgEfQnAAXxHX9dG.hOe6CEgicGEwWdTfNenfDl5NJhtfnP0bbt9iJcU8 4CFo3VKRhkIwvAgAZDfwg98NzuCJ4K3hJMCP.iwgSInPKMP1cfxxFDM3iDMj S.M5p77BVvwkh7lBqAyxrvcJ.vCW.zuCeMU1jiZlbJSPmUv1st6l1ODiib1O fRuR7C3QwODgxb1OfxtU8CQsIla9A3+89gPh6mOfRtR7CnQwOPvte9.J5V0O DBc+7AT3ekevtj1m05O9GRrxxD+0IupZkb917X6ovfeqrELklKrOXwtSJ6US 5d9hELwt5aAWYjrMsf68qAW0CJ6JSOQWW5w7PqtoGznnmDWjS53gGhK5wTyi GG8.cPO1Z9wQOlsade8Dch5oc2HZc8iLopaMsRoYS2GpjlgwSrCaNzQ1uhAR 1i7syO02rZO6+KfJFnvg -----------end_max5_patcher-----------
Save this one as poly_player.maxpat:
----------begin_max5_patcher---------- 1359.3oc0atsaiaCDF9Z6mBBAzaZylJRJpC8t9bTTXPaQaysxTBRzYS5h0O6 kmjWmrQmRso7BDXYQKKM7i+yvgCc95xEAqKel0D.9CveAVr3qKWrvzjtgEty WDbf97lBZi4xB1Td3.SHCdv9YR1yRS6egK2CnfpxhWVeb6VV8IvwFFPtmAdh U2vKE.2kjWd9aWvErMkGElaAx031Rgrg+uLcaPzigtlEGOTdTVvjF6ns0s06 VaN+70UQka1yE6VUy1Hs8rnD0mBvoD8AHIzbF9wPve69N7bSenb8m+TbXvE1 gfdvXGA+YMmVD7cSgKZsDntsusbo9kGFIDErundV+.Capp4B4VPCSBN3v3i+ BOXJfA5Z01j7kJlkAAAm6suCgHoFlPhMDBYNCE99DhjNeDR0qNAPAeDkx6zq QYQ5NZrUXDE0auNYp8ZWiMzmX4qT2B0icEUJq4qOJs9bKN24WDn+jUsNW56b f4CLX6JAue8D.930QL0v2IT869jTN3FkXNfi6EtwSDtnO.U5JxUUYSCecACT yNTJYfs0LF32.GTiR.ZQA3oR9F0306ExBeyBYkkk7HQqIgFORXrkkcfOhG7H 6BeLQywZVyEnBPqYF7kCnhbKOoRPijVKOV4YPljfLfLDpOLDHilQPtYOUrSQ OUzeopOnv3lMk04p2Bjk.gVZVtcK32cuU7whBpFpTObpTMg7kTJJViGDw3rF 5d4LhFGoauG1YORB60iGeGPZ6LrJT1hT0eEuDbyzhwDMfvg1YYSH8BHzLBnx JllEfszb1mT81aLWHHiOJAlYS+HoWv.mQvX.BWbCkHPqFwkRRujHxGIhcf0z P2w9AR.Ap7n8QloIoW.DrAHvzN.R1LlFwMWZDkftXYLCHMRlQoQnmjFQXxE. Y.oAwCRitVVmJm+J8LLShIntXBWK9rG5M+6HSzTDwjAIoe4BZ9nSsIAwUpzG W85LsugJmLmODzbHq2k6FM04aBultROXWGBzGtSDS7E2rvwvdcmBmOAioF.v qVM.rtIipF.3redpAPWJJqbRkduGTTwPag2vgCqnvoymhRBVCBAqmDQvcQj0 p0VzFe9A2oiHAGTlQGF0acRvwyWo27b0irtkip5Q3YbtccULNAlX5NnA.yXj MNmp1BDkzOghlWmK30AOW5ZMlDCsKzF2eLc7blorGmdOMyDLlXW3v.Aimw7A KJo41A5qARFzOxgEWpfw8VzJ7Lt2P6nJcRnOSDLJM1JX5CInr4SoTUPe4z4M JCNw8EBObP3IDN1MeU6dLF1a3XT580dL5ksXrkPtpeh5mPIyHgXES1QavrAa ONl4sbUPGOfHZp4BhudH5nnht4elixY.aWrduEOGQlO4ibOuQ+qf3jWwiaZr X69aQ5shFHz7QGtXp6e++mUQPhwFQS7EUHrSp.+oeC94BujePqqHwEPuWpFN +T0XWlUp8leoSl9lt8Wi5lxi0aZIQqz.78tWNqQxElsP8xKJ8UWzdddNSbYw mx4Mz0Er7tqQ3XsG8OWhAsG8OXEOYOltNbH6I1a1id4tCym3WYz2T9jbeoed yi58sGcUU7030Xzy5M2ym1yP5Yj+rm2z06X7Jxu7AMj83Q87XFuv9K9SD4Na 7BOF+K+4uq2twgiG5w4uHiP+XLZn+rmvwXOdT+.uezynwLewaD82T9LJ+cON ewXxWE6O8id2hG1e2e1CZLym9Fi9lpeRuu3iwUdT4+.uexmGS7m8ftyFuBuu 72G07oH+kOFZTwe9n4+XKu.spx8+4jwXzlRvA5mKq0mF+f4Ttvdp4NFTydh2 d8oK02sus7+PfgKEy -----------end_max5_patcher-----------
How generous and kind! You guys are amazing souls. I am very grateful of all your advices.
And many apologies for this delayed reply.
Thank you! Yes. I will use play~ object in poly_player then.
@ Mark Durham
I have 24GB RAM, and i7 processor. So the ram is not much of a problem, but polybuffer~ seems to operate a little unstably on my laptop. Also, the object seems to change the order of buffer as opposed to my intention of having buffer 1 to 60 as the order of the audio file names.
As for size, each file is about 30MB. All of them Mono WAV files running 6 minutes 5 seconds precisely.
Would you please show me a preliminary patch of how you’d tackle a similar task if you have time? I’d really appreciate it!
@ Roman Thilenius
Thank you for verifying! I will stick to the idea of fitting play~ in poly~ poly_player then.
@ Roald Baudoux
Thank you, Roald Baudoux. What a great help!!! Attached are the patches that I amended only slightly from you generously posted up. I have a couple of questions regarding your patch.
1) Is the line~ object in the mother patch is tracking the PRESENT point of audio files?
2) it seems my patch does not operate although buffers are all there…this is a very stupid question, but why would that be?
Again, thanks a million!
Yes the line~ object constantly updates the playback position – it is a "natural" companion to play~ for linear sound playback.
Some of your buffers shared the same name so it could lead to problems. Also, the arguments of the sprintf object should match the buffer’s names. If your buffer are named "audio1", "audio2", etc then the sprintf should be like this: "sprintf set audio%i". If you use a polybuffer~ named "audio" change the sprintf like this "sprintf set audio.%i" (notice the tiny difference). Note that the polybuffer~’s name does not have to include a dot but the dot must be used as a separator between polybuffer~’s name and the buffer number when you want to choose a specific buffer using an argument or a message to a playback object.
I don’t have a folder with 60 files of 6 minutes so I couldn’t test. So I added a few objects and messages to help you track possible bugs.
Let me know if it functions as expected.
Forums > MaxMSP