SPB Git

Repository Public

al_additive_process.sonata 1.8 KB 66 lines

1// ORIX Sonata2// File: Examples/al_additive_process.sonata3// Description: A minimalist additive process: an eleven-note cell is revealed one note at a time (1, 1 2, 1 2 3 ...), then taken apart from the front, by two marimbas a fifth apart.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// category: Algorithmic9// title: Additive Process10// teaches: take() and drop(), nested loops over growing lists, process music11//12// expect: notes 27013// expect: tracks 314// expect: duration 14.2105s15// expect: deterministic16const cell = [E4, F#4, B4, C#5, D5, F#4, E4, C#5, B4, F#4, D5]1718composition "Additive Process" {19    tempo 152bpm20    key B minor2122    instrument first: Marimba {23        gain -6dB24        pan -0.325        // Build up.26        for n in 1..=len(cell) {27            for note in take(cell, n) {28                play note duration 1/1629            }30        }31        // Take apart from the front.32        for n in 1..len(cell) {33            for note in drop(cell, n) {34                play note duration 1/1635            }36        }37        play [E4, B4] duration 1/238    }3940    instrument second: Marimba {41        gain -8dB42        pan 0.343        // The same process a fifth lower, entering after the first six stages.44        rest 1/16 * 2145        for n in 1..=len(cell) {46            for note in take(cell, n) {47                play note - 7st duration 1/16 velocity 0.648            }49        }50        for n in 1..len(cell) - 3 {51            for note in drop(cell, n) {52                play note - 7st duration 1/16 velocity 0.653            }54        }55        play [A3, E4] duration 1/256    }5758    instrument pulse: Glockenspiel {59        gain -14dB60        repeat 30 {61            play B5 duration 1/8 velocity 0.462            rest 1/863        }64    }65}66
Files main
Menu

Theme