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

[sc-users] buffer loading question



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.

// 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