{
   "is_private" : null,
   "id" : "1-5d2",
   "code" : "/*\r\nRetro Stylophone\r\n\r\nReverse engineered from: https://www.waitingforfriday.com/?p=334\r\n\r\n1. Relaxation oscillator (UJT)\r\n\r\n- generated by a combination of two oscillators. The primary oscillator is a\r\n  current controlled PUT (Programmable Uni-Junction Transistor) relaxation oscillator which is\r\n  responsible for generating the overall tone of the instrument.\r\n  A secondary LFO phase-shifted provides the vibrato\r\n  (the relative slow wavering of a sound around the notes centre pitch)\r\n\r\n- around 10 VPP\r\n\r\n2. LFO phase-shift (vibrato)\r\n\r\n- generated by a low-frequency oscillator made with a transistor and several capacitors,\r\n  which produces a triangle/sine wave fed into the frequency control voltage operating the UJT\r\n\r\n- frequency of about 8.5Hz, phased shifted of 180 degree, around 4.2 VPP\r\n*/\r\n\r\n(\r\nSynthDef(\\stylophone, { |freq = 220, vibAmp = 2, toneAmp = 5, atkTime = 0.01, trigger = 0|\r\n\r\n    var lfo = OnePole.kr(LFPar.kr(8, mul: vibAmp, add: freq), 0.9); // 180 degree inversion\r\n    var relaxOsc = LFPulse.ar(lfo, width: 0.9, mul: toneAmp);\r\n\r\n    var asr = EnvGen.kr(Env.asr(atkTime * 5, releaseTime: 0.001, curve: \\lin), gate: trigger);\r\n\r\n    Out.ar(0, relaxOsc * asr)\r\n}).add\r\n)\r\n\r\nf = Synth(\\stylophone);\r\n\r\nf.set(\\freq, 208.2);\r\nf.set(\\freq, 233.4);\r\n\r\nf.set(\\trigger, 1);\r\nf.set(\\trigger, 0);\r\nf.free;",
   "labels" : [
      "synthdef",
      "stylophone",
      "vintage"
   ],
   "description" : "Basic tone simulator of a stylophone. Sugestions//improvements are welcome :)",
   "ancestor_list" : [],
   "author" : "na",
   "name" : "Stylophone tone simulation"
}
