Hello,
I’m trying to send a realtime amplitude analysis from a buffer, which is stored inside a control Bus to a Pbind to control the amplitude level of the Synth.
In the example below I tried to control tha amp level inside of the Pbind with the In.kr signal but I can’t set the control signal inside UGen.
Any ideas how I can use that information in the control bus to manipulate the amp level inside of Patterns?
~controlbus = Bus.control(s,1);
~buffer = Buffer.read(s, Platform.resourceDir +/+ “sounds/a11wlk01.wav”);
(
~loudnessSynth = SynthDef(\amplitude, {
var in = PlayBuf.ar(2, ~buffer, loop:1);
var chain = FFT(LocalBuf(1024), in);
var lout = Loudness.kr(chain).poll(1);
Out.kr(~controlbus.index, lout);
}).add;
)Synth(\amplitude)
(
~mainSynth = SynthDef(\SimpleSine, {|freq = 440, out, amp=0.5|
var env = EnvGen.kr(Env.perc(0.01), doneAction:2);
Out.ar(out, SinOsc.ar(freq, 0, 0.2) * env * amp) }).add;
)
(
Pbind(\instrument, \SimpleSine,
\dur, 0.1,
\freq, Pexprand(100,1000,inf),
\amp, (In.kr(~controlbus))
).play;
)