{
   "ancestor_list" : [],
   "description" : "Formant Synthesis example with a silly bass voice.",
   "name" : "Silly Voice",
   "author" : "Bruno Ruviaro",
   "code" : "////////////////////////////////////////////\r\n// Silly formant synthesis example.\r\n// Using Pmono or Pbind to create a voice.\r\n// SynthDef is hardwired to bass formants.\r\n\r\n// Evaluate SynthDef first, then scroll down for Pmono and Pbind.\r\n\r\n(\r\n// SynthDef\r\nSynthDef(\"sillyVoice\", { arg\r\n\tfreq = 220,\r\n\tamp = 0.5,\r\n\tvibratoSpeed = 6,\r\n\tvibratoDepth = 4,\r\n\tvowel = 0,\r\n\tatt = 0.01,\r\n\trel = 0.1,\r\n\tlag = 1,\r\n\tgate = 1;\r\n\r\n\tvar in, vibrato, env, va, ve, vi, vo, vu, snd;\r\n\r\n\tvibrato = SinOsc.kr(vibratoSpeed, mul: vibratoDepth);\r\n\tin = Saw.ar(Lag.kr(freq, lag) + vibrato);\r\n\tenv = EnvGen.kr(Env.asr(att, 1, rel), gate, doneAction: 2);\r\n\r\n\tva = BBandPass.ar(\r\n\t\tin: in,\r\n\t\tfreq: [ 600, 1040, 2250, 2450, 2750 ],\r\n\t\tbw: [ 0.1, 0.067307692307692, 0.048888888888889, 0.048979591836735, 0.047272727272727 ],\r\n\t\tmul: [ 1, 0.44668359215096, 0.35481338923358, 0.35481338923358, 0.1 ]);\r\n\r\n\tve = BBandPass.ar(\r\n\t\tin: in,\r\n\t\tfreq: [ 400, 1620, 2400, 2800, 3100 ] ,\r\n\t\tbw: [ 0.1, 0.049382716049383, 0.041666666666667, 0.042857142857143, 0.038709677419355 ],\r\n\t\tmul: [ 1, 0.25118864315096, 0.35481338923358, 0.25118864315096, 0.12589254117942 ]);\r\n\r\n\tvi = BBandPass.ar(\r\n\t\tin: in,\r\n\t\tfreq: [ 250, 1750, 2600, 3050, 3340 ] ,\r\n\t\tbw: [ 0.24, 0.051428571428571, 0.038461538461538, 0.039344262295082, 0.035928143712575 ],\r\n\t\tmul: [ 1, 0.031622776601684, 0.15848931924611, 0.079432823472428, 0.03981071705535 ] );\r\n\r\n\tvo = BBandPass.ar(\r\n\t\tin: in,\r\n\t\tfreq:[ 400, 750, 2400, 2600, 2900 ] ,\r\n\t\tbw: [ 0.1, 0.10666666666667, 0.041666666666667, 0.046153846153846, 0.041379310344828 ],\r\n\t\tmul: [ 1, 0.28183829312645, 0.089125093813375, 0.1, 0.01 ]);\r\n\r\n\tvu = BBandPass.ar(\r\n\t\tin: in,\r\n\t\tfreq: [ 350, 600, 2400, 2675, 2950 ],\r\n\t\tbw: [ 0.11428571428571, 0.13333333333333, 0.041666666666667, 0.044859813084112, 0.040677966101695 ],\r\n\t\tmul: [ 1, 0.1, 0.025118864315096, 0.03981071705535, 0.015848931924611 ]);\r\n\r\n\tsnd = SelectX.ar(Lag.kr(vowel, lag), [va, ve, vi, vo, vu]);\r\n\tsnd = Mix.new(snd);\r\n\tOut.ar(0, snd!2 * env * amp);\r\n}).add;\r\n)\r\n\r\n\r\n// Play around with these examples/\r\n// Vowels a e i o u correspond to number 0 1 2 3 4\r\n\r\n// Example 1\r\n(\r\nPmono(\r\n\t\"sillyVoice\",\r\n\t\\note, Pseq([5, 7, 9, 11], inf),\r\n\t\\ctranspose, -14,\r\n\t\\dur, Pwhite(0.61, 1.7),\r\n\t\\amp, 0.2,\r\n\t\\vibratoSpeed, Pwhite(6,7),\r\n\t\\vibratoDepth, 4,\r\n\t\\vowel, Pwrand([0, 2], [0.8, 0.2], inf),\r\n\t\\lag, 0.5\r\n).play;\r\n)\r\n\r\n// Example 2\r\n(\r\nPmono(\r\n\t\"sillyVoice\",\r\n\t\\note, Pseq([-5, -3, -1, 0], inf),\r\n\t\\ctranspose, -14,\r\n\t\\dur, Pwhite(0.61, 1.7),\r\n\t\\amp, 0.2,\r\n\t\\vibratoSpeed, Pwhite(6,7),\r\n\t\\vibratoDepth, 4,\r\n\t\\vowel, Pwrand([0, 1], [0.8, 0.2], inf),\r\n\t\\lag, 0.5\r\n).play;\r\n)\r\n\r\n// Example 3\r\n(\r\nPbind(\r\n\t\\instrument, \"sillyVoice\",\r\n\t\\note, Prand([0, 5, 7, 9], inf),\r\n\t\\ctranspose, -14,\r\n\t\\dur, Pwhite(0.61, 1.7),\r\n\t\\amp, 0.2,\r\n\t\\vibratoSpeed, Pwhite(6,8),\r\n\t\\vibratoDepth, 4,\r\n\t\\vowel, Pwrand([0, 1], [0.8, 0.2], inf),\r\n\t\\legato, 1,\r\n\t\\att, 1.1,\r\n\t\\rel, 2.5\r\n).play;\r\n)",
   "is_private" : null,
   "id" : "1-4Vk",
   "labels" : [
      "bass",
      "filter",
      "vocal",
      "formant synthesis",
      "voice"
   ]
}
