Repository Public
1// ORIX Sonata2// File: Examples/jazz_trio_swing.sonata3// Description: A swung 12-bar blues for electric piano, finger bass and brushes: swing ratio, walking bass from a function, comping with accents.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// expect: notes 2699// expect: tracks 410// expect: duration 23.6364s11// expect: deterministic12// The roots of a 12-bar blues in F, one per bar.13const changes = [F2, Bb2, F2, F2, Bb2, Bb2, F2, F2, C3, Bb2, F2, C3]1415// A four-note walking line from a root: root, third, fifth, a chromatic approach to the next root.16fn walk(root: Pitch, next: Pitch) -> List<Pitch> {17 let approach = if next > root then next - 1st else next + 1st18 return [root, root + 4st, root + 7st, approach]19}2021pattern comp(root: Pitch) {22 // Dominant seventh shell voicing, on the "and" of one and on three.23 let shell = [root + 12st + 4st, root + 12st + 10st, root + 24st + 2st]24 rest 1/825 chord shell duration 1/8 staccato velocity 0.5526 rest 1/427 chord shell duration 1/4 accent velocity 0.628 rest 1/429}3031composition "Jazz Trio Swing" {32 tempo 132bpm33 key F mixolydian34 swing 64%35 seed 73637 instrument piano: ElectricPiano {38 gain -9dB39 pan -0.240 for root in changes {41 comp(root)42 }43 chord [F3, A3, Eb4, G4] duration 1bar velocity 0.544 effects {45 tremolo vintage(mix: 0.5)46 reverb room(mix: 0.15)47 }48 }4950 instrument bass: FingerBass {51 gain -5dB52 for i in 0..12 {53 for n in walk(changes[i], changes[(i + 1) % 12]) {54 play n duration 1/4 velocity 0.75 + random() * 0.155 }56 }57 play F2 duration 1bar58 }5960 instrument brushes: BrushSnare {61 gain -13dB62 pan 0.2563 repeat 12 {64 play D2 duration 1/4 velocity 0.3565 play D2 duration 1/8 velocity 0.566 play D2 duration 1/8 velocity 0.367 play D2 duration 1/4 velocity 0.3568 play D2 duration 1/8 velocity 0.5569 play D2 duration 1/8 velocity 0.370 }71 }7273 instrument ride: Ride {74 gain -18dB75 pan 0.476 repeat 12 {77 play F#2 duration 1/4 velocity 0.578 play F#2 duration 1/8 velocity 0.679 play F#2 duration 1/8 velocity 0.3580 play F#2 duration 1/4 velocity 0.581 play F#2 duration 1/8 velocity 0.682 play F#2 duration 1/8 velocity 0.3583 }84 }85}86