I like being able to map x.set variables to be controlled by touch OSC, or by GUIs. I figured out how to change parameters of of Pbinds by using Pdefn. But because those messages are not x.set messages, I haven’t figured out a solution to have them controlled by something, other than typing it in. Is there a way around this that I’ve overlooked? Here is an example using touch osc.
//8 chan version
(
SynthDef(\plucking, {
arg amp = 0.1, freq = 440, decay = 5, coef = 0.1, pan=1, out=0;
var env, sig;
env = EnvGen.kr(Env.linen(0, decay, 0), doneAction: 2);
sig = Pluck.ar(
in: WhiteNoise.ar(amp),
trig: Impulse.kr(0),
maxdelaytime: 0.1,
delaytime: freq.reciprocal,
decaytime: decay,
coef: coef
);
sig = PanAz.ar(8, sig, pan);
Out.ar(out, sig);
}).add;
)
(
Pdefn(\pan, 0.1); //allows you to use pan as a nice argument
Pdefn(\degree, Pwhite(7, 15));
b = Pbind(
\instrument, “plucking”,
\scale, Scale.lydian,
//\pan, Pwhite(0.1, 1.7, inf), //randomized 8 chan spatialization on its own
\pan, Pdefn(\pan), //allows you to control the pan manually!!!
\degree, Pdefn(\degree), //7-15 is the normal range. But can expand larger. -20-0 sounds more angry harpsichord-like. 20-30 is really high.
\amp, Pwhite(0.1, 0.5),
\decay, Pwhite(7, 12), //7, 12
\coef, Pwhite(0.01, 0.1),
\dur, Prand([0.1, 0.2, 0.4, 0.27, 0.13, 0.38], inf)
).play;
)
Pdefn(\pan, 0.1); //0.1 - 1.6; 1.7 = chans 0 and 7
Pdefn(\degree, Pwhite(7, 30)); //Since there are two variables, I can’t figure out a way to map a controller onto this…
b.pause; // will resume where paused.
b.play;
b.reset
b.stop;
(
OSCdef.new(
\push1,
{
arg msg;
b.play(msg[2]); //will get a message saying "already playing, but it works!
},
‘/1/push1’,
recvPort:8000
);
OSCdef.new(
\push2,
{
arg msg;
b.pause(msg[2]);
},
‘/1/push2’,
recvPort:8000
);
)