System for automatically resizing buffer~ following read

Mark Durham's icon

Hi all,

I'm building a sample player which is going to be part of a generative soundscape mixer. Now, if you do not define a size for buffer~ then load a file into it (using the read message) it automatically sets the buffer to the size of the file. This is great, but if you then load another sound of a different length the buffer size does not change.

Is there a simple way of having buffer~ adapt it's size to whatever sound you load into it?

I've checked out the system used in X-player, but it seems very complicated and I don't quite understand it.

Any thoughts appreciated.

brendan mccloskey's icon

The obvious answer is to use the (replace) message to [buffer~] instead of (read) - if this is not what you need, this forum is filled with threads on related topics, so have a search......

and this just popped up recently too:
https://cycling74.com/tutorials/week-22/

Brendan

Mark Durham's icon

Hi Brendan,

Thats just the ticket. Guess I should have read the reference before posting this...

Many thanks,

Mark