{
  "schemaVersion": 1,
  "slug": "vocal-range-calculator",
  "category": "music",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "ec92a729bc06dd7313f97110d9caac7b1d994f48531614c8bd5d4627537ef14c",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/vocal-range-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": "S=m_hi−m_lo; oct=S÷12; f=440×2^((m−69)÷12)",
    "vars": [
      [
        "m",
        "Equal-tempered MIDI pitch number"
      ],
      [
        "S",
        "Interval (semitones)"
      ],
      [
        "oct",
        "Interval (octaves)"
      ],
      [
        "f",
        "Pitch frequency (Hz)"
      ]
    ],
    "note": "Reports only the selected pitch interval and equal-tempered frequencies. Endpoint notes do not establish a singer’s voice type, tessitura or vocal health."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const names=['C','C#','D','D#','E','F','F#','G','G#','A','A#','B'];const midiOf=n=>(Number(n.slice(-1))+1)*12+names.indexOf(n.slice(0,-1));const lo=midiOf(lowNote),hi=midiOf(highNote);if(!Number.isFinite(lo)||!Number.isFinite(hi)||hi<=lo)return {semitoneRange:null,octaveRange:null,lowFrequency:null,highFrequency:null,__error:'inputError'};const span=hi-lo;return {semitoneRange:span,octaveRange:span/12,lowFrequency:440*Math.pow(2,(lo-69)/12),highFrequency:440*Math.pow(2,(hi-69)/12)};",
    "inputs": [
      {
        "name": "lowNote",
        "type": "select",
        "default": "E2",
        "options": [
          {
            "value": "C2"
          },
          {
            "value": "D2"
          },
          {
            "value": "E2"
          },
          {
            "value": "F2"
          },
          {
            "value": "G2"
          },
          {
            "value": "A2"
          },
          {
            "value": "B2"
          },
          {
            "value": "C3"
          },
          {
            "value": "D3"
          },
          {
            "value": "E3"
          },
          {
            "value": "F3"
          },
          {
            "value": "G3"
          },
          {
            "value": "A3"
          },
          {
            "value": "B3"
          }
        ]
      },
      {
        "name": "highNote",
        "type": "select",
        "default": "E4",
        "options": [
          {
            "value": "C4"
          },
          {
            "value": "D4"
          },
          {
            "value": "E4"
          },
          {
            "value": "F4"
          },
          {
            "value": "G4"
          },
          {
            "value": "A4"
          },
          {
            "value": "B4"
          },
          {
            "value": "C5"
          },
          {
            "value": "D5"
          },
          {
            "value": "E5"
          },
          {
            "value": "F5"
          },
          {
            "value": "G5"
          },
          {
            "value": "A5"
          },
          {
            "value": "B5"
          },
          {
            "value": "C6"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "semitoneRange",
        "precision": 0,
        "unit": "semitones"
      },
      {
        "name": "octaveRange",
        "precision": 2,
        "unit": "octaves"
      },
      {
        "name": "lowFrequency",
        "precision": 2,
        "unit": "Hz"
      },
      {
        "name": "highFrequency",
        "precision": 2,
        "unit": "Hz"
      }
    ],
    "interpret": null
  }
}
