Write simple array into a buffer

Hello,
how is the easiest way to write array content into buffers?
~buffer = Buffer(s);
~data = (0…49).scramble;

thank you!

The most common way (not the only way) is to use the Buffer method .loadCollection:

~buffer = Buffer.loadCollection(s, (0..49).scramble);
2 Likes

thank you! but why does it creates a temporary file? is not a lenguaje side thing?

See the help file for Buffer … loadCollection and sendCollection. The help files explains about the temporary file being created in the process. The tmp file is automatically deleted after use.

1 Like

Buffer data have to be stored in the server, if you’re going to use them in the server.

The temp file is a transport mechanism to get the data from language memory to server memory.

If you keep the data only in the language, then server UGens can’t access the data.

hjh

1 Like

Thank you very much all of you for the clarifications
all the best!