Counter odd / even
Hi,
is there a way to change the output value of counter so we can choose between
ie : 0 2 4 6 or 1 3 5 7
I was looking for something around modulo but didn't find it
vexpr............

Following the modulo idea :


if $i1 % 2 == 1 then $i1 else out2 $i1
if $i1 % 2 != 1 then $i1 else out2 $i1
if $i1 % 2 == 0 then $i1 else out2 $i1
if $i1 % 2 != 0 then $i1 else out2 $i1
@wil it's working fine for even, but for odd with zero you get -1
@sebastien, I like the idea, but it only print odd or even number, instead of counting
the best solution I get is :
[expr ($i1 % ($i2/2)) * 2] (even)
[expr ($i1 % ($i2/2)) * 2 + 1]( odd)
if you need nagative output, then
if $i1 % 2 != 0 then $i1 else out2 $i1
Yeah, I thought about that -1
here is my revise

i understood the question differently...
but for the splitting into even and odd source audio´s if is the shortest.
one might also like to use [cycle] (which luckily allows to be reset from outside since many years.)
[cycle] had the advantage over [if] (and other arithmetic methods) that it can have more than 2 outputs, but it would only work when you count regulary and not do any additional modifications to the values or start counting backward at a non-predictable position.
Now you say it, maybe the question was not to split odd / even numbers but to
progress 0 2 ... or 1 3 ... on each bang ?
Then I would not use counter at all.
but set 0 or 1 as start and inc/dec 2 on each bang

it seems i was wrong, but i understood he wanted "1, 3, 5" as nonsecutive output from a counter.
which could have been done by * 2, - 1
sorry maybe my first post was not that clear.
I needed to count either in even or odd numbers, not to do sorting, and in a loop context.
ie : 0 2 4 6 or 1 3 5 7
first post was clear.
'or' - as in apples or oranges.
For even Numbers just double, for odd numbers double and add one.

@wil thank you !
@bruce this is a good starting point, but the output is out from the scope of a counter loop
best solution I think is [($i1 % $i2) * 2] or [($i1 % $i2) * 2 + 1]