Repository Public
1// ORIX Sonata2// File: Examples/ha_quartal.sonata3// Description: Quartal harmony: chords built by stacking fourths instead of thirds, planed in parallel through a dorian scale under a modal trumpet line.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// category: Harmony9// title: Stacked Fourths10// teaches: building chords with a function, planing, scale_run(), indexing a scale11//12// expect: notes 13613// expect: tracks 314// expect: duration 20.0000s15// expect: deterministic16// A chord of `count` scale steps stacked three steps (a fourth) apart, from index `i`.17fn quartal(notes: List<Pitch>, i: Number, count: Number) -> Chord {18 let acc = []19 for k in 0..count {20 acc = acc + [notes[i + 3 * k]]21 }22 return acc23}2425composition "Stacked Fourths" {26 tempo 120bpm27 key D dorian28 swing 60%2930 let dorian_run = scale_run(D3, dorian, 3)3132 instrument piano: GrandPiano {33 gain -6dB34 // "So What" voicings: three fourths and a third, moved in parallel.35 for step in [0, 1, 0, 2, 3, 2, 1, 0] {36 let stack = quartal(dorian_run, step, 4)37 chord stack + [stack[3] + 4st] duration 3/8 velocity 0.6538 chord stack + [stack[3] + 4st] duration 1/8 velocity 0.439 rest 1/240 }41 chord quartal(dorian_run, 0, 5) duration 2bars velocity 0.542 }4344 instrument bass: DoubleBass {45 gain -4dB46 articulation pizzicato47 repeat 8 {48 play D2 duration 1/449 play A2 duration 1/450 play D3 duration 1/451 play C3 duration 1/452 }53 play D2 duration 2bars54 }5556 instrument trumpet: Trumpet {57 gain -8dB58 pan 0.259 rest 2bars60 for i in [7, 8, 9, 11, 9, 8, 7, 4] {61 play dorian_run[i + 3] duration 1/462 }63 play dorian_run[10] duration 1/164 for i in [11, 9, 8, 7, 8, 9, 7, 4] {65 play dorian_run[i + 3] duration 1/866 }67 play dorian_run[7] duration 1/168 effects {69 reverb hall(mix: 0.2)70 }71 }72}73