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

Re: [sc-users] buffer loading question




Am 12.12.2007 um 20:41 schrieb altern:

hi

I have a simple question about loading buffers, the swiki seems to be down for the last couple of hours so I could not search the mailing list. I guess there is a simple answer.

When I load and assign the buffer to a synthdef instance, after having instantiated the synthdef I dont get any sound at all. However if i load the buffer before, the synthdef plays it ok. The only difference is the order of executing the commands. I paste both sequences. Sorry for using server synthax, I am controlling this from python so i am not sure about the sclang synthax.




Never mind, some of us are true friends of OSC-messaging!


I noticed a few things in your code:

A buffer index number of 5000 is probably too high. Default numBuffers is 1026, but maybe you have changed this on the command line when starting the scsynth server.

Anyway, here on my computer the buffer gets index zero like this, not 5000.

The "/n_set" is assuming a synth's arg name called "buffer", but in the SynthDef there is actually "bufnum".
So, this "/n_set" has no effect.


Anyway, one can exchange buffers on the fly, free them, alloc anew, use others, while a synth is playing. No problem to start a synth with a "wrong" buf index (buffer without data), "/n_set" it later, voilà.

(There might be audio clicks, when working like this)

And maybe read "Server-Command-Reference.html" to see how to handle asynchronous server commands.

Have fun













// this one works!
s.sendMsg('/b_allocRead', 5000, 'numeros.wav', 0, -1);
s.sendMsg('/d_load', 'player.scsyndef');
s.sendMsg('/s_new', 'player', 1000);
s.sendMsg('/n_set', 1000, 'buffer', 5000);

// this one does NOT work
s.sendMsg('/d_load', 'player.scsyndef');
s.sendMsg('/s_new', 'player', 1000);
s.sendMsg('/b_allocRead', 5000, 'numeros.wav', 0, -1);
s.sendMsg('/n_set', 1000, 'buffer', 5000);

I tried it with two different synthdefs and sounds. This is the simplest synthdef, the other one used different Ugens than this one.
(
SynthDef("player",{ arg out=0,bufnum=0;
	Out.ar(out,
		Pan2.ar(PlayBuf.ar(1,bufnum, BufRateScale.kr(bufnum),0,0,1),0)
	)
}).store;
)

I guess there is a reason for this, looks like the synthdef does not get initialisated properly. Maybe because it takes by default buffer 0 and there is no any buffer in the server at the moment of initalisation?.

thanks for any tip

enrike
_______________________________________________
sc-users mailing list
sc-users@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-users