[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Working with playbuf/trigger



Not sure if you want the single trigger to fire exactly when received via .set or to wait for the next Impulse.

If the former, Batuhan is right that a trigger-control will save you some heartache.

If the latter, there's a neat trick you can use if you can estimate the amount of time between Impulse triggers (known for sure if the Impulse frequency is a constant -- since you're using MouseX, it's harder). Use a timed trigger that will be open for one cycle of the Impulse unit, and multiply by the Impulse.

arg t_trig = 0;

impulseFreq = (something);
gateTime = impulseFreq.reciprocal;
trigGate = Trig1.kr(t_trig, gateTime);
realTrig = Impulse.kr(impulseFreq) * trigGate;

hjh


On May 2, 2009, at 1:28 AM, Sam Ingrassia wrote:

Thanks to everyone in advance -

MyApp.applicationData.at("KeyboardOperator").at("CurrentNodeProxy").source = { 
arg rate = 1, trigger = 0, startPos = 0, loop = 1;
//enable trigger
trigger = if(BinaryOpUGen('==', trigger, 1), Impulse.kr(MouseX.kr(0.5,100,0.5)), 0);
PlayBuf.ar(1,b,rate,trigger,startPos, loop).dup;
};

With the above code, when i set trigger to 1 i can then take control via impulse/MouseX to execute trigger. My question is, how can I just execute trigger just once? for instance doing something like this:

MyApp.applicationData.at("KeyboardOperator").at("CurrentNodeProxy").source = { 
arg rate = 1, trigger = 0, startPos = 0, loop = 1;
PlayBuf.ar(1,b,rate,trigger,startPos, loop).dup;
};

MyApp.applicationData.at("KeyboardOperator").at("CurrentNodeProxy").set(\trigger, 1);

MyApp.applicationData.at("KeyboardOperator").at("CurrentNodeProxy").set(\trigger, 0);

I would think that this would jump to the startPos and then continue playing, which is the behavior that I am trying to achieve. This leads me to believe that impulse is executing at a different time/context (which i do not fully understand yet) and modulating with the value from MouseX. How can I trigger a jump back just using NodeProxy.Set()?


: H. James Harkins
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman