Previous topic

Faust Examples

Next topic

Sample and Hold

This Page

Counter

FAUST

Source: faust_tutorial.pdf / 6.1

i =  +(1)~%10:-(1);

Stride

signal I {default: -1}
I + 1 >> Modulo ( modulus: 10) >> I;            # I is Integer
signal I {default: -1 reset: Reset}
trigger Reset {}
I + 1 >> I >> Compare ( value: 8 ) >> Reset;    # I is Integer
I + 1 >> C >> Modulo ( modulus: 10 ) >> I;              # I and C are Real
C - 1 >> Count;                                         # Count is Real
I + 1 >> C >> [ Modulo ( modulus: 10 ), Level ( offset: -1 ) ] >> [ I, Count ];         # I, C, and Count are Real

Stride Counter

Counter (
        startValue:     0
        rollValue:      9
        increment:      1
        start:          none
        stop:           none
        reset:          off
)
>> Count;
Counter ( rollValue: 9 ) >> Count;