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): ScalePatternDSL format
Identical to scales():
'C4:major' — single scale, repeated every cycle'D4:neutral,E4:minor' — two scales, cycling every beatsAvailable modes
All modes share the same 7-note diatonic skeleton; only the interval sizes differ.
| Mode | Steps (degree 1–7) | Notes |
|---|---|---|
major | 0, 5, 10, 13, 18, 23, 28 | Meantone major |
minor | 0, 5, 8, 13, 18, 21, 26 | Meantone natural minor |
neutral | 0, 5, 9, 13, 18, 22, 27 | Neutral 3rd & 6th (≈ maqam Rast) |
dorian | 0, 5, 8, 13, 18, 23, 26 | |
phrygian | 0, 3, 8, 13, 18, 21, 26 | |
lydian | 0, 5, 10, 15, 18, 23, 28 | |
mixolydian | 0, 5, 10, 13, 18, 23, 26 | |
locrian | 0, 3, 8, 13, 16, 21, 26 |
1 octave = 31 steps. Each step ≈ 38.7 cents.
Characteristic intervals
| Interval | 12EDO (cents) | 31EDO (cents) | Steps |
|---|---|---|---|
| Minor 3rd | 300 | 310 | 8 |
| Neutral 3rd | — | 348 | 9 |
| Major 3rd | 400 | 387 | 10 |
| Perfect 5th | 700 | 697 | 18 |
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 cycleconst low = scales31(8, 'E3:minor') // octave lower, minorconst prog = scales31(8, 'D4:neutral,D4:major') // cycling neutral → majorPass 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)