Skip to main content

Module scala_scl

Module scala_scl 

Source
Expand description

Scala scale file (.scl) parsing — clean-room from the open Scala format spec.

A .scl file describes ONE octave/period of a scale as an ordered list of pitches above the implicit 1/1 (0 cents). Grammar (comment lines begin with !):

! name.scl
<description text, may be blank>   ← first non-comment line
<count>                            ← number of note lines that follow
<pitch 1>                          ← a ratio `p/q` (or `p`) OR a cents value `x.y`
...
<pitch count>                      ← the last pitch is the formal octave (e.g. 2/1 or 1200.0)

A pitch TOKEN is a ratio when it has no . (either p/q or a bare integer p ⇒ p/1), and cents when it contains a .. Anything after the value on a line is a description and is ignored. Degree 0 (1/1) is implicit and never listed.

Parsing is a COLD path and may allocate transiently; the produced SclScale is a fixed-size, Copy, heap-free value so the hot note→frequency build/lookup never allocates.

Structs§

SclScale
A parsed Scala scale: count pitch entries describing one period above the implicit 1/1. Fixed-size and Copy — no heap, safe to embed in the tuning-table build path.

Enums§

SclEntry
One pitch entry of a Scala scale, kept in its ORIGINAL exact form so that a just-intonation ratio (e.g. 3/2) stays exact and a cents value stays a float.

Constants§

MAX_SCALE_NOTES
Upper bound on scale degrees. A .scl beyond this is rejected (bounded, DoS-safe).

Functions§

parse_scl
Parse Scala .scl text into a fixed-size SclScale.