{
  "format": "forge.graph/0",
  "name": "Limiter",
  "author": "Chirp",
  "license": "CC-BY-4.0",
  "remixed_from": null,
  "description": "Keeps peaks under a ceiling: anything louder than Threshold is turned down at once and let back up over Release. Use it last on a board to tame spikes from fuzz, resonant filters or self-oscillating echoes.",
  "tags": ["utility", "dynamics", "limiter"],
  "face": {
    "display": { "kind": "meter", "label": "Limit", "source": "reduce", "range": [1, 0.5] },
    "knobs": [
      { "id": "threshold", "label": "Thresh", "default": 0.7,
        "controls": [ { "target": "ceiling.v", "from": 1, "to": 0.05, "curve": "exp" } ] },
      { "id": "release", "label": "Release", "default": 0.4,
        "controls": [ { "target": "env.release_ms", "from": 20, "to": 500, "curve": "exp" } ] },
      { "id": "output", "label": "Output", "default": 0.4,
        "controls": [ { "target": "output.amount", "from": 0.5, "to": 2 } ] }
    ]
  },
  "nodes": {
    "env": { "block": "envelope", "mono": true, "set": { "attack_ms": 0.3 }, "in": { "x": "in" } },
    "ceiling": { "block": "value", "mono": true },
    "reduce": { "block": "formula", "mono": true, "set": { "expr": "min(1, b / max(a, 0.0001))" }, "in": { "a": "env", "b": "ceiling" } },
    "limit": { "block": "formula", "set": { "expr": "a * min(1, c / max(b, 0.0001))" },
               "in": { "a": "in", "b": "env", "c": "ceiling" } },
    "output": { "block": "gain", "in": { "x": "limit" } }
  },
  "out": "output"
}
