frac32.bipolar pitch
bool32.rising reset phase
bool32 square wave
int32_t Phase;
uint32_t r;
Phase = 0;
r = 1;
{
if (inlet_reset && r) {
Phase = 0;
r = 0;
} else {
if (!inlet_reset)
r = 1;
Phase += inlet_hz << 2;
}
outlet_wave = (Phase > 0) ? 1 : 0;
}