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

[sc-users] Re: Background server processing



Item State writes:
 > >  But how to get it? with Pipe (but:lack of
 > > communication) or "unixCmd" (total lack of
 > >  communication)? Or can server be booted in NRT?
 > 
 > ah ok. but that would be a nice proposal anyway : be
 > able to run a server in NRT mode, it would just sit
 > there and wait for a command that asks it to process a
 > OSC file ... this would be really nice . you are
 > right, this is not possible at the moment.

...and I wonder if it will be in the future... as server have 
to be as simple as possible.

 > 
 > > The point is how to process buffers (which exist on
 > > the server) (eg. analyze a few minutes
 > > of recorded sound a while ago, then cut it to lesser
 > > fragments, and -- let's say -- save in
 > > separate buffers) to not disturb music already going
 > > from speakers. (...)
 > 
 > that's interesting, i've been wanting to do something
 > similar but haven't found a solution to do it in
 > supercollider server. like, analyzing a recording,
 > finding transitions and re-sorting chunks etc. seems
 > to be similiar to what you are trying to do.
 > 
 > you could write the buffer to disk and run a separate
 > program to analyze it, like maybe csound or so which
 > is capable of writing text files for example...
 > 
 > otherwise : you could write the buffer to disk and
 > analyze the sound on the language side, by spawning a
 > new Task or Routine and inside the new thread read
 > bits from the file using the SoundFile class ...
 
These ideas make sense. In first case the problem is how do 
I know if processing is finished? My experiences with Pipe 
are rather sad: 

//--------------------------------------------
(
SynthDef(\test_gr, { 
	Out.ar(0, 
		(SinOsc.ar(440,0,0.4)
		*EnvGen.ar(Env.sine(0.1,1), doneAction: 2))!2 ) 
}).send(s);
)

(
u = p = c = nil;
value { 
	Task( {
		"2nd Task".postln;
		{u != 0}.while { 
			loop { 
				//".".post; 
				Synth.grain(\test_gr).play;
				0.9.wait;
			}; 
		};
		"2nd task DONE".postln;
	}).play;

	Task( {
		"1st Task".postln;
		p = Pipe.new("sleep 4; echo 'this goes to stdout'", "r"); 
		//c = p.getLine.debug("from stdout");
		//u = p.close.debug("result");
		//how to check if Pipe is finished?
		//anyone of above commented commands makes sclang frozen.
	}).play;
	
	
};
)

u.debug("result");
c.debug("from stdout");
//--------------------------------------------

The latter solution assumes very low priority of sclang, of lower than server's one at
least. But  -- I don't know -- it may take ages to finish up?
And of course, the second assumption: either lang and server have to run on the same
machine...

Some ideas about that? Is there any other way to do something with external processes?
(except writing one's own server-application, I'm not able to do it. So far.)

/ak/

[maybe important: i run linux-gentoo+emacs tandem]