Hey,
I dont know why this code is not working. I would like to start a process, if the amplitude is above a certain threshold. My if statement doesnt work, it only takes condition two in the if statement.
Can someone help? Thank you
(
SynthDef(\analy, {
var input, trig, amp, freq;
input = Impulse.ar(1);
amp = Amplitude.kr(input);
trig = Impulse.kr(10);
SendReply.kr(trig, '/amp', amp);
Out.ar(0, input);
}).add;
)
~analy = Synth(\analy);
(
OSCdef(\analy, {|msg, time|
var amp, freq;
amp = msg[3];
amp.postln;
if(amp > 0.5, {"yes".postln;}, {"no".postln;});
}, '/amp');
)