[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-users] NRT sample playback
Hello, I am new to SC and am studying NRT playback. I would like to be able to define a synthDef that plays back a sample like the following:
(
SynthDef("NRTsample_test",{ arg rate = 1, start = 0, bufnum = 0;
Out.ar(0,
PlayBuf.ar(2, bufnum, BufRateScale.kr(bufnum)*rate, startPos: start, loop: 0);
)
}).load(s);
)
z = Buffer.read(s, "sample.aif"); // load sample
a = Synth(\NRTsample_test, [\bufnum,
z.bufnum]); // play back
However, when I put this in my score, I don't get any errors. I just get silence.
Here is my score:
(
g = [
[0, [\s_new, \NRTsample_test, 1000, 0, 0, \bufnum,
z.bufnum]],
[0.5, [\s_new, \NRTsample_test, 1001, 0, 0, \bufnum, z.bufnum]],
[1, [\s_new, \NRTsample_test, 1003, 0, 0, \bufnum, z.bufnum]],
[2, [\c_set, 0, 0]] // finish
];
o = ServerOptions.new.numOutputBusChannels
= 2; // stereo output
Score.recordNRT(g, "sample-test.osc", "sample_test.aiff", options: o); // synthesize
)
But I get no sound! Can somebody tell me what I am doing wrong?
I am attaching an .rtf file of the code example...
Attachment:
sample_test.rtf
Description: RTF file