SPB Git

Repository Public

rh_clave.sonata 2.5 KB 92 lines

1// ORIX Sonata2// File: Examples/rh_clave.sonata3// Description: Son clave 3-2, rumba clave and the 2-3 direction written as lists of onsets on a sixteen-step grid, over congas, bass tumbao and a piano montuno.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// category: Rhythm9// title: Clave10// teaches: rhythms as Bool lists, rotate(), the rhythm pattern, const tables11//12// expect: notes 15613// expect: tracks 414// expect: duration 13.8462s15// expect: deterministic16// 1 marks an onset on a grid of sixteenth notes.17const son = [1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0]18const rumba = [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0]1920fn onsets(steps: List<Number>) -> List<Bool> {21    let acc = []22    for s in steps {23        acc = acc + [s == 1]24    }25    return acc26}2728composition "Clave" {29    tempo 104bpm30    key C minor3132    instrument clave: Woodblock {33        gain -8dB34        pan 0.3535        repeat 2 {36            rhythm(E5, onsets(son), step: 1/16, vel: 0.85)37        }38        repeat 2 {39            rhythm(E5, onsets(rumba), step: 1/16, vel: 0.85)40        }41        // 2-3: the same son clave started from its second half.42        repeat 2 {43            rhythm(E5, rotate(onsets(son), 8), step: 1/16, vel: 0.85)44        }45    }4647    instrument conga: Kalimba {48        gain -9dB49        pan -0.350        repeat 6 {51            for i in 0..16 {52                // Open tones on the last two sixteenths of beats 2 and 4.53                if i % 8 == 6 or i % 8 == 7 {54                    play G3 duration 1/16 velocity 0.855                } else if i % 2 == 0 {56                    play C3 duration 1/16 velocity 0.3557                } else {58                    rest 1/1659                }60            }61        }62    }6364    instrument bass: FingerBass {65        gain -5dB66        repeat 3 {67            // Tumbao: the bass anticipates the next bar.68            rest 3/1669            play G2 duration 3/1670            play C3 duration 1/471            rest 1/1672            play Bb2 duration 3/1673            rest 1/874            play G2 duration 3/1675            play C3 duration 1/476            rest 1/1677            play F2 duration 3/1678        }79    }8081    instrument piano: BrightPiano {82        gain -9dB83        rest 2bars84        repeat 4 {85            for c in [[C4, Eb4, G4], [Eb4, G4, C5], [D4, F4, Bb4], [Eb4, G4, C5]] {86                play c[0] duration 1/8 velocity 0.687                chord drop(c, 1) duration 1/8 velocity 0.788            }89        }90    }91}92
Files main
Menu

Theme