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

Re: [sc-users] Organising large projects




I'm not sure I fully understand what's going on just from this example but I'll definately be interested in more information when you've got time to go into it more. I also saw on the website that it can do note-stealing as well. Is that a MIDI-oriented thing or can it handle other kinds of note trigger as well? I've tried triggering notes using joystick buttons but I have to be very careful with my CPU use and I really don't want the sound to go all choppy when playing live. Perhaps at some point I'll install the lib and have a look around.

Thanks also to the people who responded about how to execute other files. I think I'm starting to figure out how I can make this work well.


James Harkins wrote:

On 8/30/05, Nathaniel Virgo <nathaniel.virgo@xxxxxxxxxxxx> wrote:
I'm working on a live performance in SuperCollider and at the moment all
the code is in one file, which is starting to get a little unweildy, so
I was wondering if anyone has any thoughts or experience they would like
to share about how to effectively manage SuperCollider projects in
multiple files.

Let me put in a plug for chucklib. It may not suit Nate's needs at the
moment, but for future reference here's how you would do it with that
lib (based on the idea of synthdef + routine):

// define the base prototype

AdhocClass({
	~event = (eventKey: \dummy);  // I'm probably going to change this syntax
	~preparePlay = { |self|
		~synthdef.send(s);	// see below for population of ~synthdef
	};
	~asPattern = { |self|
		Proutine({
			loop {
				~routineAction.value(self);
				~delta.notNil.if({
					(play:0, delta: ~delta).yield;
				}, { nil.yield });
			};
		});
	};
}) => PR(\sdrout);

// repeat this bit with each distinct combination of synthdef and action

PR(\sdrout).chuck(BP(\proc1), nil, (
	synthdef: SynthDef(...),	// these parameters get plugged into
	routineAction: { |self|	// the prototype instance at creation time
		// whatever you would have in your routine,
		// put it here
		~delta = /* time to next */;
	};
));

BP(\proc1).play;		// go
BP(\proc1).stop;		// stop
BP(\proc1).free;		// release resources

Don't have time to go into much detail now, but there are other insert
points for your own code (~prep for initialization, ~stopCleanup to
release resources needed only when playing, ~freeCleanup to release
other resources). There are also some GUI and MIDI hooks that are
pretty cool, and safeguards against some bad things that can happen in
performance (accidentally starting a process twice, etc.).

I'll fill in the gaps later if people are interested. This is all
based on thinking I started in spring 2004 about organizing long
performances, which led me to a solution of dynamically loadable
prototypes (PR) and instances (BP). The code is still in flux and not
thoroughly documented yet, but so far it's working very well for me.

hjh