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

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





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