Hey guys.
I would like to ask for help, please.
Nice to meet you everyone.
I have a question about linking control structure with ‘Pbindef’ and spectral features.
I have a Pbindef and would like to play it when a condition is true (eg: if (spectralflatness < 0.5) {Pbindef.play} {Pbindef.stop}).
here the Pbindef function
~pS = Pbindef(
\pSaw,
\instrument, \bpfsaw,
\freq, f,
\freqLag, 0.5,
\freqLagCrv, -7,
\amp, Pwrand([0.03, 0.15, 0.3, 0.5, 0.75], [0.15,0.15,0.20,0.20,0.30], inf),
\cfmin, f * Prand((1,2..5), inf),
\cfmax, f * Pxrand((10,11..50),inf),
\rqmin, Pexprand(0.003,0.03, inf),
\rqmax, Pexprand(0.03,0.07, inf),
\freqLF, Pexprand(0.3,0.7, inf),
\detune, Pexprand(0.3,0.7, inf),
\sus, Pexprand(0.3,9.0, inf),
\pan, Pwhite(-1.0,1.0, inf),
\out, 0,
\rout, ~rbus,
\rsend, -3,
);
the spectral flatness analysis from the help browser
(
///////////// Spectral Flatness
SynthDef.new(\features, {
var in, chain, flat, flatdb, flatdbsquish;
in = XFade2.ar(WhiteNoise.ar, SinOsc.ar, MouseX.kr(-1,1));
chain = FFT(LocalBuf(2048), in);
~specFlatness = SpecFlatness.kr(chain);
~specFlatness.poll(1, "Flatness: ");
}).add;
)
x = Synth.new(\features);
I tried this:
SendTrig.kr(~specFlatness < 0.5, ~pS.play, ~pS.stop);
and this:
(
s = Routine({
var flatness = ~specFlatness;
// Select.kr(flatness <= 0.5, [~pS.play, ~pS.stop]);
if(flatness < 0.5) {~pS.play} {~pS.stop};
}).play;
)
I know that conditional/boolean is not executed on these structures with SynthDef (Pbindef).
I tried using Select.kr and even Trig.kr. But I was not successful.
Does anyone can please help me?
I also sent this message to Telegram group…
But I believe here is a good path to help me out
Thank you very much,