SPB Git

Repository Public

st_tuning_ab.sonata 1.7 KB 50 lines

1// ORIX Sonata2// File: Examples/st_tuning_ab.sonata3// Description: The same cadence in three tunings for comparison: equal temperament, quarter-comma meantone and just intonation, each chord held long enough to hear the thirds beat or stand still, on a vibrato-free organ.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// category: Studies9// title: Tuning A/B10// teaches: tables of cents, tuning systems as functions, a pattern parameterised by a tuning table11//12// expect: notes 4813// expect: tracks 114// expect: duration 43.3333s15// expect: deterministic16// Cents above C for the twelve notes C, C#, D ... B.17const equal = [0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100]18const meantone = [0, 76, 193.2, 310.3, 386.3, 503.4, 579.5, 696.6, 772.6, 889.7, 1006.8, 1082.9]19const just = [0, 111.7, 203.9, 315.6, 386.3, 498, 590.2, 702, 813.7, 884.4, 1017.6, 1088.3]2021// The pitch of note `n` (0 = C4) in a tuning table; octaves are pure.22fn tuned(table: List<Number>, n: Number) -> Pitch {23    let octave_index = floor(n / 12)24    return C4 + 1200cents * octave_index + 1cents * table[n - 12 * octave_index]25}2627pattern cadence(table: List<Number>) {28    // I  IV  V  I in C major, as note numbers above C4.29    for c in [[0, 4, 7, 12], [0, 5, 9, 12], [-1, 2, 7, 11], [0, 4, 7, 12]] {30        chord [tuned(table, c[0] + 12) - 12st, tuned(table, c[1]), tuned(table, c[2]), tuned(table, c[3])] duration 1/131    }32    rest 1/233}3435instrument StillOrgan: FluteOrgan {36    vibrato.depth 0st37    tremolo.depth 038}3940composition "Tuning A/B" {41    tempo 72bpm4243    instrument organ: StillOrgan {44        gain -8dB45        cadence(equal)46        cadence(meantone)47        cadence(just)48    }49}50
Files main
Menu

Theme