Jitlib and sequencing?

I took a look at jitlib this weekend and it is a fun tool! But I have some problems concerning the sequencing.

Lets start by declaring a Proxyspace

s.boot;
p = ProxySpace.push;
p.makeTempoClock(1);

Now I define the following NodeProxy

(
~x = {
	var sig, env;
	sig = Blip.ar(\freq.kr(440), \nharms.kr(40), \amp.kr(0.1));
	env = Linen.kr(
		\gate.kr(1),
		doneAction: Done.freeSelf,
		releaseTime: \release.kr(0.1)
	);
	sig = Pan2.ar(sig, \pan.kr(0), env);
}
)

and now i want to sequence this

(
~y = Pbind(
	\instrument, ~x.source,
	\degree, Pseq([[0, 9 ,18], [4, 12], [0, 4, 9], [7,3,0]], inf),
	\dur, Pseq(([1, 1, 4, 1, 1]/5), inf),
	\pan, Pwhite(-1, 1)*0.3,
	\release, Pseq([0.001, 0.00001], inf),
)
)

Now it already starts playing - but what if I would like to route the sequenced synth through a filter?
In Jitlib I can do the following

~filter = {BPF.ar(\in.ar(), \freq.kr(200))};
~filter.play;
~x <>> ~filter;

How can I sequence a synth w/o loosing the routing possibilities of jitlib? So e.g.

~filter.play;
~y <>> ~filter;

Another Question regarding sequencing: ProxyMixer is really cool - is there an equivalent regarding setting the parameters of a sequenced voice?

A more general problem I have in SC: there are always such a multitude of ways to do things in sc so I get lost in it - what is the best way to cope with this?

1 Like

A quick note:

When you do this, you don’t refer to the NodeProxy, you refer to the code of it, so the Pbind has no connection with the NodeProxy (it just happens to use an instrument with the same code).

Well, the example you sent isn’t doing what you think. Your ~x proxy is playing, but you can’t hear it because it’s not being monitored. Then the Pbind on ~y is playing a SynthDef \instrument (which happens to be the implicit function used by ~x.source, as @jpdrecourt mentioned), and it’s playing it to the main outputs (not via the NodeProxy’s bus). This will make it impossible to later apply effects. It’s basically bypassing jitlib.

Here are two different ways you might do what you want (depending on what you want):

#1

First of all, create a SynthDef for your instrument and play it via a Pbind in a NodeProxy. This SynthDef must have an \out (or \i_out) control, so it sends to the right bus. We will run it on the ~x proxy’s bus, and then you can apply effects by using the \filter NodeProxy role:

(
SynthDef(\x, { arg out;
	var sig, env;
	sig = Blip.ar(\freq.kr(440), \nharms.kr(40), \amp.kr(0.1));
	env = Linen.kr(
		\gate.kr(1),
		doneAction: Done.freeSelf,
		releaseTime: \release.kr(0.1)
	);
	sig = Pan2.ar(sig, \pan.kr(0), env);
	Out.ar(out, sig);
}).add
)

(
~x = Pbind(
	\instrument, \x,
	\degree, Pseq([[0, 9 ,18], [4, 12], [0, 4, 9], [7,3,0]], inf),
	\dur, Pseq(([1, 1, 4, 1, 1]/5), inf),
	\pan, Pwhite(-1, 1)*0.3,
	\release, Pseq([0.001, 0.00001], inf),
)
)

// Monitor it so you can hear it (a proxy doesn't play to the main outputs by default)
~x.play

// Apply a filter on a later slot (our Pbind is on slot 0)
~x[1] = \filter -> { |in| BPF.ar(in, \freq.kr(200))};

#2

A second approach would be (if that’s what you intended) to have a NodeProxy playing a sound, and then modify its parameters as it runs. This is kind of like having a mono synth “always running”. However, it means the chords in your Pbind won’t work, it is only playing one note at a time. Here you don’t create a SynthDef explicitly, you just create the NodeProxy (which will always be generating sound if its \amp is up), and then you can modify its parameters using the \set NodeProxy role. As before, you can also apply effects by using the \filter NodeProxy role:

(
~x = {
	var sig, env;
	sig = Blip.ar(\freq.kr(440), \nharms.kr(40), \amp.kr(0.1));
	env = Linen.kr(
		\gate.kr(1),
		doneAction: Done.freeSelf,
		releaseTime: \release.kr(0.1)
	);
	sig = Pan2.ar(sig, \pan.kr(0), env);
}
)

// Monitor it so you can hear it
~x.play

// Play a pattern that modifies the running proxy's parameters
(
~x[1] = \set -> Pbind(
	\degree, Pseq([[0, 9 ,18], [4, 12], [0, 4, 9], [7,3,0]], inf),
	\dur, Pseq(([1, 1, 4, 1, 1]/5), inf),
	\pan, Pwhite(-1, 1)*0.3,
	\release, Pseq([0.001, 0.00001], inf),
)
)

// Apply a filter on a later slot
~x[2] = \filter -> { |in| BPF.ar(in, \freq.kr(200))};

Hope that helps get you started,
Glen.

3 Likes