Red at 2V and green at 3V are the voltage levels to compare. (could be set by a POT)
Green Vrc is the filtered digital signal. 0% at time 0, then high %, middle %, low %, middle %, high %, 0%.
Vout in blue is the output. Set high if high % and set low if % is low. Will hold id % is in the middle.
View attachment 108592
V2 through V6 makes the signal. A2 ORs then together. A2 pulls down to 0V and up to 3.6V like a TTL gate.
Nodes highIN and lowIN can be made by POTs.
View attachment 108593
RonS