Skip to content

Scales (31EDO)

scales31(beats, dsl)

Returns a ScalePattern tuned to 31-tone equal temperament (31EDO). The API mirrors scales() but uses 31EDO interval arithmetic throughout.

scales31(beats: number, dsl: string): ScalePattern

DSL format

Identical to scales():

'C4:major' — single scale, repeated every cycle
'D4:neutral,E4:minor' — two scales, cycling every beats

Available modes

All modes share the same 7-note diatonic skeleton; only the interval sizes differ.

ModeSteps (degree 1–7)Notes
major0, 5, 10, 13, 18, 23, 28Meantone major
minor0, 5, 8, 13, 18, 21, 26Meantone natural minor
neutral0, 5, 9, 13, 18, 22, 27Neutral 3rd & 6th (≈ maqam Rast)
dorian0, 5, 8, 13, 18, 23, 26
phrygian0, 3, 8, 13, 18, 21, 26
lydian0, 5, 10, 15, 18, 23, 28
mixolydian0, 5, 10, 13, 18, 23, 26
locrian0, 3, 8, 13, 16, 21, 26

1 octave = 31 steps. Each step ≈ 38.7 cents.

Characteristic intervals

Interval12EDO (cents)31EDO (cents)Steps
Minor 3rd3003108
Neutral 3rd3489
Major 3rd40038710
Perfect 5th70069718

The neutral mode’s third (step 9) sits exactly between minor and major — a sound unavailable in 12EDO.

Examples

const key = scales31(4, 'E4:neutral') // E neutral, 4 beats per cycle
const low = scales31(8, 'E3:minor') // octave lower, minor
const prog = scales31(8, 'D4:neutral,D4:major') // cycling neutral → major

Pass a ScalePattern to cast() just like a regular scales() result:

yield cast(synth, key, seq(4, '0,_,2,_,4,_,3,_'), ctx)

Degree → frequency mapping

cast() converts sequence degrees to frequencies using 31EDO math:

freq = rootHz × 2 ^ ((step + octaveShift × 31) / 31)

Degrees wrap across octaves automatically:

  • degree 0 = root
  • degree 7 = root + 1 octave
  • degree -1 = root − 1 scale step (wraps downward)