Repository Public
1// ORIX Sonata2// File: Examples/pc_music_box.sonata3// Description: A lullaby on a music box: a glockenspiel with a long decay plays melody and broken chords, and the mechanism slows to a stop over the last bars as the spring runs down.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// category: Pieces9// title: Music Box10// teaches: tempo ramp to a stop, deriving an instrument, velocity shaping, 3/411//12// expect: notes 11213// expect: tracks 214// expect: duration 34.6667s15// expect: deterministic16instrument Comb: Glockenspiel {17 decay 2.218 hardness 0.5519}2021composition "Music Box" {22 tempo 108bpm23 signature 3/424 key Eb major2526 instrument melody: Comb {27 gain -7dB28 pan 0.129 let tune = [G5, Bb5, Eb6, D6, Bb5, G5, Ab5, C6, Eb6, D6, Bb5, F5]30 repeat 2 {31 for n in tune {32 play n duration 1/4 velocity 0.733 }34 }35 // The spring runs down: the tempo falls to a crawl over four bars.36 tempo 30bpm ramp 4bars37 for n in tune {38 play n duration 1/4 velocity 0.5539 }40 play Eb6 duration 3/4 velocity 0.441 effects {42 reverb room(mix: 0.25)43 }44 }4546 instrument comb_low: Comb {47 gain -10dB48 pan -0.149 repeat 4 {50 for c in [[Eb4, G4, Bb4], [Eb4, Ab4, C5], [D4, F4, Bb4]] {51 for n in c {52 play n duration 1/8 velocity 0.4553 }54 for n in reverse(c) {55 play n duration 1/8 velocity 0.3556 }57 }58 }59 chord [Eb4, G4, Bb4] duration 3/4 velocity 0.3560 }61}62