{
   "description" : "This is a very basic example, I know, but I found it was hard to find basic synthdefs when I was getting started.  \r\n\r\ninput args are mostly self explainatory: \r\n\r\n freq controls pitch of carrier and modulator wave\r\n\r\n modratio scales the freq of modulator wave \r\n carratio scalese the freq of carrier wave \r\n (useful for creating different ratios of FM - carrier:modulator - ex: 1:3, 3:5, 1:9, etc )\r\n\r\n atk, delay, sustain, rel are enelope controls for a typical ADSR envelope \r\n\r\n modindex controls the intensity of the modulation, bigger values for modindex create more numerous sidebands \r\n\r\n amp is the amplitude (volume) \r\n \r\n on the line with Out.ar(0, car ! 2) \r\n   car ! 2 splits the signal in two in order to be stereo",
   "ancestor_list" : [],
   "name" : "Simple Frequency Modulation SynthDef",
   "author" : "deusofnull",
   "id" : "1-51j",
   "is_private" : null,
   "code" : "// This is a very basic example, I know, but I found it was hard \r\n/// to find basic synthdefs when I was getting started.  \r\n\r\n\r\nSynthDef(\\fm, {\r\n\t|freq=200, atk=0.01, decay=0.3, sustain=0.4, rel=0.1\r\n\tcarratio=1,modratio=1, modindex=1,\r\n\tamp=0.2, gate=1, outBus=0|\r\n\tvar env = EnvGen.kr(Env.adsr(atk, decay, sustain, rel), gate, doneAction:2);\r\n\tvar mod = SinOsc.ar(freq * modratio);\r\n\tvar car = SinOsc.ar(freq * carratio + (1 + (mod *modindex)), 0) * amp * env;\r\n\r\n\tOut.ar(0, car ! 2);\r\n}).add;\r\n)\r\n\r\n\r\n// how to start the synth with inital values\r\n~fmSynth = Synth.new(\\fm, [\\freq, 220]);\r\n// how to alter a synth in real time\r\n~fmSynth.set(\\freq, 260);\r\n// how to liberate the synth\r\n~fmSynth.free;\r\n\r\n/* design notes \r\ninput args are mostly self explainatory: \r\n freq controls pitch of carrier and modulator wave\r\n modratio scales the freq of modulator wave \r\n carratio scalese the freq of carrier wave \r\n (useful for creating different ratios of FM - carrier:modulator - ex: 1:3, 3:5, 1:9, etc )\r\n atk, delay, sustain, rel are enelope controls for a typical ADSR envelope \r\n modindex controls the intensity of the modulation, bigger values for modindex create more numerous sidebands \r\n amp is the amplitude (volume) \r\n \r\n on the line with Out.ar(0, car ! 2) \r\n   car ! 2 splits the signal in two in order to be stereo \r\n   \r\n   */",
   "labels" : [
      "fm",
      "beginner",
      "frequency_modulation"
   ]
}
