Quantcast

PulseCount and do something

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

PulseCount and do something

mahatGma
I am trying to count beats with PulseCount and do something (like update a value) with if statement.
How to achieve this?
(
{
        a = PulseCount.kr(Impulse.kr(4));
        b = mod(a, 5);
        if (b == 0,
                "bang".postln,
                “nil".postln)
}.play
)

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PulseCount and do something

mahatGma
sorry for the noise, after searching the archive I saw this link
http://supercollider.sourceforge.net/wiki/index.php/Boolean_logic_in_the_server

the solution would be

{
        a = PulseCount.kr(Impulse.kr(4));
        b = mod(a, 5);
        SendTrig.kr(BinaryOpUGen('==', b, DC.kr(0)));
}.play

and

OSCFunc({  });
Loading...