polybuffer~ public beta

    May 04 2010 | 7:48 am
    For the second object on Edge, let's present polybuffer~. Polybuffer~ intends to facilitate the utilization of multiple buffer~, for creating samplers for instance. When double clicking on the object, you can access to a window that displays information about the buffers (double clicking on the buffer name will display the waveform). We are looking forward to hearing comments/suggestions/bug reports.
    Installation: - move polybuffer.mx(o|e) to C74:/extensions - move polybuffer~.mx(o|e) to C74:/msp-externals - move polybuffer~.maxhelp to C74:/msp-help
    Bug reporting guidelines:
    Please report any problems you experience with clear and complete information, including steps to reproduce, software and system information, and where possible, an isolated example patch and crash log. Something like the following would be ideal. This makes it easier for us to find and fix the problems you experience. Without such clear and complete information, it is less likely we will be able to.
    Summary: Provide a descriptive summary of the issue.
    Steps to Reproduce: In numbered format, detail the exact steps taken to produce the bug.
    Expected Results: Describe what you expected to happen when you executed the steps above.
    Actual Results: Please explain what actually occurred when steps above are executed.
    Regression: Describe circumstances where the problem occurs or does not occur, such as software versions and/or hardware configurations.
    Notes: Provide additional information, such as references to related problems, workarounds and relevant attachments.
    Enjoy! ej
    Note that Max 5.1.4 or higher is required.

    • May 04 2010 | 9:43 am
      a useless post but:
      i love it! awesome e--j ! thankyou thankyou!
    • May 04 2010 | 9:52 am
      hi emmanuel,
      great object. in my opinion, one feature is missing (or i missed it) : being able to destroy one buffer into the polybuffer~ without destroying or renaming the others.
      it could allow to 'filewatch' a directory, automatically remove/add buffers accordingly to the directory content without reloading everything...
    • May 04 2010 | 11:02 am
      wonderfull ! where is the "save in patcher" option ?..................... :-)
    • May 04 2010 | 11:39 am
      The day I start a building sampler ! thanks a lot ! The getsize function is nice.
      +1 on the ability to save in some simple way (without the use of a coll) +1 on the folderwatch feature too
    • May 04 2010 | 12:23 pm
      @thomas: indeed an embed attribute would be cool
      @Leo & Guillaume: while it might be cool to automatically reload, the way it currently works is that it loads an entire folder (or append file by file), so what would you expect if you insert a new sound file in the folder and that it would change the alphabetical order? would this mean that the buffer called yoyo.3 doesn't bind to the same sound file as before?
    • May 04 2010 | 12:51 pm
      emmanuel, i wasn't thinking of implementing the filwatch directly into the object. just thinking of a clear message that could destroy one buffer (with no rename for the others).
      by the way, why don't you just use the filename for the buffer name instead of yoyo.x ?
    • May 04 2010 | 6:10 pm
      I think there's a misunderstanding between saving the buffer list and embedding polybuffer's gui in the patcher. Both features would be cool.
      Regarding saving, I suppose it could work like the coll in your helpfile, the polybuffer remembers the buffer name and it's (absolute or relative- optionnal ?) filename and load them back when opening the patch. I guess this list could be saved somewhere in the json structure or in a separate file on demand (read/write).
      As always, there's a lot of ways of doing this. The better might be to let the user program it ;). But it's always difficult when working on big projects to have one or several xml/json pattrstorage files + severals colls + some jxf + ... beside the patch itself.
      Regarding the names of buffers, I prefer having yoyo.x, it's easier to process and pretty easy to get the filename with info~.
      Anyway, I've played with it all day long, it works like a charm. Thanks again.
    • May 04 2010 | 11:30 pm
      There's two good reason for using names like yoyo.x: it's easier to iterate through it (if you want to do a bunch of info~ e.g.), there's a fix name which allow things like appendempty which is really cool if you just want to have a bunch of places to record to.
      I added the embed attribute on my todo list, on the same model as table/coll
      Adding specific message to get infos on every buffer~ is straightforward, so if you have specific utilization in mind that you think might be beneficial for other. It might be interesting to output the loop points for instance or something like that, so if you have a strong opinion or an example don't hesitate to suggest.
    • May 05 2010 | 2:07 pm
      Thanks for this nice object!
      Some remarks (Max5.1.4 under OS X.6.3):
      - when you drop an mp3, the message in Max' window is "couldn't find ", which is a strange message. - when you drop a folder containing only mp3, nothing happens and no message is displayed in Max' window. - when you drop an aiff with more than 4 channels, an "empty" buffer entry is created although, as stated in Max' window, more than 4 channels are not supported. In that case the number of channels and SR displayed in polybuffer~'s window are not consistent (see attached file).
    • May 05 2010 | 3:05 pm
      I've been working on a similar project, and I needed to dynamically create mixer/effects channels for each new sample coming in through a filewatch, and keep track of buffers that had been cleared. The way I did it was to use a simple array of flags inside the object that kept track of which buffers were un/available. Since my custom object is doing the buffer-clearing in the first place, it knows the state of each one. So every time a new sample comes in through my filewatch, my object iterates through the array of flags until it finds an available buffer. This lets you set the total number of buffers through an argument (much like poly~), but lets you recycle old buffers as you clear them and re-use them for new, incoming samples.
      Here's a snapshot of my method that fires when a new sample comes in. It finds an available buffer inside an associated poly~ (which is housing my "fileloader" patches, which are basically buffer~/groove~ pairs), and targets the correct voice to send in either a clear command or a filepath to put new data in a buffer.
    • May 06 2010 | 9:53 am
      @Patrick: thanks for pointing this out. This exposes some tricky problems of error handling ;-)
    • May 17 2010 | 8:13 pm
      Bonjour Emmanuel, thank you for developing this object!
      I have a bug report that is just too simple to be reported in the straight-forward way: if in the patch there is a "send" or "receive" object that has the same name of the polybuffer~, it crashes when you load the sounds.
      Best, Bruno
    • May 18 2010 | 12:29 am
      @bruno… nice one…
    • Jun 02 2010 | 2:10 am
      A new version is available bellow. It includes bug corrections and new features you suggested: - embed attribute allows you to store references to the buffer~ with the patcher - tinge polybuffer~ when an error is sent from attached buffer - import mp3 and weird sound files (requires quicktime) - comments in the poylybuffer window have a fixed size - abort loading when the symbol is already used for something else than a buffer~ (so it doesn't crash…)
      Installation and bug reporting guidelines unchanged.
      Have fun.
    • Jun 02 2010 | 4:04 pm
      haven't tested it yet, but great :)
    • Jun 15 2010 | 12:18 am
      Thanks for the examples and the description, this has been fixed for the next beta.
    • Jul 02 2010 | 4:37 pm
      Hi, Is there a way to keep the files sorted by names with @embed 1 ?
      I have nine soundfiles loaded. The names start as 1.aif to 9.aif When I drop the folder, 1.aif is loaded in yoyo.1, 2.aif in yoyo.2 etc. good.
      If I save and close the patch then relaunch it the files are randomized(?). Now If I close the patch without saving anything and relaunch I get exactly the same random(?) sorting.
      What am missing?
    • Jul 03 2010 | 11:20 pm
      That's odd it works here. Could you upload the some files somewhere? Thanks.
    • Jul 04 2010 | 6:14 pm
    • Jul 05 2010 | 1:08 am
      great I can reproduce (it just needed a few more samples ;-) It'll be fixed for the next beta.
    • Jul 06 2010 | 12:09 pm
      nice work emmanuel! many thanks for your effort. i just wonder if it's possible to do something like " record~ yoyo.1 " and then " writewav "...to save the content of a particular buffer. and maybe a " writeall " too?
    • Jul 06 2010 | 1:56 pm
      You can definitely use something like "record~ yoyo.1". You can also send messages to specific buffer~ instance using the send message. If you do send 0 write for instance you'll have a dialog box for saving every buffer, which might not be really user friendly but... Maybe a writetofolder message would be cool.
    • Jul 06 2010 | 3:12 pm
      cool! thanks emmanuel for the reply. "writetofolder" is a +1000!!
    • Jul 06 2010 | 4:08 pm
      Hi Emmanuel
      Thanks for this very usefull object.
      For some reason it doesn't work in M4L for me. It says it needs max 5.14 or higher. I have 5.14 installed on my machine. I also updated M4L to the latest version.
      Do you know what's going on?
      Intell macbook pro with snow leopard btw.
    • Jul 07 2010 | 11:43 am
      This might be already fixed for the next incremental, I can't reproduce the issue.
    • Jul 28 2010 | 6:22 pm
      Hi...I´ve been programming this interface that consist basically in a loop player that reads files randomly stored in multiple buffers (with the polybuffer object) and then these files are routed via series of gates in order to being processed with a "scrubf" abstraction (from percolate library) and a granular and gabor psola from FTM, and finally a reverb also from percolate. The gates are designed in a very simple way in order to have the files routed to one or two of this efects, and also in dry mode. Then, this "module" is duplicated 8 times so you have more diversity to load up differents folders and so on....
      So what´s the issue??...well, when i turn the Dsp on, the patch uses around 44% of my cpu being idle (i´m running a Macbook with a 2.4 ghz core2duo with 2 gb ram, and a 003 rack digidesign firewire audio interface) and Max-Msp begins to incrementally hogging ram memory (up to 1.5 gb ram). I don´t know what could it be. Could if be the polybuffer object, or just my programming errors?
      Thanks a lot, and i would appreciate your feedback Dario
    • Aug 05 2010 | 9:03 pm
      polybuffer~ doesn't really take CPU, it mainly does nothing in term of processing. It requires RAM however (which is displayed in the right left corner of the polybuffer~'s window). I would recommend you strip down the patcher, but it's highly unlikely that polybuffer~ is the culprit here (the number of sound files, therefore the RAM amount required might be the problem, or not).
    • Aug 07 2010 | 12:00 am
      The way I did it was to use a simple array of flags inside the object that kept track of which buffers were un/available. Since my custom object is doing the buffer-clearing in the first place, it knows the state of each one. http://www.creativenexusonline.com
    • Nov 02 2010 | 1:06 pm
      hi emmanuel! any new version?
    • Nov 02 2010 | 2:48 pm
      Not yet ;-)
    • Nov 05 2010 | 1:48 am
      Would it be possible for the numbers in the separate buffer-names to be in front of the name instead of at the end? Like: "1.yoyo" instead of "yoyo.1".
      In that way you could refer to the separate buffers with the $1 method ($1.yoyo in a message) and the #1 method which would be a very big plus for me.
    • Nov 05 2010 | 7:09 am
      you could use sprintf :
      [sprintf yoyo.%i]
    • Nov 05 2010 | 9:38 am
      I'm using polybuffer (and the readfolder message) to change sample banks on the fly. I numbered my files in each folder so that when the folder is loaded, the files always inhabit the same buffer (e.g. 1music.aif, 2music.aif etc. so that 1music.aif loads in as hello.1 in polybuffer~ hello. My issue is that inexplicably, at times, the correspondances get completely randomized. this issue occurs when I send the readfolder message while the DAC is turned ON. When it's turned off and I send this message, everything corresponds neatly.
      Otherwise, it's a fabulous object.
    • Dec 05 2010 | 7:40 pm
      "you could use sprintf :
      [sprintf yoyo.%i]"
      I know but [sprintf] allocates memory which is not freed until you close Max, I like to avoid using it ass much as possible.
      I thought it should be a very simple change in the code of the object to put the numbers up front so you can use ($1.yoyo) inside a message.
    • Dec 05 2010 | 10:30 pm
      sprintf doesn't really allocate memory for that, any symbol allocates memory for it's life in Max: so the $1.yoyo will also generate a symbol. One important details is that each symbol uses an unique space in memory, so if you take 1.yoyo for instance it only exists once in memory, so no matter how you create it, it will end up using the same memory space, unless you have a gigantic number of symbols you're really fine.
    • Dec 06 2010 | 11:01 am
      Thanks for your reply.
      So if I understand you correctly constructing a symbol in a message liek ($1.yoyo) is the same as constructing it with a [sprintff] ?
    • Dec 08 2010 | 6:37 pm
      yes in the sense that any "string" (aka a symbol in the Max terminology) is unique and stored in the memory.
    • Dec 10 2010 | 10:24 am
      Hey edge people,
      Can you 'crop' with polybuffer~ ?
      If not that would be a nice feature
    • Dec 10 2010 | 11:57 am
      Sure. You can send any message to one or every buffer~ contained by polybuffer~, so for instance sending send 0 crop 200 500 will crop every buffer~ with only the 300 ms after 200 ms.
    • Dec 10 2010 | 12:07 pm
      thanks :)
    • Dec 29 2010 | 11:10 pm
      Thanks a lot for polybuffer~
      Someone was asking about the use of sprintf, here i attach a screenshot...
      Best! Bodsiin
    • Jan 08 2011 | 9:09 pm
      hi great object, is it possible to create a polyphonic sampler with this object? I have got it to make sound but each buffer loads over the other and won't allow multiple playback of files. Is there anyway to do this using play~?
      Thanks J
    • Jan 08 2011 | 9:13 pm
      You need a play~ for each voice. There isn't a polyplay~ yet!
    • Jan 08 2011 | 10:01 pm
      Polyplay~ anyone? There's an opening in the market!
    • Jan 21 2011 | 12:37 am
      polybuffer is a sexy mama
    • Jul 15 2011 | 9:55 am
      Hi - I'm wondering if there's a way to write/record into the polybuffer~ from within a patch? For ex. editing a buffer in waveform~ and then writing that edited version into polybuffer~.
      I guess if I want to use polybuffer~ in that way I could manually write the edited waveform~ contents to disk and then load that back into polybuffer~, which just seems unnecessarily convoluted... My preference would be to edit waveform~ and clik on a button that transferred the editied contents immediately to polybuffer~, and then at that point I could decide if I wanted to write the polybuffer~ contents to disk.
    • Jul 15 2011 | 8:03 pm
      is there any chance the mighty polybuffer~ will just be part of the standard distribution for max6? under max5, it has been solid for me, and others i assume, given the absence of bug reports here.
    • Jul 17 2011 | 1:26 am
      Hi - Answered my own question... I was able to edit a buffer~ and save to a polybuffer~ by writing the edited waveform~ contents into peek~ and then using a buf.Op and its 'copyInto' operation to get it into polybuffer~. Hope that makes sense.
      What a great object - I was able to both solve a problem and add some functionality I'd been planning to eventually get to...
    • Jul 17 2011 | 3:08 pm
      @driftpattern: there's a good chance that it will happen...
      @davidsmith: right, the buffer~ created/held by polybuffer~ are just normal buffer that you can manibulate, access, mess with with any buffer~ compatible object, so feel free to have fun with mxj buf.Op and more ;-)
    • Oct 15 2011 | 8:18 pm
      FYI, he Max 6 Public Beta ( https://cycling74.com/forums/max-6-public-beta-is-here ) now includes polybuffer~.
      If you have any reports or problems, we will be funneling them in with the rest of the Max 6 feature set so please use the form @ https://cycling74.com/max6betabug_form/
      Thanks for all the feedback.
    • Oct 16 2011 | 9:10 pm
      I am using polybuffer~ from its JS interface. I load a collection of samples from a config file using the append method, and I noticed that the response is always the same. There is no distinction between successful loads and missing files. In my particular situation it would be very helpful if you can get an error code as a result from the append call.
      Is this not possible currently or am I overlooking something?
      Anyway thanks for this useful object!
    • Oct 16 2011 | 9:29 pm
      Just realized there's a simple and effective way to know if the file exists before calling append. Something like:
      function isFile(filepath){ var f = new File(filepath, "read") if(f){ var result = f.isopen f.close() return result }
      return false }
    • Oct 18 2011 | 10:41 am
      Feature request: concatenate multiple buffers into one, and dump out a list of start/end points.
      Could be very useful for audio-rate sample switching; unless you need a release tail this could enable highly-optimised monophonic playback. Think: drums, one-shots, etc.
    • Jun 05 2012 | 11:54 pm
      Great object here! Very useful in cleaning up patches. I was wondering if I could request a feature.
      A lot of my sample folders have .als files from using them in Ableton.
      This means when loading in a folder I get lots of error messages in the Max window saying it couldn't read the .als files.
      Maybe if the object could have a similar feature to umenu (File Types) where you can specify the file types polybuffer~ will notice and ignore all others.
      Or if it simply just ignores all files other than what it can recognise.
      Not really a problem with functionality it just would clean up the max window.
    • Jun 07 2012 | 3:53 pm
      @farfisavox: request registered.
    • Sep 07 2012 | 5:14 pm
      agrreed with @farfisavox
    • Nov 14 2012 | 12:42 pm
      Hello Emmanuel, This is a fine piece of software indeed, but it does not solve my problem. My question is probably a request for the buffer object itself. I am looking for a way to open directly in a buffer 8 track files; i.e. not converting them out of max/msp in mono tracks or two 4 track files which is actually a useless pain and make all patches a mess. Do you see any solution or could you add this feature on the which list if it is not already there ? Thanks a lot Best regards Roland
    • Nov 14 2012 | 4:56 pm
      We have a feature request like that logged. I don't see it happening in a near future, this requires a lot of rewrite in every objects to support that.
    • Feb 19 2013 | 2:15 pm
      Hi Emmanuel,
      I'm having a problem with Polybuffer~ on Max 5. It isn't sending a bang out of the right outlet when a file/folder is loaded.
      I've downloaded the latest version from this thread, trashed preferences, but no change.
    • Feb 19 2013 | 4:08 pm
      Ah it seems that isn't the latest version for 5.
    • Mar 27 2014 | 1:10 pm
      I am starting to use Polybuffer~ I would appreciate nice help, please.
      I can tot make Polybuffer~ to play my audio files from the beginning (but the first one it plays).
      I have 5 different audio files. When I send an integer to Polybuffer~ (in order to tell it which file to play) all the files start playing at the same time. I need to play one file since the beginning , and once it is over to start playing the next one since the beginning as well and so on. Or at least make just a little crossfade between them.
      In essence, The point is, how start each file play since the beginning. (or can I choose an specific point to start reading the audio file?)
      Thank you very much in advance.
    • Sep 09 2014 | 5:27 pm
      Im a little late for the party but i have a question. I am 'clearing' buffers by sending a message "send N clear" but the file is still in the index. Is there a way to remove that index? if i have a sound in index 1 and i clear index 2 it is still in the list (when double clicking polybuffer) so now i cant add a new sound to index two.
      can anyone help?
      many thanks ned :)
    • May 15 2015 | 12:00 pm
      Is there any way to load files with more than 4 channels without having to split them beforehand?
    • Sep 12 2016 | 6:23 pm
      @emmanuel jourdan:
      I have a question regarding polybuffer~ and its memory usage: There may be holes in my general understanding of memory usage and Max, but I found it odd that small mp3-files down to 3MB (16bit,44.1kHz) actually report MORE memory usage in the polybuffer~ than for instance wav. files or aiff-files with same bit-and samplerate of about 40MB size).
      Is is really supposed to be like this? I am working on a patch where I need to lower memory-usage as it can not load all the files I need (I use 4x polybuffers, each loadbanging 10x soundfiles in whichever format be the least memory-consuming one). I figured initially that my Max 7.2.4 with my MacbookProRetina 2.7 GHz 16GB memory, (still on) mountain lion would handle this, but it falls short (out of memory) reading the last aif-file (49 out of 50) as seen in the max console in built standalone app.
      See text in example patch for my findings. Thank you for your help/ potential clarification. Knut, Norway
    • Mar 22 2017 | 7:37 pm
      Just sent a message to Emmanuel about this but perhaps others of you can help. I would like to see an example of how to use polybuffer~ with poly~ to make polyphonic, polytimbral sample player. I haven't been able to find such a thing in the documentation of the forum.