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

[sc-users] two separate triggers > single counter value



Hello

I am thinking of a counter whose value is influenced by two separate
triggers (?)

trigger #1 adding to the counter's value (value+1 when input crosses amp
threshold)
#2 subtracting from the same counter's value (value-1 every second)

So the counter is filling up upon amp trigger, while also empties gradually
by itself.

Trying this way:

   amp = Amplitude.ar(SoundIn.ar);
   amp_trig = Trig1.kr(amp>thresh); // trigger #1
   counter_one = Stepper.kr(amp_trig);

   auto_trig = Trig1.kr(Impulse.kr(1)); // trigger #2
   counter_two = Stepper.kr(auto_trig) * -1;

   sum_counter = Mix.kr([counter_one, counter_two]);

I also tried with:
   counter_two = Phasor.kr(amp_trig);

Getting some strange results..
Either I'm missing something, or is there another way to get the same?

Thanks.




-----
- - - 
ilya ziblat shay
--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/two-separate-triggers-single-counter-value-tp7622265.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/