[Csnd] bpf with discrete steps

Hey hey,
to prefix: I know that bpf should theoretically do this, but I wondered if there is an even more straightforward alternative.

I have an input signal kInput and I want to generate kOutput. It should happen in steps:
if kInput >=0 < ix1: kOutput y1
if kInput >= iX1 < iX2: kOutput y2
...
if kInput >= iXn: kOUtput = yn

This could be done with if and elseif statements or with bpf using two points at every iX point. Though with bpf, I think, these points should have strict ordering. A minimal issue though.

Any other ideas? Something in the Csound universe I missed?

Best wishes,

Jeanette

Hi Eduardo,
many thanks for your reply. This does look elegant and efficient enough. bpf absolutely rocks! Best utility in the past few years!

Best wishes,

Jeanette

Eduardo Moguillansky, Mar 19 2026: