{
  "schemaVersion": 1,
  "slug": "guitar-string-tension-calculator",
  "category": "music",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "0443be45ac51a8526fd628f0834ade9490f9660b8c18b8a1c35182b5876627ad",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/guitar-string-tension-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "T = ρπ(d/2)²(2Lf)²; f = 440×2^((M−69)/12)",
    "vars": [
      [
        "ρ",
        "String material density, kg/m³"
      ],
      [
        "d",
        "String diameter, m"
      ],
      [
        "L",
        "Scale length, m"
      ],
      [
        "f",
        "Vibrating frequency, Hz"
      ],
      [
        "M",
        "MIDI note number"
      ],
      [
        "T",
        "String tension, N"
      ]
    ],
    "note": "d and L are converted from inches (×0.0254). Density lookup: plain steel 7850, wound 6200, stainless 7500 kg/m³."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const density = { plain: 7850, wound: 6200, stainless: 7500 }[material] || 6200; const d = gauge*0.0254; const L = scaleLength*0.0254; const names = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']; const noteName = String(pitch).slice(0, -1); const oct = Number(String(pitch).slice(-1)); const midi = (oct + 1)*12 + names.indexOf(noteName); const freq = 440*Math.pow(2, (midi - 69)/12); const mu = density*Math.PI*Math.pow(d/2, 2); const tension = mu*Math.pow(2*L*freq, 2); const lb = tension/4.44822; return { tensionNewtons: tension, tensionLb: lb, tensionKg: tension/9.80665, massPerMeter: mu*1000, setTensionLb: lb*stringsInSet, pitchFrequency: freq, feel: lb < 12 ? 'Very light' : lb < 17 ? 'Light' : lb < 22 ? 'Medium' : lb < 28 ? 'Heavy' : 'Very heavy' };",
    "inputs": [
      {
        "name": "gauge",
        "type": "number",
        "default": 0.01,
        "min": 0.006,
        "max": 0.08,
        "step": 0.001,
        "slider": true
      },
      {
        "name": "scaleLength",
        "type": "number",
        "default": 25.5,
        "min": 5,
        "max": 40,
        "step": 0.01,
        "slider": true
      },
      {
        "name": "pitch",
        "type": "select",
        "default": "E4",
        "options": [
          {
            "value": "E2"
          },
          {
            "value": "A2"
          },
          {
            "value": "D3"
          },
          {
            "value": "G3"
          },
          {
            "value": "B3"
          },
          {
            "value": "E4"
          }
        ]
      },
      {
        "name": "material",
        "type": "select",
        "default": "wound",
        "options": [
          {
            "value": "plain"
          },
          {
            "value": "wound"
          },
          {
            "value": "stainless"
          }
        ]
      },
      {
        "name": "stringsInSet",
        "type": "number",
        "default": 1,
        "min": 1,
        "max": 12,
        "step": 1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "tensionNewtons",
        "precision": 2,
        "unit": "N"
      },
      {
        "name": "tensionLb",
        "precision": 2,
        "unit": "lb"
      },
      {
        "name": "tensionKg",
        "precision": 3,
        "unit": "kg"
      },
      {
        "name": "massPerMeter",
        "precision": 3,
        "unit": "g/m"
      },
      {
        "name": "setTensionLb",
        "precision": 1,
        "unit": "lb"
      },
      {
        "name": "pitchFrequency",
        "precision": 2,
        "unit": "Hz"
      },
      {
        "name": "feel",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
