RedDirection detects inc/dec of a signal


outputs 1 if previous sample was less than current

outputs -1 if previous sample was more than current

else outputs 0 - i.e. when no change


*ar(in)

*kr(in)

in - signal to track

*new(start)

direction(val)

<>last


//--

s.boot;


a= {SinOsc.ar(RedDirection.kr(MouseX.kr).poll*100+400, 0, 0.1)}.play

a.free


//--

a= RedDirection(10)

a.direction(9)

a.direction(10)

a.direction(10)

a.direction(50)