Yes, interesting. Substantially, It's like having a NRT button on the Server GUI (near Record you would have NRTRec)
// 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);
})