Forums > MaxMSP

Max/MSP 5.1.6, issue with "sizeinsamps"

Nov 24 2010 | 10:21 pm

Hi, the sizeinsamps message doesn’t work when you change sample rate (see the attached patch).
The problem existed in previous versions of Max also (I wrote about this in the forum 3 months ago), and I hoped for a fix in this version. Would an incremental fix be possible? It breaks some of my abstractions if I decide to change sample rate, in this case I have to close and reload the patch.


-- Pasted Max Patch, click to expand. --

Nov 24 2010 | 11:25 pm

Hi Maurizio,

I have pasted a fixed version of your patcher below, which should do what you want.

The thing to remember about buffer~ (which may not be obvious at first) is that it is simply a storage mechanism for samples, and its notion of the sample-rate is tied to the samples it contains rather than the sampling rate of the environment.

For example, if you read a soundfile that was recorded at 48KHz, the buffer should remain at 48KHz regardless of what the environment is running at. This is why the buffer~ has the "sr" message to set the sample-rate, as I demonstrate in the patcher below.

Hope this helps!

-- Pasted Max Patch, click to expand. --

Nov 25 2010 | 9:56 am

Hi Tim, OK!

It works, thank you for the workaround.
I didn’t even know the "sr" message.

However I still think "sizeinsamps" should be fixed.
It should be, IMHO, completely unrelated to the sample rate.
i.e. whenever I send the message "sizeinsamps N" I need the buffer to contain exactly N samples, even if I switched the sample rate in the middle of the work, and no matter what the internal sample rate of buffer~ is/was/will be.


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

Forums > MaxMSP