Forums > MaxMSP

Too Many Buffers?

September 19, 2013 | 7:27 pm

Hi, I working quickly on a project involving many buffers, 51 to be exact. Is there some place in settings where this number, or more likely, the space allocated towards buffers, is located? I am getting really shoddy behavior where only a handful of the buffers will load. I have a button that resets the buffer read message on all. When I press that button, another group of buffers will load, and the ones that were previously loaded will clear. What is going on? Does anyone know? Thanks!


September 19, 2013 | 11:28 pm

It’s not an answer to your question, but maybe the polybuffer will perform better, and make things easier. However, I am quite sure it is not a matter of allocated memory. The OS takes care of it, and would use virtual memory if real runs out.


September 19, 2013 | 11:34 pm

51 is not many buffers! I have projects with much much more…
The space allocated to your buffers is your main memory.
The place to change it is in your hardware, you would need to buy more memory for the computer…
You need 10 MB for each minute of audio (its stored as 32bit float). If you got 2GB of ram and each of your buffers eats half an hour of audio, you won’t fit it into the available memory and the computer would start to swap (slow).
Clearing a buffer does not free the memory, it will write zeros into it, which will take time depending on the size of the buffers. Try not clearing them or instead resizing them (which could be slow as well…)
You can also play audio with sfplay which only eats small memory for its buffering…

hope that helps…

Stefan


September 20, 2013 | 6:19 am

in case you are successively loading 51 files from disk i would not be surprised if that ends up with interruptions after the 33th.

(in theory it should not, but it does in practice under certain circumstances, mainly when you do that in overdrive or when there are backgroundprocesses already heavily reading from disk.)


September 20, 2013 | 8:22 am

Thanks for your responses. I will look into using polybuffer~.


September 20, 2013 | 8:28 am

Also be aware that loading an audio file into a buffer~ takes time. How much time depends on your hardware and the audio files, and can vary a lot. When I load more than one buffer, I immediately load the first one, but use the bang from the rightmost outlet to trigger the ‘read’ message to the next buffer~, and so on. You might also want to add a short delay between reads (a [delay 0] might be just enough time to let Max think about anything else it needs to do).

You’ll get a variety of answers to your question because there’s still a lot we don’t know about your project. How large are the files (or the amount read into the buffer)? Depending on what you’re doing, [sfplay~] might be more appropriate than [buffer~].


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