SPB Git

Repository Public

lang_at_and_markers.sonata 2.3 KB 78 lines

1// ORIX Sonata2// File: Examples/lang_at_and_markers.sonata3// Description: Absolute placement: instead of counting rests, events are placed with at and bar positions; markers name the sections, and one track writes its entries out of order to show that at does not move the cursor.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// category: Language9// title: Placing Things in Time10// teaches: at blocks, markers, the cursor model, bars as positions, composition-level at11//12// expect: notes 4813// expect: tracks 314// expect: duration 25.7143s15// expect: deterministic16composition "Placing Things in Time" {17    tempo 112bpm18    key G major1920    marker "intro" at 0bars21    marker "theme" at 2bars22    marker "answer" at 6bars23    marker "ending" at 10bars2425    instrument bells: TubularBells {26        gain -10dB27        // Written out of order on purpose: each block lands at its own position.28        at 10bars {29            chord [G3, D4, G4] duration 2bars30        }31        at 0bars {32            play G4 duration 1/133            play D4 duration 1/134        }35        at 6bars {36            play D5 duration 1/237        }38    }3940    instrument piano: GrandPiano {41        gain -5dB42        // The cursor stays at 0 after an "at" block, so this rest is still needed here.43        rest 2bars44        for n in [G4, B4, D5, B4, C5, E5, D5, B4] {45            play n duration 1/446        }47        for n in [A4, C5, B4, G4] {48            play n duration 1/249        }50        at 6bars {51            // The answer starts exactly at the "answer" marker, an octave lower.52            transpose -12st {53                for n in [G4, B4, D5, B4, C5, E5, D5, B4] {54                    play n duration 1/455                }56            }57        }58        // The cursor is at bar 7 (after the theme); the ending is placed absolutely.59        at 10bars {60            chord [G2, D3, B3, D4, G4] duration 2bars61        }62    }6364    instrument bass: DoubleBass {65        gain -6dB66        articulation pizzicato67        for bar in [2, 3, 4, 5, 6, 7, 8, 9] {68            at 1bar * bar {69                play if bar % 2 == 0 then G2 else D2 duration 1/270                play if bar % 2 == 0 then B2 else F#2 duration 1/271            }72        }73        at 10bars {74            play G1 duration 2bars75        }76    }77}78
Files main
Menu

Theme