// title: Additive Synthesis Demo with QuNeo - Patch 3 (Risset Bell) // author: Bruno Ruviaro // description: // QuNeo controller playing Risset Bells (additive synthesis demo). // code: // ************************************ // Additive Synthesis Demo with QuNEO // Patch 3 - Risset Bell // Simple attack & decay // ************************************ /* Use QuNEO SCLOrk Preset #1. This implements Risset's Bell. Each pad plays a transposition of the bell. Long Slider controls duration (time it takes for bell to decay). Vertical Sliders control ADSR envelope */ s.waitForBoot({ var padsArray = Array.newClear(64); var duration = 4; var quneoChannel = 11; // MIDIIn.connectAll; MIDIdef.freeAll; MIDIdef.noteOn( key: \noteOn, func: {arg vel, note; var index = note - 36; // start from 0 padsArray[index] = Synth("risset", [ \freq, (note+24).midicps, \dur, duration])}, noteNum: (36..99), // only pad notes (16 x 4 banks) chan: quneoChannel); // No need for noteOff responder, as bells are just attack-decay // Only available control is volume: MIDIdef.cc( key: \duration, func: {arg val, ccnum; duration = val.linlin(0, 127, 0.5, 10); ("Duration is "++duration.round(0.1)++" seconds").postln}, ccNum: 10, // Long Slider chan: quneoChannel); SynthDef(\risset, {|out = 0, pan = 0, freq = 400, amp = 0.1, dur = 2, gate = 1| var amps = #[1, 0.67, 1, 1.8, 2.67, 1.67, 1.46, 1.33, 1.33, 1, 1.33]; var durs = #[1, 0.9, 0.65, 0.55, 0.325, 0.35, 0.25, 0.2, 0.15, 0.1, 0.075]; var frqs = #[0.56, 0.56, 0.92, 0.92, 1.19, 1.7, 2, 2.74, 3, 3.76, 4.07]; var dets = #[0, 1, 0, 1.7, 0, 0, 0, 0, 0, 0, 0]; var doneActionEnv = EnvGen.ar(Env.linen(0, dur, 0), gate, doneAction: 2); var src = Mix.fill(11, {|i| var env = EnvGen.ar(Env.perc(0.005, dur*durs[i], amps[i], -4.5), gate); SinOsc.ar(freq*frqs[i] + dets[i], 0, amp*env); }); src = src * doneActionEnv * 0.5; // make sure it releases node after the end. Out.ar(out, Pan2.ar(src, pan)); }).add; FreqScope.new });