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

Re: [sc-users] buffer



If you hardcode the buffer number into the synthdef by
just using myBuffer.bufnum where the buffer index
should go, then the buffer number is generated at the
time the synthdef is created.

If you want to change it while a synth is playing,
pass the buffer number in as an argument and use the
argument variable in the buffer UGens. This is
generally a good idea, to separate the synth
definition from resources allocated outside the
synthdef.

Note that you can't pass in the number of channels as
an argument.

H. James

--- Mike Whyte <matrix6k@xxxxxxxxxx> wrote:
> ok, just so i got this straight-
> when we send a synthdef, that's when it picks the
> sample buffer ?
> i thought maybe i could pick a buffer via pbind
> (yes, i added the 
> proper argument in msgfunc)
> but it seems to only want to play the buffer given
> when sending the 
> synthdef.
> 
> i don't mind making a def for every soundfile i use,
> but it would be 
> nice
> to do - \buffer, Prand([1,2,3,4,5,6,7,8],inf)= and
> have it switch 
> samples randomly....
> 
> i thought that the crucial lib had the ability to
> switch samples like 
> that,
> and there's no way it sends a synthdef on every
> 'spawn' so how does it 
> do that ?
> 
> -mike
> 
> On Dec 26, 2003, at 6:16 PM, Sergio Luque wrote:
> 
> > 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
> >
> > _______________________________________________
> > sc-users mailing list
> > sc-users@xxxxxxxxxxxxxxx
> >
> http://www.create.ucsb.edu/mailman/listinfo/sc-users
> > _______________________________________________
> sc-users mailing list
> sc-users@xxxxxxxxxxxxxxx
> http://www.create.ucsb.edu/mailman/listinfo/sc-users
> 


=====
____   James Harkins /// dewdrop world
\  /   jamshark70@xxxxxxxxx
 \/    http://www.duke.edu/~jharkins

"... love and hot pants, peace, harmony..."
  -- Dick Lee, Hot Pants: The Musical

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/