Count^ with non-zero default

So I’m using the Count^ (count up) module with a trigger input to select between a few different settings for a patch. I’ve noticed that when I re-open the patch in audulus it default’s back to zero because the sample-hold is re-initialised, which makes sense. But the setting that ‘zero’ relates to isn’t one that I’d like users to open up to.

I know i could re order outputs from my demux so that zero was the one I wanted to initialize to but I feel like that will make the internals of the patch confusing because they wont be in the same order as the UI.

Is there a way that I could use some kind of offset to count up between 0 and 4 but initialze on 3? I can’t figure out a way to do it.

1 Like

Yup there is a way :smiley:

You can use an ==0 expression on the output of a timer. This puts out 1 only when the output of the timer is exactly 0 (which is only during the initialization of the patch)
image
You can then use this signal as an additional trigger and for switching between two input signals for the s&h node. A signal for initialization and the signal that is used to count upwards.
Now the s&h node is initialized with a trigger-signal of 1 and an initialization value as in-signal.

Here is an edited Count^ module with the changes I described.
Count^ with init input.audulus (5.6 KB)

3 Likes

Ah that’s clever! Very cool thank you @J031

2 Likes