Max/MSP 5.1.6, issue with "sizeinsamps"

Maurizio Giri's icon

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.

Max Patch
Copy patch and select New From Clipboard in Max.

TIA
mau

Timothy Place's icon

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.

Max Patch
Copy patch and select New From Clipboard in Max.

Hope this helps!
Tim

Maurizio Giri's icon

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.

m