Repository Public
1// ORIX Sonata2// File: Examples/in_patch_bass_sweep.sonata3// Description: A bass patch whose filter is opened by its own envelope on every note: a pulse wave and a sub through a resonant low-pass, saturated; the envelope amount makes the classic "wow".4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// category: Instruments9// title: Patch: Filter-Swept Bass10// teaches: envelope-controlled filter in a graph, pulse node, saturate, signal arithmetic with units11//12// expect: notes 10413// expect: tracks 314// expect: duration 17.4545s15// expect: deterministic16instrument WowBass {17 model patch18 release 200ms19 graph {20 node amp = adsr(attack: 2ms, decay: 300ms, sustain: 0.7, release: 120ms)21 node wow = adsr(attack: 40ms, decay: 260ms, sustain: 0.1, release: 100ms)22 node osc = pulse(freq: note.freq, width: 0.35) * 0.6 + sine(freq: note.freq * 0.5) * 0.623 // Cutoff from 120 Hz up to about 2.3 kHz, following the second envelope and the velocity.24 node tone = lowpass(in: osc, cutoff: 120Hz + wow * note.velocity * 2200, q: 4)25 out saturate(in: tone * amp, drive: 2.5) * 0.526 }27}2829composition "Patch: Filter-Swept Bass" {30 tempo 110bpm31 key G minor3233 instrument bass: WowBass {34 gain -5dB35 repeat 4 {36 play G1 duration 1/8 velocity 0.937 play G1 duration 1/8 velocity 0.438 play G2 duration 1/8 velocity 0.739 play G1 duration 1/8 velocity 0.440 play Bb1 duration 1/8 velocity 0.941 play Bb1 duration 1/8 velocity 0.542 play C2 duration 1/8 velocity 0.843 play D2 duration 1/8 velocity 144 play Eb2 duration 3/8 velocity 0.945 play D2 duration 1/8 velocity 0.646 play C2 duration 1/4 velocity 0.847 play F1 duration 1/4 velocity 148 }49 }5051 instrument kick: Kick {52 gain -5dB53 repeat 8 {54 play C2 duration 1/455 rest 1/456 play C2 duration 1/457 rest 1/858 play C2 duration 1/8 velocity 0.759 }60 }6162 instrument hat: ClosedHat {63 gain -15dB64 pan 0.365 repeat 32 {66 rest 1/867 play F#2 duration 1/868 }69 }70}71