Repository Public
1// ORIX Sonata2// File: Examples/just_intonation.sonata3// Description: The same progression twice on an organ: first in equal temperament, then with thirds and sevenths corrected to just intonation by cent offsets.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// expect: notes 369// expect: tracks 110// expect: duration 44.4444s11// expect: deterministic12// Offsets of just intervals from equal temperament.13const just_major_third = -13.7cents14const just_minor_third = 15.6cents15const just_fifth = 2cents16const harmonic_seventh = -31.2cents1718fn equal(root: Pitch) -> List<Pitch> {19 return [root, root + 4st, root + 7st, root + 10st]20}2122fn just(root: Pitch) -> List<Pitch> {23 return [root, root + 4st + just_major_third, root + 7st + just_fifth, root + 10st + harmonic_seventh]24}2526composition "Just Intonation" {27 tempo 54bpm28 key C major2930 let roots = [C3, F3, G3, C3]3132 instrument organ: FluteOrgan {33 gain -10dB34 marker "equal temperament"35 for r in roots {36 chord equal(r) duration 1bar37 }38 marker "just intonation"39 for r in roots {40 chord just(r) duration 1bar41 }42 // The two thirds side by side: the beating stops on the second.43 chord [C4, E4] duration 1bar44 chord [C4, E4 + just_major_third] duration 1bar45 }4647 master {48 effects {49 reverb chamber(mix: 0.15)50 }51 }52}53