SPB Git

Repository Public

subtractive_patch.sonata 2.1 KB 63 lines

1// ORIX Sonata2// File: Examples/subtractive_patch.sonata3// Description: Instruments built from DSP graphs: a filtered two-oscillator lead with delayed feedback and a noise-excited modal bell.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7const cutoff_base = 400Hz89instrument GlassLead {10    model patch11    gain -14dB12    graph {13        node osc1 = saw(freq: note.freq)14        node osc2 = pulse(freq: note.freq * 1.005, width: 0.3)15        node amp = adsr(attack: 8ms, decay: 250ms, sustain: 0.6, release: 400ms)16        node wobble = lfo(rate: 5.5Hz)17        // The filter opens with the envelope and the velocity.18        node tone = lowpass(in: osc1 + osc2 * 0.6, cutoff: cutoff_base + amp * 2400 * note.velocity + wobble * 60, q: 2.2)19        // A short feedback loop: only causal through the delay.20        node echo = delay(in: mixed, time: 11ms)21        node mixed = tone + echo * 0.3522        out saturate(in: mixed, drive: 1.5) * amp23    }24}2526instrument NoiseBell {27    model patch28    release 2s29    graph {30        node strike = adsr(attack: 0ms, decay: 12ms, sustain: 0, release: 10ms)31        node ring = adsr(attack: 1ms, decay: 2.5s, sustain: 0, release: 2s)32        node burst = noise() * strike33        node m1 = modal(in: burst, freq: note.freq, decay: 2.2s)34        node m2 = modal(in: burst, freq: note.freq * 2.76, decay: 1.4s)35        node m3 = modal(in: burst, freq: note.freq * 5.4, decay: 0.8s)36        out (m1 + m2 * 0.5 + m3 * 0.25) * ring * note.velocity37    }38}3940composition "Subtractive Patch" {41    tempo 104bpm42    key F lydian4344    instrument lead: GlassLead {45        for n in [F4, A4, C5, E5, G5, E5, C5, B4] {46            play n duration 1/8 velocity 0.5 + (n - F4) / 24st * 0.547        }48        play A4 duration 1/2 bend { 0ms: 0st, 300ms: 0st, 600ms: 2st }49        play F4 duration 1/250        effects {51            delay echo(mode: ping_pong, time: note_value(1/8), mix: 0.2)52            reverb plate(mix: 0.18)53        }54    }5556    instrument bell: NoiseBell {57        gain -4dB58        play F5 duration 1/159        play C6 duration 1/1 velocity 0.660        play [F4, C5] duration 1/1 velocity 0.761    }62}63
Files main
Menu

Theme