(—-)
(-)
(–)
(—)
(——)
this is an abstraction layer to allow to use granular synthesis instruments with Patterns on the same level like synthdefs. [jrh]
it is not a class anymore, as this is not needed anymore.
Note JITLib now supports a variant of this scheme. see recursive_phrasing helpfile in JITLib help.
download: granular_instrument_scheme.rtf
(
e = Event.parentEvents.noteEvent.copy;
e[\prPlay] = e[\play];
e.putAll((
global: (),
play: {
var pat, sustain;
~finish.value;
sustain = ~sustain.value;
pat = ~global.at(~instrument);
pat = pat.valueEnvir;
if(pat.notNil) {
if(pat.isSequenceableCollection) {
pat.do { arg each;
Pfindur(sustain, each).play(quant:0)
}
} {
Pfindur(sustain, pat).play(quant:0)
}
} {
~prPlay.value;
}
}
))
)
// granular synthesis instruments with Pattern player
(
s.boot;
SynthDescLib.read;
e.global[\a] =
Pbind(\degree, Pseq(#[6, 7, 4, 5]), \dur, 0.32, \instrument, \singlegrain);
)
(
SynthDef("singlegrain",
{ arg out = 0, freq=800, sustain=0.001, amp=0.5, pan = 0;
var window;
window = Env.sine(sustain, amp);
Out.ar(out,
Pan2.ar(
SinOsc.ar(freq),
pan
) * EnvGen.ar(window, doneAction:2)
)
}
).store;
)
(
Pbind(
\parent, e,
\instrument, Pseq(#[\a, \singlegrain],inf),
\freq, 550,
\dur, 0.5,
\legato, Pseq(#[0.5, 1, 3],inf),
\addme, Pseq(#[0, 0, 0, 0, 1, 1.3], inf)
).play;
)
// add different synth functions
(
e.global[\a] =
Pbind(\degree, Pseq(#[6, 7, 4, 5]), \dur, 0.132, \instrument, \singlegrain);
)
(
e.global[\a] = { arg addme=0;
Pbind(\degree, Pseq(#[6, 7, 4, 5] + addme, 3), \dur, 0.05, \instrument, \singlegrain)
};
)
(
e.global[\a] = { arg addme=0;
Array.fill(3, {
Pbind(
\degree, Pseq(#[6, 7, 4, 5] + addme),
\dur, 0.05 + 0.02.rand,
\gtranspose, 8.rand,
\instrument, \singlegrain
)
})
};
)