How Synths Use Scala Files to Remap MIDI Pitch

Modern software synthesizers utilize Scala files to break free from the traditional 12-tone equal temperament (12-TET) system, enabling microtonal and alternative tunings. By reading the mathematical pitch definitions stored within a .scl file—often paired with a keyboard mapping .kbm file—the synthesizer intercepts incoming standard MIDI note numbers and dynamically recalculates the fundamental frequency assigned to each key before passing it to the audio generation engine.

Structure of a Scala File

A Scala (.scl) file is a plain-text document defining an arbitrary musical scale. Its structure consists of:

  1. A short text description of the scale.
  2. The number of notes per scale period (often an octave, though it can be any interval).
  3. A list of pitch values defined either in cents (represented as floating-point decimals, such as 1200.0 for an octave or 701.955 for a pure fifth) or ratios (represented as fractions, such as 2/1 or 3/2).

The Role of Keyboard Mapping (.kbm)

While a .scl file defines the interval relationships of a scale, it does not specify where those intervals fall on a physical MIDI keyboard. For this, synthesizers look for an accompanying Keyboard Mapping (.kbm) file. The .kbm file provides:

If no .kbm file is loaded, the software defaults to an internal mapping—typically anchoring note 60 (Middle C) or note 69 (A440) as the root and mapping scale steps sequentially upward and downward across adjacent MIDI keys.

The Real-Time Pitch Conversion Pipeline

When a user plays a key on a MIDI controller, the software synthesizer processes the tuning change through a deterministic digital signal processing (DSP) pipeline:

  1. Event Interception: The synthesizer receives a standard MIDI Note-On event carrying an integer note number from 0 to 127.
  2. Table Lookup: Instead of applying the standard 12-TET mathematical formula (\(f = 440 \times 2^{(m - 69)/12}\)), the synth’s tuning engine queries the internal lookup table generated from the loaded Scala file.
  3. Period and Degree Calculation: The engine calculates which scale step the MIDI note corresponds to and how many scale periods (octaves or non-octave cycle lengths) away from the base reference key it lies.
  4. Frequency Synthesis: The synth computes the exact target frequency using the accumulated ratio or cent offsets. If an interval is specified in cents, the frequency conversion uses \(f = f_{\text{ref}} \times 2^{(\text{cents} / 1200)}\). If specified as a rational fraction (\(a/b\)), the synthesizer directly multiplies the base frequency by \((a/b)\).
  5. Oscillator Frequency Assignment: The resulting frequency value is delivered directly to the digital oscillator’s phase accumulator for that voice.

Unlike legacy hardware workarounds that relied on sending global MIDI Pitch Bend messages—which constrained polyphonic performance by bending all notes simultaneously—modern software instruments perform this pitch remapping at the internal per-voice DSP level, allowing fully polyphonic microtonal playback.