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

Re: [sc-users] Request for SC 3.4 - a better NRT interface



I looks like you want SuperCollider 2. If you still have a computer capable of Classic, NRT works just fine. I don't think there is any way to make the below really work in SC3. Because of the way clocks work, your example would still take 7 seconds to collect the needed messages. What I think would actually solve this is a clock that doesn't schedule in real time, but as fast as possible, a server that doesn't render sound, but just records its OSC messages (in this case, it would also have to collect the 3 SynthDefs that are created as well) and then render them. This might be doable, but I would also argue that the code below is not really efficient SC3 code and most people do not code real time work in this style. There are few if any examples that don't show SynthDefs and Synth objects. 

The changes that would be needed to make Synth and the Node objects (the main interfaces MOST people use when they use SC) truly NRT compatible are big, and would certainly break code. I tried... before I made CTK, I made a huge effort. I tried creating clocks like I mentioned above, as well as servers that would act a little smarter. If this is wanted and other devs are as interested, I'm more then happy to work more on this, but when it comes down to it, the current language interface and Node objects present some serious roadblocks, and creating a single object that unblocks all of these is probably not possible. 

The change you mention is a SuperCollider 4 project IMO. 

Best,

Josh

On May 3, 2009, at 6:33 AM, Eric Lyon wrote:



Yes, interesting. Substantially, It's like having a NRT button on the Server GUI (near Record you would have NRTRec)


That could be the "real time" NRT function, i.e. rendering commences only after a performance session. The other case would be "non real time" NRT synthesis which would commence as soon as all the OSC messages were assembled. Something like this:

// a simple live soundfile playback routine

s.waitForBoot({

var file = "sounds/a11wlk01.wav";
var outputFile = "lyonNRTexample.aiff";
var sops = ServerOptions.new.numOutputBusChannels = 2;
var startTime = 0.0;
var renderDuration = 7.0;
var buf = Buffer.read(s, file, action:{
var rate = 2.0;
Routine {
/* hypothetical Render call below */
// Render(s, outputFile, sops, startTime, renderDuration);
3.do({
{ PlayBuf.ar(1,buf,BufRateScale.kr(buf) * rate) ! 2}.play;
rate = rate * 0.8;
2.0.wait;
});
}.play;
});

})

// The following code writes to a file exactly what the above code plays live.
// Note how much easier NRT would be if the hypothetical "Render" object existed.

s.waitForBoot({
var notelist;
var timeNow = 0.0;
var bufnum = 0;
var file = "sounds/a11wlk01.wav";
var rate = 2.0;
var outputFile = "lyonNRTexample.aiff";
var nrtScore;
var sops = ServerOptions.new.numOutputBusChannels = 2;
var player = SynthDef(\Playa,{|rate = 1, buf = 0|
var sound = PlayBuf.ar(1,buf,BufRateScale.kr(buf) * rate) ! 2;
Out.ar(0,sound);
}).load(s, {

notelist = notelist.add( 
[timeNow,[\b_allocRead, bufnum, file]]
);
3.do({
notelist = notelist.add(
[timeNow, [\s_new, \Playa, s.nextNodeID,0,0,\rate, rate]];
);
rate = rate * 0.8;
timeNow = timeNow + 2.0;
});
notelist = notelist.add( [timeNow + 1.0, [\c_set,0,0]] ); // guess end time (sloppy)
nrtScore = Score.new(notelist);
nrtScore.sort;
nrtScore.recordNRT("OSCjunk",outputFile, options:sops);
}.play);
})



Notice how it is non-trivial for the user to get from version 1 to version 2. That's why I think it would be a big win to get a better NRT system.

Eric




******************************************

/* Joshua D. Parmenter

http://www.realizedsound.net/josh/


“Every composer – at all times and in all cases – gives his own interpretation of how modern society is structured: whether actively or passively, consciously or unconsciously, he makes choices in this regard. He may be conservative or he may subject himself to continual renewal; or he may strive for a revolutionary, historical or social palingenesis." - Luigi Nono

*/