Repository Public
1// ORIX Sonata2// File: Examples/in_patch_noise_perc.sonata3// Description: Percussion from filtered noise: a 12 ms burst of noise excites three short modal resonators tuned from the note, so the same patch is a shaker, a tom or a tuned block depending on pitch and velocity.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// category: Instruments9// title: Patch: Tuned Noise10// teaches: noise and modal nodes, short envelopes as excitation, pitched percussion from a patch11//12// expect: notes 11713// expect: tracks 314// expect: duration 8.0000s15// expect: deterministic16instrument NoiseDrum {17 model patch18 release 600ms19 graph {20 // A 12 ms click of noise is the "stick".21 node hit = adsr(attack: 0ms, decay: 12ms, sustain: 0, release: 10ms)22 node ring = adsr(attack: 0ms, decay: 500ms, sustain: 0, release: 300ms)23 node stick = noise() * hit * note.velocity24 // Three resonances: the note and two inharmonic modes above it. A resonator has unit gain25 // at its peak and passes only a narrow slice of the noise, hence the large gains.26 node body = modal(in: stick, freq: note.freq, decay: 0.35s, gain: 150)27 node over = modal(in: stick, freq: note.freq * 2.76, decay: 0.12s, gain: 75)28 node skin = modal(in: stick, freq: note.freq * 5.4, decay: 0.05s, gain: 45)29 out (body + over + skin) * ring30 }31}3233composition "Patch: Tuned Noise" {34 tempo 120bpm3536 instrument toms: NoiseDrum {37 gain -4dB38 repeat 4 {39 play C3 duration 1/8 velocity 0.940 play C3 duration 1/16 velocity 0.441 play C3 duration 1/16 velocity 0.442 play G2 duration 1/8 velocity 0.843 play C3 duration 1/8 velocity 0.544 play Eb3 duration 1/8 velocity 0.945 play G2 duration 1/8 velocity 0.646 play C2 duration 1/4 velocity 147 }48 effects {49 reverb room(mix: 0.2)50 }51 }5253 instrument blocks: NoiseDrum {54 gain -8dB55 pan 0.456 rest 1bar57 repeat 3 {58 for hit in rotate(euclid(7, 16), 2) {59 if hit {60 play choose([C5, G5, C6]) duration 1/16 velocity 0.661 } else {62 rest 1/1663 }64 }65 }66 }6768 instrument shaker: NoiseDrum {69 gain -12dB70 pan -0.471 repeat 32 {72 play C7 duration 1/16 velocity 0.573 play C7 duration 1/16 velocity 0.2574 }75 }76}77