grame-cncm / faustlibraries

The Faust libraries
https://faustlibraries.grame.fr
188 stars 61 forks source link

add ba.tAndH() and fix ma.zc() #172

Open oleg-nesterov opened 10 months ago

oleg-nesterov commented 10 months ago

ma.zc() is wrong in that it can't detect the crossing if the input signal is zero in between, for example

process = os.oscrs(F) : *(abs > 1/2) : ma.zc;

will never output 1.

The new function ba.tAndH() looks useful on its own, for example we can do

zc_threshold(t) = ba.tAndH(abs >= t) <: *(mem) < 0;

which reports the "significant" changes from -t to +t or vice versa.

While at it, change ba.time() to eliminate the unnecessary -(1) and generate a slightly better code.