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

Re: [sc-users] buffer loading question




Am 12.12.2007 um 23:30 schrieb altern:

hi stephan

i just read your mail after sending the last email few min ago ...

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.

thanks, I dont changed the default bufNum when starting up scsynth. i fixed both problems to make it look as you suggest, but I still get exactly the same error.

SynthDef("player",{ arg out=0,buffer=0;
	Out.ar(out,
	  Pan2.ar(PlayBuf.ar(1,buffer, BufRateScale.kr(buffer),0,0,1),0)
	)
})

// NOT working
s.sendMsg('/d_load', 'player.scsyndef');


Hmm, is there actually a valid synth def file at a path called 'player.scsyndef' ?

If yes, I think this should work (assuming the sound file path is correct too, and you don't evaluate all this lines at once. The synth def must be known to the server before it can play it.



s.sendMsg('/s_new', 'player', 1000);
s.sendMsg('/b_allocRead', 1030, 'numeros.wav', 0, -1);
s.sendMsg('/n_set', 1000, 'buffer', 1030);

And I am actually waiting for the sound to be loaded, it is just 3 sec long stereo sound.


Is there now a playing (possibly silent) synth, at all?

I'm used to the convenience of SuperCollider.app, so I don't know how you will find out in your case.
OSCresponder possible?

No more ideas at the moment, sorry
Good luck




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)

yes thats what I thought. I kind of remembered doing this few months ago and it was no problem to initialise it to a non valid buffer id. Thats why i was so puzzled by this issue.

But then how would you explain this problem I am getting? I tested this on Linux and Windows and it was the same.

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

that is becoming my bible lately :)

thanks!

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