Repository Public
1// ORIX Sonata2// File: Examples/pc_gamelan.sonata3// Description: An interlocking texture in a slendro-like tuning of five nearly equal steps (240 cents): a slow gong cycle, a core melody, and two fast parts that share one line by alternating notes, as in Balinese kotekan.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// category: Pieces9// title: Five-Tone Bronze10// teaches: non-Western tuning by pitch arithmetic, interlocking parts, cycles at several speeds, custom bell11//12// expect: notes 15413// expect: tracks 514// expect: duration 16.3636s15// expect: deterministic16// Pitch `n` of a five-tone equal scale (240 cents per step) above `base`.17fn tone(base: Pitch, n: Number) -> Pitch {18 return base + 240cents * n19}2021instrument Bronze {22 model modal_percussion23 body bell24 partials [1, 2.76, 5.4, 8.9]25 decay 1.226 hardness 0.727}2829instrument Gong: Bronze {30 decay 431 hardness 0.232}3334composition "Five-Tone Bronze" {35 tempo 132bpm3637 // The core melody, as scale steps.38 let core = [0, 2, 3, 2, 4, 3, 2, 0]3940 instrument gong: Gong {41 gain -6dB42 repeat 4 {43 play tone(C2, 0) duration 2bars velocity 0.944 }45 play tone(C2, 0) duration 1bar46 }4748 instrument melody: Bronze {49 gain -8dB50 repeat 4 {51 for s in core {52 play tone(C4, s) duration 1/4 velocity 0.753 }54 }55 play tone(C4, 0) duration 1/156 }5758 // Two players share a sixteenth-note line: one takes the even notes, the other the odd ones.59 instrument polos: Bronze {60 gain -12dB61 pan -0.562 rest 2bars63 repeat 3 {64 for s in core {65 play tone(C5, s) duration 1/16 velocity 0.666 rest 1/1667 play tone(C5, s + 1) duration 1/16 velocity 0.668 rest 1/1669 }70 }71 }7273 instrument sangsih: Bronze {74 gain -12dB75 pan 0.576 rest 2bars77 repeat 3 {78 for s in core {79 rest 1/1680 play tone(C5, s + 2) duration 1/16 velocity 0.681 rest 1/1682 play tone(C5, s + 1) duration 1/16 velocity 0.683 }84 }85 }8687 instrument drum: Woodblock {88 gain -14dB89 repeat 4 {90 rhythm(C4, euclid(5, 16), step: 1/8, vel: 0.5)91 }92 }9394 master {95 effects {96 reverb hall(mix: 0.2)97 }98 }99}100