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

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



Hello


>sensitivity of the Amplitude ugen: yes of course, but for now this is not
the issue. I am still stuck with the counter's simple +1 / -1 calculation
(see below).

>PulseCount: yes. But problem remains, the sum_counter doesn't add the way I
would like it to.

I didn't describe the expected outcome well enough, here again:
A counter, +1 upon every thresh crossing, -1 every 2", always adds/subtracts
in steps of 1.
So for example: -1, -2 , -3, -2 (thresh crossing), -3, -4, -5, -4 (thresh
crossing), -3 (thresh crossing), -2 (thresh crossing), -3, -4, -5...

full code:
SynthDef(\Counter, { arg thresh = 0.1;
	var in, amp, counter_one, counter_two, sum_counter;

	in = SinOsc.ar(440, 0, Trig1.kr(KeyState.kr(35), 0.3)); // test signal,
KeyState 'p'
	amp = Amplitude.kr(in);
	counter_one = PulseCount.kr(amp-thresh); // +1 every thresh crossing

	counter_two = PulseCount.kr(Impulse.kr(0.5), reset: amp-thresh); // -1
every 2"
	counter_two = counter_two * -1;

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

        // results:
	counter_one.poll(Impulse.kr(0.5));
	counter_two.poll(Impulse.kr(0.5));
	sum_counter.value.poll(Impulse.kr(0.5));
	}).play;

(for now I the counter's value "jumps", because of counter_two's reset arg /
counter_one's lack of reset arg.
 But without any reset args, or reset for both counters, I still get
problematic results).


cheers



-----
- - - 
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-tp7622265p7622291.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/