hey,
im using a function called ~pParTracks
build on Ppar
to separate \dur
from the other event keys. In the following example i play two different Pdefs
in parallel with different rhythms.
(
var rhythm, fxs;
# rhythm, fxs = ~pParTracks.(
[\test1, Pseq([3,1,2,2], inf)],
[\test2, Pseq([8,4], inf)],
);
Pdef(\rhythm, rhythm).play(t, quant:1);
f = fxs;
)
and can access all the other event keys for a specific Pdef
for making transitions with a function called ~runTrans
using an envelope over a specific duration of time. In this example amplitude goes from 0.5 to 0 linearly over a time of 4 seconds for the first Pdef
inside Ppar
at index 0.
(
~runTrans.(f[0], (
amp: Env([0.5, 0], 1, \lin))],
), 4);
)
or iterate over both channels and do the transitions for both Pdefs
(
f[0..1].do {|channel|
~runTrans.(channel, (
amp: Env([0.5, 0], 1, \lin),
), 4)
};
)
This works pretty well!
When now using PbindFx
to bind a source Pdef
to an effect Pdef
im still able to access all the source event keys for making transitions but not the effect event keys.
ive traced the event:
track 0:( 'instrument': additiveLPF, 'rel': 1.0, 'modDec': 0.2, 'fxDataSize': 1,
'tilt': -3, 'inharmonic': 0.1, 'cleanupDelay': 0.2, 'atkCurve': 0, 'lpfEnvAmount': 8000,
'fxPredecessors': IdentityDictionary[ (1 -> 0), (o -> 1) ], 'lpfSlope': -5, 'freqEnvAmount': 0, 'out': 0, 'lpfRelCurve': -4.0,
'fxOrder': [ 1 ], 'type': pbindFx, 'lpfAtkCurve': 8.0, 'peakSlope': -3, 'relCurve': 0,
'dur': 0.25, 'atk': 1.0, 'dec': 2.0, 'peakRes': 24, 'amp': 0.25,
'fxSuccessors': IdentityDictionary[ (1 -> o), (0 -> 1) ], 'defaultFxOrder': [ 0 ], 'drive': -15.0, 'fltAtk': 1.5, 'fltRel': 2.5,
'legato': 0.8, 'fxEvents': [ ( 'delMin': 0.25, 'cleanupDelay': 2, 'fx': combC, 'amp': 1,
'mix': 0.5, 'delMax': 0.5, 'decay': 2, 'delStereoRatio': 0.9, 'delHz': 35.0 ) ], 'fDec': 4, 'ampModAmount': 1, 'decCurve': 0,
'freq': 129.783, 'lpfCutoff': 100, 'ampModFreq': 10, 'fDecCurve': 8.0 )
There you can see that the different keys for the comb filter effect are kept inside fxEvents
And now i hope its that simple:
Whats the right syntax for accessing the “sub-event” keys of the comb filter effect inside fxEvents
?
I was trying something like:
(
~runTrans.(f[0], (
fxEvents:[(decay: Env([2, 4], 1, \lin))],
), 4);
)
I hope this makes sense. thanks alot
EDIT: sorry for the multiple misunderstandings of events. PbindFx
seems to use Pchain
to chain a Ptuple
with fx event keys to the source Pdef
. These fx event keys are of course not composable via the source Pdefs
as far as i understand it. damn. so no fx transitions via ~runTrans
…
here are the functions im using:
// durs can be a list, a pattern, or a function that returns a pattern
~getDurPattern = { |durs|
case
{ durs.isKindOf(SequenceableCollection) } {
if (durs.rank > 1) {
"pParTracks: flattening nested duration list %".format(durs).warn;
durs = durs.flat.postln;
};
Pseq(durs, inf)
}
{ durs.isKindOf(Function) } { Pn(Plazy(durs), inf) }
{ durs.isKindOf(Pattern) } { durs }
{ Error("pParTracks: unsupported durations format: %".format(durs)).throw };
};
~pParTracks = { |...tracks|
var fxTracks = tracks.collect { PatternProxy(()) };
var evPatternFns = tracks.collect { |trackArgs, n|
var dataPatternName = trackArgs[0];
var durs = ~getDurPattern.value(trackArgs[1]);
fxTracks[n] <> Pdef(dataPatternName) <> Pbind(\dur, durs)
};
var rhythmPars = Ppar(evPatternFns);
[rhythmPars, fxTracks]
};
// make transitions
~runTrans = {|transProxy, transDef, transDur|
transProxy.source = Pbind(*~mapTrans.(transDef, transDur).asKeyValuePairs);
};
// used by ~runTrans
~mapTrans = {|parEnvs, transDur= 1|
var penvs = parEnvs.select{|v|v.class===Penv}.collect{|penv|
penv.times = penv.times*transDur
};
var busses = parEnvs
.select{|v,k| penvs.keys.includes(k).not}.collect{Bus.control(s,1)};
{
busses.collect{|bus, parName|
Out.kr(bus, EnvGen.kr(parEnvs[parName],timeScale:transDur));
};
Line.kr(0,1,transDur,doneAction:2);
Silent.ar;
}.play.onFree{
busses do: _.free
};
busses.collect(_.asMap) ++ penvs
};