Am 21.12.2015 um 06:33 schrieb Ilya <ziblatilya@xxxxxxxxx>:
> (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).
I don't agree with this analysis,
the counter logic looks perfectly ok to me without reset args.
Maybe surprising results with this example come from
an opaque test signal with more than one possible source of error:
KeyState seems to be lagged (watch polling it).
It doesn't immediately go back to 0, so it isn't a reliable input for Trig1.
Then this signal goes into SinOsc's amplitude and finally there are the
described issues with Amplitude.
With an easier test signal I get exactly the expected behaviour
(also with multiple strikes on key 'p')
SynthDef(\Counter_1, { arg thresh = 0.1;
var in, amp, counter_one, counter_two, sum_counter;
// subtract from KeyState to make it a reliable trigger
amp = Trig1.kr(KeyState.kr(35) - 0.1, 0.1);
counter_one = PulseCount.kr(amp-thresh); // +1 every thresh crossing
counter_two = PulseCount.kr(Impulse.kr(0.5)); // -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;
Maybe another confusion comes from the fact that
a keystroke doesn't cause a poll and so the raise
of the sum is not reflected in printout ?!
Regards
Daniel
-----------------------------
www.daniel-mayer.at
-----------------------------
_______________________________________________
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/