# `stable`

> Look up stable.for, which passes a value only after it holds steady for a duration.

The `stable` module removes short changes from a signal. Import it with `import stable`.

## `for`

Passes a value only after the value stays the same for `duration`.

* [`duration`](https://docs.synnaxlabs.com/reference/control/arc/standard-library/stable#for-duration)`i64 ns`\* Required

  How long the value must stay the same, such as `500ms`.

`duration` takes a literal or a variable. A new variable value applies from the next change of the trigger value.

* Trigger -> a numeric or `bool` value. A `str` value gives the error `stable.for input must be a numeric or bool type, got str`.
* Output -> the steady value, of the same type as the trigger. It has the timestamp of the sample that confirmed the hold.
* Runs -> on each new trigger value. A change of value starts the hold time again, from the timestamp of that value. When a sample with the same value is stamped `duration` or more after the change, `stable.for` sends the value once. It sends again only when a different value holds for `duration`.

`stable.for` compares sample timestamps only, so a batch that arrives late does not close the window early. A hold needs a second sample with the same value, so a channel that writes only new values never triggers `stable.for`. `stable.for` resets on stage entry.

```arc
import stable

tank_pt > 500 -> stable.for(duration=500ms) -> high_pt
```

`stable.for` works the same on the Core and on a Driver.
