Forums > MaxMSP

buffer question

September 24, 2010 | 4:13 pm

I am recording to 8 buffers in a patch and I have send them a clear message followed by a size 20000 message when I needed to delete them.
The size message is necessary because am cropping the first to the actual length and then resizing the 7 others to this size before recording to them.

This has worked great but I was wondering if it is the most CPU & thread efficient way of doing it.

Would it be enough if I just sended a size message since it is also somhow deleting the buffer ?

I have a feeling that the clear message is more heavy since it it is setting all the samples to zero.



September 25, 2010 | 8:45 am

Hello Thomas Sandberg,

I often do this kind of [cpuclock] test when i want to know how long time a process need ; that’s an easy way to get an idea about the CPU cost, almost in _max_ world (actually i do not use _MSP_ so much) … and it seems add "clearlow" message after/before "size" one is not heavy (but IMHO useless) ;

while "clear" message crash my macbook (10.4.11 / 5.1.5) ;-)

– Pasted Max Patch, click to expand. –

September 26, 2010 | 7:58 pm

Thanks a lot for the test patch. I look forward to explore and test

I have omitted the clear message and use only the size 20000 message – and it works perfect.

But I am still wondering what the difference between "size" and "clear" is corewise. In the reference is says that "clear" is writing zeros to the buffer – but what is "size" really doing ? Is it also writing zeros or is it just removing the pointer to the sample array ?
Because then it might be more cpu gentle !!


September 27, 2010 | 8:35 am

Hello Thomas Sandberg,

IMHO : "Size" just free the pointer and get another one with good size ; it might be a "_resizeptrclear" as samples seems to be zeroed ; but whitout the C code nothing is sure …

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