{
   "code" : "// A.Broz: Shepard-Risset glissando demo (2020-10-31)\r\n\r\n(\r\n/*\r\n                 ,\r\n                /\r\n             `\\_\\\r\n                 \\\r\n                /O\\\r\n               '   '\r\n*/\r\nSynthDef(\\shepard, #{ |freq=440, dur=20, direction=1, amp=0.2|\r\n\tvar partialCount = 4;\r\n\tvar octRange = 2 ** (partialCount / 2);\r\n\tvar cycle = 1 / (partialCount * dur);\r\n\tvar width = if(direction >= 0, 1, 0);\r\n\tvar sig = partialCount.collect { |n|\r\n\t\tvar offset = n / partialCount;\r\n\t\tvar phase = (3 * pi / 2) + (2 * pi * offset);\r\n\t\tvar vol = SinOsc.kr(cycle, phase).range(0, 1);\r\n\t\tvar ratio = VarSaw.kr(cycle, offset, width).exprange(1/octRange, octRange);\r\n\t\tSinOsc.ar(freq * ratio) * vol;\r\n\t}.sum;\r\n\tsig = sig!2 * (amp / partialCount) * Line.kr(0, 1, 5); // fade in\r\n\tsig = JPverb.ar(sig); // reverb\r\n\tOut.ar(0, sig);\r\n}).add;\r\n\r\n~playShep = #{ |fund=300, chord=([1, 5/4, 3/2]), dir=(-1), dur=40, amp=0.1|\r\n\tchord.collect { |r| (\r\n\t\tinstrument: \\shepard,\r\n\t\tfreq: fund * r,\r\n\t\tdur: dur,\r\n\t\tdirection: dir,\r\n\t\tamp: amp,\r\n\t).play };\r\n};\r\n)\r\n\r\n// falling chord\r\n~shep = ~playShep.value;\r\n\r\n// rising chord\r\n~shep = ~playShep.(200, [1, 4/3, 16/9], 1, 70, 0.03);\r\n\r\n// free all\r\n~shep do: _.free;",
   "id" : "1-5ee",
   "is_private" : null,
   "labels" : [
      "risset",
      "shepard",
      "shepard tone",
      "shepardrisset",
      "sound effect",
      "auditory illusion"
   ],
   "ancestor_list" : [],
   "description" : "A short SynthDef that produces a Shepard-Risset glissando and some code to demo it.",
   "name" : "Shepard-Risset glissando",
   "author" : "Andrew Brož"
}
