SPB Git

Repository Public

drumkit.sonata 1.2 KB 42 lines

1// ORIX Sonata2// File: Examples/lib/drumkit.sonata3// Description: A project module: a small drum kit as patterns, imported by lang_module_drumkit.sonata.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7// One bar of kick on the given sixteenth-note steps (0-15).8pattern kick_on(steps: List<Number>) {9    for i in 0..16 {10        if contains(steps, i) {11            play C2 duration 1/16 velocity 0.912        } else {13            rest 1/1614        }15    }16}1718// One bar of backbeat with an optional ghost note before beat four.19pattern backbeat(ghost: Bool = false) {20    rest 1/421    play D2 duration 1/4 velocity 0.8522    rest 3/1623    if ghost {24        play D2 duration 1/16 velocity 0.325    } else {26        rest 1/1627    }28    play D2 duration 1/4 velocity 0.8529}3031// One bar of hats: `division` notes per bar, every `accent_every`-th one louder.32pattern hats(division: Number = 8, accent_every: Number = 2) {33    for i in 0..division {34        play F#2 duration note_value(1/1) / division velocity if i % accent_every == 0 then 0.7 else 0.3535    }36}3738// How many bars a list of sections takes, for laying out a form.39fn total_bars(sections: List<Number>) -> Number {40    return sum(sections)41}42
Files main
Menu

Theme