{
  "format": "forge.graph/0",
  "name": "Compressor",
  "author": "Chirp",
  "license": "CC-BY-4.0",
  "remixed_from": null,
  "description": "A studio compressor for guitar: anything louder than Threshold is turned down, by as much as Ratio says, so soft notes and hard ones come out closer in level and sustain longer. Attack lets the pick through before it clamps down; Mix blends the squashed sound with the dry one (parallel compression), keeping the attack and the evenness.",
  "tags": ["compressor", "dynamics", "utility", "sustain"],
  "face": {
    "display": { "kind": "meter", "label": "Squash", "source": "reduce", "range": [1, 0.5] },
    "knobs": [
      { "id": "threshold", "label": "Thresh", "default": 0.7,
        "controls": [ { "target": "thr.v", "from": 0.5, "to": 0.02, "curve": "exp" } ] },
      { "id": "ratio", "label": "Ratio", "default": 0.6,
        "controls": [ { "target": "amount.v", "from": 0.3, "to": 0.95 } ] },
      { "id": "attack", "label": "Attack", "default": 0.35,
        "controls": [ { "target": "follow.attack_ms", "from": 0.5, "to": 60, "curve": "exp" } ] },
      { "id": "release", "label": "Release", "default": 0.4,
        "controls": [ { "target": "follow.release_ms", "from": 40, "to": 800, "curve": "exp" } ] },
      { "id": "makeup", "label": "Makeup", "default": 0.4,
        "controls": [ { "target": "makeup.amount", "from": 0.8, "to": 2 } ] },
      { "id": "mix", "label": "Mix", "default": 1,
        "controls": [ { "target": "mixer.mix", "from": 0, "to": 1 } ] }
    ]
  },
  "nodes": {
    "follow": { "block": "envelope", "mono": true, "in": { "x": "in" } },
    "thr": { "block": "value", "mono": true },
    "amount": { "block": "value", "mono": true },
    "reduce": { "block": "formula", "mono": true, "set": { "expr": "min(1, mix(1, a / max(b, 0.0001), c))" }, "in": { "a": "thr", "b": "follow", "c": "amount" } },
    "squash": { "block": "formula", "set": { "expr": "a * min(1, mix(1, b / max(c, 0.0001), d))" },
                "in": { "a": "in", "b": "thr", "c": "follow", "d": "amount" } },
    "makeup": { "block": "gain", "in": { "x": "squash" } },
    "mixer": { "block": "blend", "in": { "dry": "in", "wet": "makeup" } }
  },
  "out": "mixer"
}
