Repository Public
1// ORIX Sonata2// File: Examples/ha_nineteen_edo.sonata3// Description: The octave divided into 19 equal steps instead of 12: a scale, the nearly pure minor third and the 19-EDO major triad compared with their 12-EDO neighbours, on a sustaining organ.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// category: Harmony9// title: Nineteen Equal Steps10// teaches: microtones as pitch arithmetic, cents, functions returning pitches, comparing tunings11//12// expect: notes 5013// expect: tracks 114// expect: duration 31.8750s15// expect: deterministic16// Step `n` of an equal division of the octave into `steps` parts, from `root`.17fn edo(root: Pitch, steps: Number, n: Number) -> Pitch {18 return root + 1200cents * (n / steps)19}2021composition "Nineteen Equal Steps" {22 tempo 80bpm2324 instrument organ: FluteOrgan {25 gain -8dB26 // All nineteen steps of one octave.27 for n in 0..20 {28 play edo(C4, 19, n) duration 1/829 }30 rest 1/831 // A diatonic major scale: steps 0 3 6 8 11 14 17 19.32 for n in [0, 3, 6, 8, 11, 14, 17, 19] {33 play edo(C4, 19, n) duration 1/434 }35 // The same triad in 12-EDO, then in 19-EDO: the third is 21 cents lower and smoother.36 chord [C4, E4, G4] duration 1/137 chord [C4, edo(C4, 19, 6), edo(C4, 19, 11)] duration 1/138 // Minor: 300 cents against 315.8 cents.39 chord [C4, Eb4, G4] duration 1/140 chord [C4, edo(C4, 19, 5), edo(C4, 19, 11)] duration 1/141 // A cadence that only exists in 19: IV - V - I with pure-sounding thirds.42 chord [edo(C4, 19, 8), edo(C4, 19, 14), edo(C4, 19, 19)] duration 1/243 chord [edo(C4, 19, 11), edo(C4, 19, 17), edo(C4, 19, 22)] duration 1/244 chord [C4, edo(C4, 19, 6), edo(C4, 19, 11), C5] duration 1/145 }46}47