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