[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] buffer



On Dec 25, 2003, at 8:53 PM, Mike Whyte wrote:

and i was wondering if there is a more efficient way of
loading soundfiles;

closehat = Buffer.read(s,"/Users/blah/desktop/closehat.aif");
closebuf = closehat.bufnum; //to get the buffer number for playbuf.

You could use the messaging style:

s.sendMsg("/b_allocRead", 0, "/Users/blah/desktop/closehat.aif");

Buffers are stored in a global array, indexed by integers starting at zero. In this case, I put 0 as the buffer number.


Also check the [Server-Command-Reference] helpfile:

/b_allocRead allocate buffer space and read a sound file.
int - buffer number
string - path name of a sound file.
int - starting frame in file (optional. default = 0)
int - number of frames to read (optional. default = 0, see below)
bytes - an OSC message to execute upon completion. (optional)


Allocates buffer to number of channels of file and number of samples requested, or fewer if sound file is smaller than requested. Reads sound file data from the given starting frame in the file. If the number of frames argument is less than or equal to zero, the entire file is read.
Asynchronous. Replies to sender with /done when complete.



Best,

Sergio
http://www.sergioluque.com