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

Re: [sc-users] buffers and 'spawns' : SC3



- I've been using a routine to do a basic form of Granular Synthesis . . .
in the same way as I used to use a Spawn (except the Playbuf stuff is in a
Synthdef) . . . but what I was wondering is whether this is the way to do
such a thing as it seems to use a hell of a lot of CPU . . . well according
to the OS X CPU Monitor anyway.

Like, maybe there's some other thing I haven't discovered yet.


Re the buffer . . . is there then an optimum size to make it ?

One other thing . . . once you've read a soundfile to a buffer is there a
call to get it's size a la blahblah.size in SC2 . . . maybe the same but not
sure how to write it.


oh yeah, while I'm here : everytime I call the SynthDef from the routine I'm
giving it a new node. This seems a bit crazy in that after a while I've got
through 1000's. Thought that the envelope DoneAction in the SynthDef might
sort it out set at 3 but it messes with the iteration. Surely there must be
a way to kill a node and reallocate it.


Maybe I should send the simple code :

s.boot;

(
SynthDef("samplePlayerEnv",{
arg bus = 0, buffer = 0, pitch = 1,out = 0, start = 0, loop = 1,length =
1,trigger = 1;
var e,eg,soundout;
e = Env.new([0,1,1,0],[0.05,0.9,0.05],'sin');
soundout = PlayBuf.ar(2, buffer, pitch, trigger, start, loop);
eg = EnvGen.ar(e, timeScale: length,doneAction: 2);
Out.ar(out,soundout * eg)
}).writeDefFile;
s.sendMsg("/d_load", "synthdefs/samplePlayerEnv.scsyndef");
)

s.sendMsg("/b_alloc",0,100,2);

s.sendMsg("/b_allocRead",0,"Sounds/ca loop 4.aiff");



(

var r;


r = Routine({
    inf.do({ arg i;
        
        {
        //basic iteration, length controls "grain duration"
        s.sendMsg("/s_new", "samplePlayerEnv", 1001 + i  ,1,
0,'length',1,'start', 10000 * i,'trigger', Impulse.ar(1));
        
        }.defer;
//wait controls "grain rate"
        0.5.wait;
    });
    
});
SystemClock.play(r);
)

SystemClock.clear;

s.quit




thanks

Jem
> 
> On Tuesday, December 17, 2002, at 07:17 PM, Jem Finer wrote:
> 
>> Are Routines the way to go to make "spawns" ?
> 
> they work to make repeating functions that do stuff. if that's what you
> mean.
> they don't make sound.  but they can tell the server to do things.
> 
>> They seem to use a lot of CPU.
> 
> 
> 
>> 
>> The buffer seems to be able to be very small in comparison to the
>> soundfile
>> thats read into it. I'm not complaining, I'm just surprised.
> 
> that buffer is used to stream the soundfile from disk.  it just reads
> to start
> with one buffer's worth, then when the DiskIn starts it pulls it into
> the buffer
> as it goes.
> 
>> 
>> 
>> Jem
>> _______________________________________________
>> sc-users mailing list
>> sc-users@xxxxxxxxxxxxxxx
>> http://www.create.ucsb.edu/mailman/listinfo/sc-users
>> 
>> 
>> 
> -felix
> 
> _______________________________________________
> sc-users mailing list
> sc-users@xxxxxxxxxxxxxxx
> http://www.create.ucsb.edu/mailman/listinfo/sc-users