First time here? Check out the FAQ!
x

Capytalk counter bug (not working)

+1 vote
479 views

http://kyma.symbolicsound.com/qa/?qa=blob&qa_blobid=3597582407487041303

I'm trying to make a simple counter which incriments once every capytalk tick. I don't want to use ramp as that requiers scaling up and is time dependant and sample rate dependant and I want it more direct (one tick = one increment). I've attached my attempts but it just seems to be tottaly random for no apparent reason.

Counter Bug type A is using accumilateWhile: initialValue: reset: but it gives random no step or multiple steps. I then tried

Counter Bug B which made use of STGC and adding one to the previous !count value. This is better as it does count only by one but not every time and randomly misses out counts. 

Counter Bug C goes back to accumilate function but uses a bigger range and we can see that it's not linear and is exponetial for some reason.

Counter Bug D uses the raw accumilate funtion with no arguments and we can see that that version is linear at least, but.......

Counter Bug E zooms in on Counter Bug D and shows it's still missing the occational incriment. 

Is there a way to gaurentee a simple one tick one increment counter?

http://kyma.symbolicsound.com/qa/?qa=blob&qa_blobid=3597582407487041303

asked Jun 13, 2021 in Capytalk & Smalltalk by pete-johnston (Practitioner) (670 points)

3 Answers

0 votes

Although Capytalk runs at 1000hz, because any trigger or gate signal has to transition from non-positive to positive, it means the effective maximum tick rate of Capytalk is 500hz. It's kind of like the nyquist limit for Capytalk. 

What you can use instead is a built in counter, eg. !LocalTime. Save it's value at the begining of the timing duration and subtract that from its current value. 

Eg (in and STGC):

 

the Sound

answered Jun 14, 2021 by alan-jackson (Virtuoso) (15,840 points)
edited Jun 15, 2021 by alan-jackson
0 votes

second atempt

Counter Bug.kym.zip

apparently ithe upload didn't work first time. BTW I don't think Alans version cured the problem.

answered Jun 14, 2021 by pete-johnston (Practitioner) (670 points)
edited Jun 14, 2021 by pete-johnston
0 votes

Hi Pete,

Here is an example of a millisecond counter that uses a low-level millisecond clock event value. (The multiply is to left shift the value so that it can be used as an integer.)

answered Jun 18, 2021 by ssc (Savant) (128,120 points)
...